Documentation ¶
Index ¶
- Constants
- func CreateTSComparator() *grocksdb.Comparator
- func NewVersionDBOpts(sstFileWriter bool) *grocksdb.Options
- func OpenVersionDB(dir string) (*grocksdb.DB, *grocksdb.ColumnFamilyHandle, error)
- func OpenVersionDBAndTrimHistory(dir string, version int64) (*grocksdb.DB, *grocksdb.ColumnFamilyHandle, error)
- type Store
- func (s Store) FeedChangeSet(version int64, store string, changeSet *iavl.ChangeSet) error
- func (s Store) GetAtVersion(storeKey string, key []byte, version *int64) ([]byte, error)
- func (s Store) GetAtVersionSlice(storeKey string, key []byte, version *int64) (*grocksdb.Slice, error)
- func (s Store) GetLatestVersion() (int64, error)
- func (s Store) HasAtVersion(storeKey string, key []byte, version *int64) (bool, error)
- func (s Store) Import(version int64, ch <-chan versiondb.ImportEntry) error
- func (s Store) IteratorAtVersion(storeKey string, start, end []byte, version *int64) (types.Iterator, error)
- func (s Store) PutAtVersion(version int64, changeSet []types.StoreKVPair) error
- func (s Store) ReverseIteratorAtVersion(storeKey string, start, end []byte, version *int64) (types.Iterator, error)
- func (s Store) SetLatestVersion(version int64) error
Constants ¶
const ( TimestampSize = 8 StorePrefixTpl = "s/k:%s/" ImportCommitBatchSize = 10000 )
const VersionDBCFName = "versiondb"
Variables ¶
This section is empty.
Functions ¶
func CreateTSComparator ¶
func CreateTSComparator() *grocksdb.Comparator
CreateTSComparator should behavior identical with rocksdb builtin timestamp comparator. we also use the same builtin comparator name so the builtin tools `ldb`/`sst_dump` can work with the database.
func NewVersionDBOpts ¶
NewVersionDBOpts returns the options used for the versiondb column family. FIXME: we don't enable dict compression for SSTFileWriter, because otherwise the file writer won't report correct file size. https://github.com/facebook/rocksdb/issues/11146
func OpenVersionDB ¶
OpenVersionDB opens versiondb, the default column family is used for metadata, actually key-value pairs are stored on another column family named with "versiondb", which has user-defined timestamp enabled.
func OpenVersionDBAndTrimHistory ¶
func OpenVersionDBAndTrimHistory(dir string, version int64) (*grocksdb.DB, *grocksdb.ColumnFamilyHandle, error)
OpenVersionDBAndTrimHistory opens versiondb similar to `OpenVersionDB`, but it also trim the versions newer than target one, can be used for rollback.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func NewStoreWithDB ¶
func NewStoreWithDB(db *grocksdb.DB, cfHandle *grocksdb.ColumnFamilyHandle) Store
func (Store) FeedChangeSet ¶
FeedChangeSet is used to migrate legacy change sets into versiondb
func (Store) GetAtVersion ¶
GetAtVersion implements VersionStore interface
func (Store) GetAtVersionSlice ¶
func (Store) GetLatestVersion ¶
GetLatestVersion returns the latest version stored in plain state, it's committed after the changesets, so the data for this version is guaranteed to be persisted. returns -1 if the key don't exists.
func (Store) HasAtVersion ¶
HasAtVersion implements VersionStore interface
func (Store) Import ¶
func (s Store) Import(version int64, ch <-chan versiondb.ImportEntry) error
Import loads the initial version of the state
func (Store) IteratorAtVersion ¶
func (s Store) IteratorAtVersion(storeKey string, start, end []byte, version *int64) (types.Iterator, error)
IteratorAtVersion implements VersionStore interface
func (Store) PutAtVersion ¶
func (s Store) PutAtVersion(version int64, changeSet []types.StoreKVPair) error
PutAtVersion implements VersionStore interface
func (Store) ReverseIteratorAtVersion ¶
func (s Store) ReverseIteratorAtVersion(storeKey string, start, end []byte, version *int64) (types.Iterator, error)
ReverseIteratorAtVersion implements VersionStore interface