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

feat: HAMT sharded directories #41

Merged
merged 7 commits into from
Mar 14, 2023

Conversation

alanshaw
Copy link
Member

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.

Copy link
Collaborator

@Gozala Gozala left a 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.

* Facade for PersistentHashMap that implements Map.
* @implements {Map<string, API.EntryLink>}
*/
class HAMTMap {
Copy link
Collaborator

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

@@ -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>
Copy link
Collaborator

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.

@alanshaw alanshaw merged commit fb87f9d into ipld:main Mar 14, 2023
@alanshaw alanshaw deleted the feat/sharded-directories branch March 14, 2023 17:10
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

Successfully merging this pull request may close these issues.

2 participants