pub trait Storable: Clone + Sync {
type StorageKey: Clone + Eq + Hash + Send + Sync + Debug;
fn data_type() -> StorageType;
fn get_id(&self) -> Self::StorageKey;
fn get_full_binary_key_id(key: &Self::StorageKey) -> Vec<u8>;
fn key_from_full_binary(bin: &[u8]) -> Result<Self::StorageKey, String>;
fn get_full_binary_id(&self) -> Vec<u8> { ... }
}
Expand description
Storable represents an item which can be stored in the storage layer
Required Associated Types
Required Methods
sourcefn data_type() -> StorageType
fn data_type() -> StorageType
Must return a valid storage type
sourcefn get_id(&self) -> Self::StorageKey
fn get_id(&self) -> Self::StorageKey
Retrieve an instance of the id of this storable. The combination of the storable’s StorageType and this id are globally unique
sourcefn get_full_binary_key_id(key: &Self::StorageKey) -> Vec<u8>
fn get_full_binary_key_id(key: &Self::StorageKey) -> Vec<u8>
Retrieve the full binary version of a key (for comparisons)
sourcefn key_from_full_binary(bin: &[u8]) -> Result<Self::StorageKey, String>
fn key_from_full_binary(bin: &[u8]) -> Result<Self::StorageKey, String>
Reformat a key from the full-binary specification
Provided Methods
sourcefn get_full_binary_id(&self) -> Vec<u8>
fn get_full_binary_id(&self) -> Vec<u8>
Retrieve the full binary version of a key (for comparisons)