-
Notifications
You must be signed in to change notification settings - Fork 10
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
[Indexer] Add index storage interfaces and base in-memory implementation #34
Conversation
[Indexer] Decoding of event values
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 good to me, just some minor comments
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.
mostly comments about the memory storage which is temporary. feel free to ignore if you're planning to move away from it quickly
// Retrieve the block using the blockHeightsIDs map | ||
blockID, exists := s.base.blockHeightsIDs[height] | ||
if !exists { | ||
return nil, errors.NotFound |
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.
this would indicate an inconsistent state. log an error?
// Retrieve the block using the blocksIDs map | ||
block, exists := s.base.blocksIDs[blockID] | ||
if !exists { | ||
return nil, errors.NotFound |
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.
same here
s.base.firstHeight = block.Height | ||
} | ||
if s.base.lastHeight == unknownHeight || block.Height > s.base.lastHeight { | ||
s.base.lastHeight = block.Height |
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.
does it matter if blocks are store sequentially?
storage/memory/storage.go
Outdated
r.base.receiptBlockIDTxIDs[receipt.BlockHash] = receipt.TxHash | ||
|
||
if _, ok := r.base.bloomHeight[receipt.BlockNumber.Int64()]; ok { | ||
return errors.Duplicate |
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 this would mean that there were 2 receipts with the same ID but different BlockNumber
. That seems like an inconsistent state
|
||
receipt, exists := r.base.receiptsTxIDs[txID] | ||
if !exists { | ||
return nil, errors.NotFound |
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.
this would indicate an inconsistent state. log an error?
storage/memory/storage.go
Outdated
r.base.mu.RLock() | ||
defer r.base.mu.RUnlock() | ||
|
||
if start.Cmp(end) > -1 { |
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
if start.Cmp(end) > -1 { | |
if start.Cmp(end) >= 0 { |
[Indexer] Decoding of event values
…ndexer-dec Revert "[Indexer] Decoding of event values"
[Indexer] Implement log providers and filters
Related: #17
This is the first part of the PRs that will implement persistent storage. An interfaces have been defined for the indexers as well as a simple in-memory implementation that satisfies the definitions. A simple test suite has been added that validates expected and defined behaviour of the interface implementations.
For contributor use:
master
branchFiles changed
in the Github PR explorer