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

[EPIC] Defra Views #2071

Open
4 of 7 tasks
AndrewSisley opened this issue Nov 23, 2023 · 1 comment
Open
4 of 7 tasks

[EPIC] Defra Views #2071

AndrewSisley opened this issue Nov 23, 2023 · 1 comment
Labels
area/planner Related to the planner system area/query Related to the query component area/schema Related to the schema system epic Includes sub-issues feature New feature or request

Comments

@AndrewSisley
Copy link
Contributor

AndrewSisley commented Nov 23, 2023

See SIP https://github.com/sourcenetwork/SIPs/blob/sisley/views/x-views/README.md for end-goal

Tasks

Preview Give feedback
  1. AndrewSisley
  2. area/planner area/query area/schema feature
    AndrewSisley
  3. area/query area/schema feature
    AndrewSisley
  4. area/query area/schema feature priority/low
  5. area/query area/schema area/testing code quality
  6. feature priority/high
    AndrewSisley
  7. area/collections area/p2p feature
@AndrewSisley AndrewSisley added feature New feature or request epic Includes sub-issues area/query Related to the query component area/schema Related to the schema system area/planner Related to the planner system labels Nov 23, 2023
@AndrewSisley
Copy link
Contributor Author

Personal long-term notes stashed from branch (just posting here to save them, not for consumption by others):

/*
view cache item should pair with dag items
local storage field ids? (can be skipped for now and just store complex item under one key (json/cbor/etc)) - store as fixed-size arrays
of field values (with nil elements for nil fields) - don't store field names in the blob :)

item id can be the cid of the dag item (source doc cids + view cid) (could make it into docID looking like thing if we want,
but that complicates the logic a lot). - nope, original query order should be preserved somehow (update problem) (linked list perhaps?
ll doesn't actually need to affect fetch order, (unless limit/offset given))

dag can be spoofed in short term - we can calc the ids and stuff but not bother storing it initially (will hopefully mean
the ids dont change when we do it properly - this might be spoiled by the view id problem, could perhaps just use item index
for now?).
view cid is a little problematic as global colID does not yet exist, need some temporary thing here.
conclusion: just use index for now - this allows us to skip the linked list for now, and it is easy to build it in a way that doesn't
make linked-listing it in the future unnesecarily painful

collections become cached if the cache exists by calling views/refresh - need a second func to clear the cache, allowing the col to
become cacheless again (note, long term this can also work for normal cols)


/colID/itemID => blob
note: below is not desirable now, but may be handy when introducing the DAG/P2P for views, note this in a comment somewhere
// This can be made to fit the DataStoreKey format (new instance type, fieldID omitted for now (may be introduced later)):
/colID/instanceType/itemID => blob

// order-index (not required if explicit order given) (can be iterated in parallel to docs, allowing docs to be yielded once they are
// known to be next, this would also solve the limit/offset problem but would be wasteful depending on limit/offset sizes) - the linked
// list would actually remove the need for secondary indexes of order-by clauses
// problem: This set itself is not sorted, and would either need full iteration or point lookups (I benched point lookups, this is fine)
// note: colID prefix is handy for refreshes, not just for cosmetic reasons
/colID/current-itemID/next-itemID => nil (next item id optional)
Also needs the start item flagged:
/colID/s/itemID



//note: indexes can be done in later PR, ~~but are still needed for David (4weeks)~~ (solved by linked list)
// index auto created for order:
colID/indexID/fieldValue/itemID


Updates:
- refresh on-demand (is some benefit of keeping this long term, so maybe we want it, especially for testing of the fancy dynamic updates)
  this could be triggered via directive, or via client command
- time based expiry? (less useful for testing, but might be easier to implement (testing might be slightly harder (could just set really low expiry)))
- update as source updated (complex logic for figuring out which doc updates which item)

note: update methods are not actually mutually exclusive, and they can all be used together.  Dynamic updates should be defined on the view
(and perhaps default to off initially), and a timer, but the others do not need to be.
*/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/planner Related to the planner system area/query Related to the query component area/schema Related to the schema system epic Includes sub-issues feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant