gleamunison/storage
Types
Trusted key/value primitives, including mutable branch pointers. Untrusted immutable content must use insert_content, not insert directly.
pub type StorageAdapter {
StorageAdapter(
insert: fn(identity.DefinitionRef, BitArray) -> Result(
Nil,
StorageError,
),
lookup: fn(identity.DefinitionRef) -> Result(
option.Option(BitArray),
StorageError,
),
list_refs: fn() -> Result(
List(identity.DefinitionRef),
StorageError,
),
close: fn() -> Result(Nil, StorageError),
)
}
Constructors
-
StorageAdapter( insert: fn(identity.DefinitionRef, BitArray) -> Result( Nil, StorageError, ), lookup: fn(identity.DefinitionRef) -> Result( option.Option(BitArray), StorageError, ), list_refs: fn() -> Result( List(identity.DefinitionRef), StorageError, ), close: fn() -> Result(Nil, StorageError), )
pub type StorageError {
StorageError(message: String)
NotFound
IoError(reason: String)
}
Constructors
-
StorageError(message: String) -
NotFound -
IoError(reason: String)
Values
pub fn check_content(
adapter: StorageAdapter,
ref: identity.DefinitionRef,
) -> Result(Nil, StorageError)
Check a known immutable ref. Mutable pointer cells are not CAS content.
pub fn dets(path: String) -> Result(StorageAdapter, StorageError)
pub fn dets_delete_file(
path: String,
) -> Result(Nil, StorageError)
pub fn inmemory() -> StorageAdapter
pub fn insert_content(
adapter: StorageAdapter,
ref: identity.DefinitionRef,
bytes: BitArray,
) -> Result(Nil, StorageError)
Validate before write; preserve the first valid binding and report I/O errors.
pub fn mnesia(
table_name: String,
) -> Result(StorageAdapter, StorageError)
pub fn partitioned_dets(
dir_path: String,
) -> Result(StorageAdapter, StorageError)
pub fn partitioned_dets_delete(
dir_path: String,
) -> Result(Nil, StorageError)
pub fn verify_content(
ref: identity.DefinitionRef,
bytes: BitArray,
) -> Result(Nil, StorageError)