-
Notifications
You must be signed in to change notification settings - Fork 28
State Expiry + Online Pruning #16
Conversation
eefbc42 to
1c57ea9
Compare
1c57ea9 to
be531ae
Compare
d08083f to
4b78fa1
Compare
| } | ||
| if !exists { | ||
| return ErrPrefixMissing | ||
| } |
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.
nit: \n
| } | ||
| if !exists { | ||
| return ErrPrefixMissing | ||
| } |
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.
nit: \n
| } | ||
| if !exists { | ||
| return nil, ErrPrefixMissing | ||
| } |
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.
nit: \n
fb506fe to
ada6ee8
Compare
Signed-off-by: Gyuho Lee <[email protected]>
Signed-off-by: Gyuho Lee <[email protected]>
Signed-off-by: Gyuho Lee <[email protected]>
Signed-off-by: Gyuho Lee <[email protected]>
gyuho
left a comment
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.
lgtm, added some docs
| } | ||
|
|
||
| k = make([]byte, n) | ||
| // Assumes [prefix] and [key] do not contain delimiter |
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.
nice simplification :)
| key: []byte("hello"), | ||
| opts: []OpOption{WithPrefix()}, | ||
| kvs: []KeyValue{ | ||
| {Key: []byte("foo/hello00000"), Value: []byte("bar00000")}, |
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.
nice :)
| vm.stopc = make(chan struct{}) | ||
| vm.donecRun = make(chan struct{}) | ||
| vm.donecRegossip = make(chan struct{}) | ||
| vm.donecPrune = make(chan struct{}) |
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 being used for wait for prune 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.
Added wait on this channel in shutdown.
| kvs, err := instances[0].cli.Range(pfx, k) | ||
| gomega.Ω(err).To(gomega.BeNil()) | ||
| gomega.Ω(kvs[0].Key).To(gomega.Equal(append(append(pfx, parser.Delimiter), k...))) | ||
| gomega.Ω(kvs[0].Key).To(gomega.Equal(k)) |
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.
+1, much cleaner to expect key with prefix removed.
| kvs, err := inst.cli.Range(pfx, k) | ||
| gomega.Ω(err).To(gomega.BeNil()) | ||
| gomega.Ω(kvs[0].Key).To(gomega.Equal(append(append(pfx, parser.Delimiter), k...))) | ||
| gomega.Ω(kvs[0].Key).To(gomega.Equal(k)) |
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.
+1
Signed-off-by: Gyuho Lee <[email protected]>
|
|
||
| func PutPrefixInfo(db database.KeyValueWriter, prefix []byte, i *PrefixInfo, lastExpiry int64) error { | ||
| if i.RawPrefix == (ids.ShortID{}) { | ||
| if i.RawPrefix == ids.ShortEmpty { |
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.
❤️
chain/storage.go
Outdated
| return err | ||
| } | ||
| expiry := int64(binary.LittleEndian.Uint64(curKey[2 : 2+8])) | ||
| expired := int64(binary.LittleEndian.Uint64(curKey[2 : 2+8])) |
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 think it may make sense to extract these into a key parsing function
Signed-off-by: Gyuho Lee <[email protected]>
https://docs.google.com/document/d/1kK6J0BkogmUuwr47pseNPN5YPWtA-WSx40LhLQRa27k/edit