-
Notifications
You must be signed in to change notification settings - Fork 338
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: postage stamp indexing #1625
Conversation
82d3d58
to
7884099
Compare
Yay!! Thank you <3 |
rebase on master, then change https://github.com/ethersphere/bee/blob/master/.github/workflows/beekeeper.yml#L16 to |
Ok! Thanks. |
6ea0564
to
62502f9
Compare
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.
Reviewed 17 of 33 files at r1, 1 of 2 files at r2, 1 of 10 files at r4, 15 of 19 files at r7, 12 of 12 files at r8, 1 of 1 files at r9.
Reviewable status: all files reviewed, 9 unresolved discussions (waiting on @esadakar and @zelig)
pkg/localstore/gc.go, line 184 at r9 (raw file):
return 0, false, err } err = db.postageIndexIndex.DeleteInBatch(batch, item)
need to add a test for the index, to see that the entry gets removed when GCing
pkg/localstore/localstore.go, line 511 at r9 (raw file):
}, DecodeValue: func(keyItem shed.Item, value []byte) (e shed.Item, err error) { e = keyItem
this should not be here, there are other occurrences of this usage in this file and they should also be removed
pkg/localstore/mode_put_test.go, line 494 at r9 (raw file):
ts := time.Now().Unix() modes := []storage.ModePut{storage.ModePutRequest, storage.ModePutRequestPin, storage.ModePutSync, storage.ModePutUpload, storage.ModePutUploadPin}
nit, this can be pulled out to a package-level variable
pkg/localstore/mode_set_test.go, line 113 at r9 (raw file):
for _, ch := range chs { wantErr := leveldb.ErrNotFound _, err := db.retrievalDataIndex.Get(addressToItem(ch.Address()))
this is not needed since index counts are tested below
pkg/localstore/mode_set_test.go, line 119 at r9 (raw file):
// access index should not be set _, err = db.retrievalAccessIndex.Get(addressToItem(ch.Address()))
this is not needed since index counts are tested below
pkg/localstore/mode_set_test.go, line 131 at r9 (raw file):
for _, ch := range chs { newPullIndexTest(db, ch, 0, leveldb.ErrNotFound)(t)
this is not needed since we test this anyway below
pkg/postage/stamp.go, line 71 at r9 (raw file):
// MarshalBinary gives the byte slice serialisation of a stamp: // batchID[32]|index[32]|SignatureUser[65]|SignatureOwner[65].
comment incorrect
pkg/postage/stamper.go, line 48 at r9 (raw file):
toSign, err := toSignDigest(addr.Bytes(), st.issuer.batchID, index, ts) if err != nil { return nil, err
if there was an error here, we need to think about decrementing the issuer count
pkg/postage/listener/listener_test.go, line 41 at r9 (raw file):
amount: big.NewInt(42), normalisedAmount: big.NewInt(43), // bucketDepth: 10,
commented code can be removed
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.
Reviewed 1 of 33 files at r1, 3 of 10 files at r3.
Reviewable status: 41 of 47 files reviewed, 9 unresolved discussions (waiting on @acud and @zelig)
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.
Reviewed 6 of 6 files at r10.
Reviewable status: all files reviewed, 8 unresolved discussions (waiting on @acud and @zelig)
pkg/localstore/localstore.go, line 511 at r9 (raw file):
Previously, acud (acud) wrote…
this should not be here, there are other occurrences of this usage in this file and they should also be removed
Done.
pkg/localstore/mode_put_test.go, line 494 at r9 (raw file):
Previously, acud (acud) wrote…
nit, this can be pulled out to a package-level variable
Done.
pkg/localstore/mode_set_test.go, line 113 at r9 (raw file):
Previously, acud (acud) wrote…
this is not needed since index counts are tested below
Done.
pkg/localstore/mode_set_test.go, line 119 at r9 (raw file):
Previously, acud (acud) wrote…
this is not needed since index counts are tested below
Done.
pkg/localstore/mode_set_test.go, line 131 at r9 (raw file):
Previously, acud (acud) wrote…
this is not needed since we test this anyway below
Done.
pkg/postage/stamp.go, line 71 at r9 (raw file):
Previously, acud (acud) wrote…
comment incorrect
Done.
pkg/postage/listener/listener_test.go, line 41 at r9 (raw file):
Previously, acud (acud) wrote…
commented code can be removed
Done.
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.
Reviewed 5 of 6 files at r10, 1 of 3 files at r11, 2 of 2 files at r13, 1 of 1 files at r15, 3 of 3 files at r16, 2 of 2 files at r17.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @zelig)
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.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @zelig)
pkg/postage/stamp.go, line 71 at r17 (raw file):
// MarshalBinary gives the byte slice serialisation of a stamp: // batchID[32]|index[8]|Signature[65].
comment still missing timestamp field
pkg/postage/stamp_test.go, line 118 at r17 (raw file):
} func newStamp(t *testing.T) *postage.Stamp {
is this not the same as under postage/testing?
pkg/postage/stampissuer.go, line 68 at r17 (raw file):
// indexToBytes creates an uint64 index from // - bucket depth (uint8, 1st byte, <24)
this comment is outdated, the bucket depth itself is no longer part of this serialisation
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.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @zelig)
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.
Dismissed @zelig from 3 discussions.
Reviewable status: 47 of 50 files reviewed, 1 unresolved discussion (waiting on @acud, @esadakar, and @zelig)
pkg/postage/stamp.go, line 71 at r17 (raw file):
Previously, zelig (Viktor Trón) wrote…
comment still missing timestamp field
Done
pkg/postage/stamp_test.go, line 118 at r17 (raw file):
Previously, zelig (Viktor Trón) wrote…
is this not the same as under postage/testing?
Done
pkg/postage/stampissuer.go, line 68 at r17 (raw file):
Previously, zelig (Viktor Trón) wrote…
this comment is outdated, the bucket depth itself is no longer part of this serialisation
Done
change
|
Done! |
this PR extends postage stamps with indexes
the index is a 64-bit serialisation of
This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)