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

StorageProvider methods [tracking] #149

Closed
16 of 18 tasks
sandreae opened this issue Jun 10, 2022 · 2 comments
Closed
16 of 18 tasks

StorageProvider methods [tracking] #149

sandreae opened this issue Jun 10, 2022 · 2 comments
Assignees

Comments

@sandreae
Copy link
Member

sandreae commented Jun 10, 2022

We will be needing extra methods on StorageProvider as we move forward, let's collect them here to get an overview of how things might look. Also as we use it more, we may want to make changes.

Also general renaming, possibly following these conventions more closely: https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv

LogStore

  • rename: get to get_log or something else better.
  • remove StorageLog associated type in favour of passing in params
  • remove next_log_id()

EntryStore

OperationStore

DocumentStore

  • rename: get_document_by_id to get_latest_view_for_document
  • add: get_document_by_id which returns the actual Document rather than the view.
  • add: get_document_id_by_view_id(document_view_id: DocumentViewId) -> Result<DocumentId>
  • add: get_document_by_view_id(view_id: DocumentViewId) -> Result<Document> (returns document with the given view inside, not the latest view)
  • change: get_documents_by_schema(schema: SchemaId) -> Result<Vec<Document>>
  • change: DocumentMeta.operations: Option<Vec<VerifiedOperation>>
  • add: get_parents_with_pinned_relation(document_view_id: &DocumentViewId) -> Result<Vec<DocumentViewId>> Implement reduce and dependency task logic #144
  • add: get_parents_with_unpinned_relation(document_view_id: &Documentd) -> Result<Vec<DocumentViewId>> Implement reduce and dependency task logic #144

SchemaStore

  • add: get_log_seq_for_schema(schema_id: SchemaId) -> Vec<(Author, Vec<(LogId, SeqNum)>>

StorageProvider

  • move: any non-top level methods (think there is only one left) to their respective sub-store.
  • refactor this out completely in favour of using individual store traits
  • remove get_document_by_entry()

General

  • look again at the errors we have, room for improvement, simplification, a lot may be redundant now that validation logic is elsewhere
  • rename all basic getters simply get_x() (now they are get_x_by_id())

QUESTIONS:

  • do we want an error or Ok(false) to be returned from insert methods?
  • in general DocumentStore needs a little reflection now we used it a bit, in particular "insert"ing documents is confusing, what do we expect this to do? Create or update a documents latest view id? As well as the view? Delete a document??? Splitting it out into multiple methods might help, Also not having to pass in a Document struct would be handy.
@adzialocha
Copy link
Member

Is this ready? ✨

@sandreae
Copy link
Member Author

Unfortunately, no... Couldn't get round to making these changes yet.

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

No branches or pull requests

2 participants