Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

swarm/shed: Index and Uint64Field additions #1070

Closed
wants to merge 3 commits into from
Closed

Conversation

janos
Copy link
Member

@janos janos commented Dec 19, 2018

This PR addresses only shed package changes from localstore PR #1032 in order to reduce the number of changes in that PR.

  • Rename IndexItem type to Item.
  • Change Index DecodeValue signature to include shed.Item decoded from database key. This information is available in iterator functions, and is needed when mock store is injected in localstore retrieval index.
  • Add Uint64Field Dec and DecInBatch functions to complement Inc and IncInBatch.
  • Merge Index IterateAll and IterateFrom into one function Iterate and add option to iterate on a subset of Index keys that have common prefix by specifying it in IterateOptions. This is needed for localstore pull syncing index iterations.
  • Add Index Count and CountFrom that return number of items in Index.
  • Fixes a problem with sharing an underlaying byte slice array from leveldb iterator by passing a new byte slice copy to decode functions.

Copy link
Member

@zelig zelig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if the iterator options are really needed as the iterfunc can handle both prefix and open interval. since it is not too much complexity it is ok

@janos
Copy link
Member Author

janos commented Dec 20, 2018

@zelig thanks for the review. I have updated the PR with one fix, which is in fact the same type of issue as THE BUG where leveldb slice is passed, not copied, and leveldb reuses the underlaying array, changing previously used slices. 2ea4725

@janos
Copy link
Member Author

janos commented Jan 7, 2019

Submitted upstream ethereum/go-ethereum#18398.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants