This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
forked from MichaelMure/go-ipfs-pinner
-
Notifications
You must be signed in to change notification settings - Fork 10
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pins are stored in the datastore as separate key-value items. This allows pins to be saved (flushed) without havint to hash the entire pin set into a hierarchical dag on each flush. This also means there are no longer any need for internal pins to pin the blocks used to store the pin dag. Secondary indexes are also supported, allowing for pins to be searched for using keys othen than the primary key. This supports multiple pins for the same CID as well as search by different pin attributes, when those features become available.
And and improve benchmarks
- Keep separate recursive and direct CID indexes. This alows searching for a direct or recursive CIDs without having to load pins to check the mode. - Only load pins if dirty flag indicates index repair may be needed - Improved benchmarks
Also, increased test coverage.
This was referenced Nov 12, 2020
aschmahmann
suggested changes
Nov 18, 2020
aschmahmann
reviewed
Nov 19, 2020
This includes moving the pin converstion logic into the pinconv package.
- Indexer functions take context - SyncIndex is not part of Indexer interface - Test corrupt index by adding index with no pin - and more...
Base36 encode the index and strings to allow them to contain any characters without interferring with the datastore key path. Base36 was chosed because it is slightly more compact than Base32, more portable than Base58, Base64, etc., and because it has a very fast implementation. dspinner can now use cid.KeyString() to store the raw byte string as in index. This avoids having to encode the cid every time it is used as an index.
ribasushi
reviewed
Nov 20, 2020
aschmahmann
reviewed
Nov 24, 2020
- Change naming from "index" and "key" to "key" and "value" - Use wrapped datastore instead of using index key directly - Fix typo in comment
gammazero
force-pushed
the
feat/pin-datastore
branch
from
November 24, 2020 06:52
9771671
to
51a7062
Compare
gammazero
force-pushed
the
feat/pin-datastore
branch
from
November 24, 2020 07:06
51a7062
to
86f36c2
Compare
aschmahmann
approved these changes
Nov 24, 2020
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.
Looks great. Left a few tiny fixup suggestions
aschmahmann
reviewed
Nov 24, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR provides two separate pinner implementations:
The new datastore pinner stores pins in the datastore as individual key-value items. This is faster than the mdag pinner, which stored all pins in a single dag that had to be completely rewritten every time a pin was added or removed. The new pinner provides a secondary indexing mechanism that can be used to index any data that a pin has.
Benchmarks are provided to compare performance of between the old and new pinners.
Other features / changes of datastore pinner: