Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make metadata structured and pass its type as a generic parameter of Storage #279

Open
ikopylov opened this issue May 18, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@ikopylov
Copy link
Member

Metadata can be abstracted as this was done with Key. Possible trait can look like this:

trait Meta: Eq + Clone + Debug + Serialize + Deserialize {
   // Ordering type that specifies version of the value (the large value, the later is version)
   // Example: timestamp
   type VersioningKey: Ord + Eq + Clone + Debug;
   // Returns version of record from its metadata
   fn get_version(&self) -> VersioningKey;
   
   type MetaFilter: Debug;
   // Returns true when this metadata has equal fields with `filter`
   // This function is needed for `read_with`
   fn matches_with(&self, filter: &MetaFilter) -> bool;
}

This trait can allow to customize values versioning (it can be timestamp, creation time or any other versioning source). It will allow to remove explicit timestamp argument from write and delete functions. It will allow to build RangeFilter on top of VersioningKey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant