-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: HAMT sharded directories #41
Conversation
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.
Added some comments, but non that I think should block shipping it. Maybe just get things passing even if it means decreasing coverage stuff.
src/sharded-directory.js
Outdated
* Facade for PersistentHashMap that implements Map. | ||
* @implements {Map<string, API.EntryLink>} | ||
*/ | ||
class HAMTMap { |
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.
Is this only to add mutability ? If so you could use a builder API instead
src/directory/api.ts
Outdated
@@ -82,7 +82,7 @@ export interface View<Layout extends unknown = unknown> extends Writer<Layout> { | |||
readonly writer: BlockWriter | |||
readonly settings: EncoderSettings<Layout> | |||
|
|||
links(): IterableIterator<DirectoryEntryLink> | |||
links(): IterableIterator<DirectoryEntryLink> | AsyncIterableIterator<DirectoryEntryLink> |
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.
I really don't want to introduce things that will start doing work like encoding blocks. Unless I'm mistaken links()
here is not really needed outside the writer implementation & if so I would much rather remove this method form here.
Integrates
@perma/map
to allow HAMT sharded directories to be created.In this PR there's no automated switch to HAMT, the consumer needs to explicitly use
createShardedDirectoryWriter
to build one.