Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Storage Engine
- A general storage engine, not sure what to pick as the interface
- Simpler:
- ```rust
- pub trait StorageEngine { fn store<T: RustcEncodable>(&mut self, t: T); }
- ```
- Probably better?
- ```rust
- 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;
- }
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement