Skip to content

feat: Use RepoType in Repo and impl DefaultStorage #414

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

Merged
merged 9 commits into from
Apr 8, 2025

Conversation

dariusc93
Copy link
Owner

@dariusc93 dariusc93 commented Mar 24, 2025

  • Implement RepoType trait in Repo
  • Implement DefaultStorage to mimic previous implementation for default handling of storage
  • Introduce Either and Arc implementation against the data and block store traits.
  • Add set_namespace to allow one to define the namespace for indexeddb during the initialization process.
  • Remove set_storage_type (will be replaced by RepoType in the future)
  • Remove async-trait from BlockStore, DataStore, and PinStore, using RPiT in its place to return impl Future.

Note:

  • This is a first step in reintroducing RepoType back into Repo to remove the need of dynamic dispatch when storing the storage handler in Repo, which should help to reduce allocation and footprint.
  • This disables the support of custom backends for the time being as DefaultStorage is currently defined as the default backend for handling memory, file, and web (via indexeddb) storage
  • Ipfs will eventually be structured as Ipfs<S: RepoType> to eventually support custom storage backends in the future, with a prelude that would use DefaultStorage

@dariusc93 dariusc93 marked this pull request as ready for review April 8, 2025 04:26
@dariusc93 dariusc93 merged commit 48822a1 into libp2p-next Apr 8, 2025
2 checks passed
@dariusc93 dariusc93 deleted the feat/repo-default-storage branch April 8, 2025 04:26
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.

1 participant