Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions ss/pebbledb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ const (

PrefixStore = "s/k:"
LenPrefixStore = 4
StorePrefixTpl = "s/k:%s/" // s/k:<storeKey>
latestVersionKey = "s/_latest" // NB: latestVersionKey key must be lexically smaller than StorePrefixTpl
StorePrefixTpl = "s/k:%s/" // s/k:<storeKey>
HashTpl = "s/_hash:%s:%d-%d" // "s/_hash:<storeKey>:%d-%d"
latestVersionKey = "s/_latest" // NB: latestVersionKey key must be lexically smaller than StorePrefixTpl
earliestVersionKey = "s/_earliest"
latestMigratedKeyMetadata = "s/_latestMigratedKey"
latestMigratedModuleMetadata = "s/_latestMigratedModule"
Expand Down Expand Up @@ -808,3 +809,13 @@ func valTombstoned(value []byte) bool {

return true
}

// WriteBlockRangeHash writes a hash for a range of blocks to the database
func (db *Database) WriteBlockRangeHash(storeKey string, beginBlockRange, endBlockRange int64, hash []byte) error {
key := []byte(fmt.Sprintf(HashTpl, storeKey, beginBlockRange, endBlockRange))
err := db.storage.Set(key, hash, defaultWriteOpts)
if err != nil {
return fmt.Errorf("failed to write block range hash: %w", err)
}
return nil
}
5 changes: 5 additions & 0 deletions ss/rocksdb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,3 +377,8 @@ func cloneAppend(bz []byte, tail []byte) (res []byte) {
func (db *Database) RawImport(ch <-chan types.RawSnapshotNode) error {
panic("implement me")
}

// WriteBlockRangeHash writes a hash for a range of blocks to the database
func (db *Database) WriteBlockRangeHash(storeKey string, beginBlockRange, endBlockRange int64, hash []byte) error {
panic("implement me")
}
5 changes: 5 additions & 0 deletions ss/sqlite/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,8 @@ func execPragmas(db *sql.DB, pragmas []string) error {
func (db *Database) RawImport(ch <-chan types.RawSnapshotNode) error {
panic("implement me")
}

// WriteBlockRangeHash writes a hash for a range of blocks to the database
func (db *Database) WriteBlockRangeHash(storeKey string, beginBlockRange, endBlockRange int64, hash []byte) error {
panic("implement me")
}
1 change: 1 addition & 0 deletions ss/types/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type StateStore interface {
SetLatestMigratedKey(key []byte) error
GetLatestMigratedModule() (string, error)
SetLatestMigratedModule(module string) error
WriteBlockRangeHash(storeKey string, beginBlockRange, endBlockRange int64, hash []byte) error

// ApplyChangeset Persist the change set of a block,
// the `changeSet` should be ordered by (storeKey, key),
Expand Down
Loading