-
Notifications
You must be signed in to change notification settings - Fork 96
[rfc] design exploration: implementations for operators against NestedIterator #2103
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
and maybe this obviates `genCached` too?
8177b75
to
0e379a9
Compare
f2c2781
to
ad56a6c
Compare
const event = Symbol(); | ||
const node = Symbol(); | ||
type Event = Add | Remove | NoOp; | ||
const ADD = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we just give them string values so we can catch/find if there is any reason to do arithmetic. I don't think there is, but then we'll know for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One reason to use SMIs over string is efficiency. SMIs are stack allocated and strings heap allocated.
it all depends on how hot things are and with global warming it is going to get pretty hot
import type {JSONObject} from '../../shared/src/json.js'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
type TODO = any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a silly way to put cast things as any
without needing an eslint
comment each time 😅
type Remove = typeof REMOVE; | ||
type NoOp = typeof NO_OP; | ||
type Entry<Type = JSONObject> = { | ||
[node]: Type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the parent row get referred to by this symbol, but child iterators get actual names based on their table?
This should be the final form (in terms of types) of
NestedIterable
. The operators (join/map/filter) are sketches to confirm the shape ofNestedIterable
is what we need.NestedIterable
is anIterable
ofEntry
.I've explored:
As well as:
The latter set uses
restartable
so many iterators can be gathered from the baseIterable
, allowing all forks to get the same data.Related document: https://www.notion.so/replicache/NestedIterable-5123f11b877e41b7bc9f00486d491d8b#adb39380a6f74402ace02cb85fe0c405
There are some possible future explorations:
join
when dealing with deltas and many:1 & many:many relationshipssort
information totopk
along with theiterable
But it seems like diminishing returns at this point.