slate
Types
Access mode for opening tables.
pub type AccessMode {
ReadWrite
ReadOnly
}
Constructors
-
ReadWriteRead and write access (default)
-
ReadOnlyRead-only access — writes will return
AccessDenied
Errors that can occur during DETS operations.
pub type DetsError {
NotFound
FileNotFound
AlreadyOpen
TableDoesNotExist
FileSizeLimitExceeded
KeyAlreadyPresent
AccessDenied
TypeMismatch
TableNamePoolExhausted
DecodeErrors(List(decode.DecodeError))
ErlangError(String)
}
Constructors
-
NotFoundNo value found for the given key
-
FileNotFoundTable file does not exist (when opening without create)
-
AlreadyOpenTable is already open with a different configuration
-
TableDoesNotExistThe table does not exist (not open)
-
FileSizeLimitExceededFile exceeds the 2 GB DETS limit
-
KeyAlreadyPresentKey already exists (for insert_new)
-
AccessDeniedWrite operation attempted on a read-only table
-
TypeMismatchTable type mismatch (e.g., opening a set file as a bag)
-
TableNamePoolExhaustedAll internal table name slots are in use; close unused tables to free slots
-
DecodeErrors(List(decode.DecodeError))Data read from disk did not match the expected Gleam types
-
ErlangError(String)Erlang-level error (catch-all)
DETS table type.
pub type Kind {
Set
Bag
DuplicateBag
}
Constructors
-
SetOne value per key (default)
-
BagMultiple distinct values per key
-
DuplicateBagMultiple values per key, duplicates allowed
Auto-repair policy for improperly closed tables.
pub type RepairPolicy {
AutoRepair
ForceRepair
NoRepair
}
Constructors
-
AutoRepairRepair automatically if needed (default)
-
ForceRepairForce repair even if file appears clean
-
NoRepairDon’t repair, return error instead
Values
pub fn is_dets_file(path: String) -> Result(Bool, DetsError)
Check whether the given file is a valid DETS file.
Returns Ok(True) if the file is a valid DETS file, Ok(False) if
it exists but is not a DETS file, or an error if the file cannot be read.
let assert Ok(True) = slate.is_dets_file("data/cache.dets")
let assert Ok(False) = slate.is_dets_file("README.md")