A general storage engine, not sure what to pick as the interface
Simpler:
pub trait StorageEngine { fn store<T: RustcEncodable>(&mut self, t: T); }
Probably better?
pub type PrimaryKey = &[u8];
pub type SerializedRecord = &[u8];
pub trait StorageEngine {
fn store<T: Storable>(&mut self, t: T) -> ConstableResult<()>;
}
pub trait Storable {
fn get_primary_key(&self) -> PrimaryKey;
fn to_binary(&self) -> SerializedRecord;
fn from_binary(record: SerializedRecord) -> Self;
}