Skip to content

Commit

Permalink
Remove storage snapshot functions (#830)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferranbt authored Oct 27, 2022
1 parent 46a988b commit 384ffa2
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 46 deletions.
17 changes: 0 additions & 17 deletions blockchain/storage/keyvalue.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,23 +221,6 @@ func (s *KeyValueStorage) ReadBody(hash types.Hash) (*types.Body, error) {
return body, err
}

// SNAPSHOTS //

// WriteSnapshot writes the snapshot to the DB
func (s *KeyValueStorage) WriteSnapshot(hash types.Hash, blob []byte) error {
return s.set(SNAPSHOTS, hash.Bytes(), blob)
}

// ReadSnapshot reads the snapshot from the DB
func (s *KeyValueStorage) ReadSnapshot(hash types.Hash) ([]byte, bool) {
data, ok := s.get(SNAPSHOTS, hash.Bytes())
if !ok {
return []byte{}, false
}

return data, true
}

// RECEIPTS //

// WriteReceipts writes the receipts
Expand Down
3 changes: 0 additions & 3 deletions blockchain/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ type Storage interface {
WriteBody(hash types.Hash, body *types.Body) error
ReadBody(hash types.Hash) (*types.Body, error)

WriteSnapshot(hash types.Hash, blob []byte) error
ReadSnapshot(hash types.Hash) ([]byte, bool)

WriteReceipts(hash types.Hash, receipts []*types.Receipt) error
ReadReceipts(hash types.Hash) ([]*types.Receipt, error)

Expand Down
26 changes: 0 additions & 26 deletions blockchain/storage/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,6 @@ type MockStorage struct {
writeCanonicalHeaderFn writeCanonicalHeaderDelegate
writeBodyFn writeBodyDelegate
readBodyFn readBodyDelegate
writeSnapshotFn writeSnapshotDelegate
readSnapshotFn readSnapshotDelegate
writeReceiptsFn writeReceiptsDelegate
readReceiptsFn readReceiptsDelegate
writeTxLookupFn writeTxLookupDelegate
Expand Down Expand Up @@ -680,30 +678,6 @@ func (m *MockStorage) HookReadBody(fn readBodyDelegate) {
m.readBodyFn = fn
}

func (m *MockStorage) WriteSnapshot(hash types.Hash, blob []byte) error {
if m.writeSnapshotFn != nil {
return m.writeSnapshotFn(hash, blob)
}

return nil
}

func (m *MockStorage) HookWriteSnapshot(fn writeSnapshotDelegate) {
m.writeSnapshotFn = fn
}

func (m *MockStorage) ReadSnapshot(hash types.Hash) ([]byte, bool) {
if m.readSnapshotFn != nil {
return m.readSnapshotFn(hash)
}

return []byte{}, true
}

func (m *MockStorage) HookReadSnapshot(fn readSnapshotDelegate) {
m.readSnapshotFn = fn
}

func (m *MockStorage) WriteReceipts(hash types.Hash, receipts []*types.Receipt) error {
if m.writeReceiptsFn != nil {
return m.writeReceiptsFn(hash, receipts)
Expand Down

0 comments on commit 384ffa2

Please sign in to comment.