diff --git a/common/kvstore/batch.go b/common/kvstore/batch.go index 381a249d7..1dbe2c47c 100644 --- a/common/kvstore/batch.go +++ b/common/kvstore/batch.go @@ -12,9 +12,3 @@ type Batch[T any] interface { // Size returns the number of operations in the batch. Size() uint32 } - -// BatchOperator is an interface for creating new batches. -type BatchOperator[T any] interface { - // NewBatch creates a new batch that can be used to perform multiple operations atomically. - NewBatch() Batch[T] -} diff --git a/common/kvstore/store.go b/common/kvstore/store.go index 9ab75b276..c602a8ce9 100644 --- a/common/kvstore/store.go +++ b/common/kvstore/store.go @@ -13,9 +13,6 @@ var ErrNotFound = errors.New("not found") // Implementations of this interface are expected to be thread-safe. type Store interface { - // BatchOperator performs batch operations on the store. - BatchOperator[[]byte] - // Put stores the given key / value pair in the database, overwriting any existing value for that key. // If nil is passed as the value, a byte slice of length 0 will be stored. Put(key []byte, value []byte) error @@ -27,6 +24,9 @@ type Store interface { // Delete removes the key from the database. Does not return an error if the key does not exist. Delete(key []byte) error + // NewBatch creates a new batch that can be used to perform multiple operations atomically. + NewBatch() Batch[[]byte] + // NewIterator returns an iterator that can be used to iterate over a subset of the keys in the database. // Only keys with the given prefix will be iterated. The iterator must be closed by calling Release() when done. // The iterator will return keys in lexicographically sorted order. The iterator walks over a consistent snapshot diff --git a/common/kvstore/table_store.go b/common/kvstore/table_store.go index 12e514b0c..d5f39e94f 100644 --- a/common/kvstore/table_store.go +++ b/common/kvstore/table_store.go @@ -25,8 +25,6 @@ type Table interface { // // Implementations of this interface are expected to be thread-safe, except where noted. type TableStore interface { - // BatchOperator allows for batch operations that span multiple tables. - BatchOperator[TableKey] // GetTable gets the table with the given name. If the table does not exist, it is first created. // diff --git a/common/kvstore/tablestore/table_store_wrapper.go b/common/kvstore/tablestore/table_store_wrapper.go index fdb9c8eb2..e96fbf16d 100644 --- a/common/kvstore/tablestore/table_store_wrapper.go +++ b/common/kvstore/tablestore/table_store_wrapper.go @@ -10,10 +10,10 @@ import ( "sort" ) -// Table ID 0 is reserved for use internal use by the metadata table. +// The table ID reserved for the metadata table. const metadataTableID uint32 = math.MaxUint32 -// Table ID 1 is reserved for use by the namespace table. This stores a mapping between IDs and table names. +// The table ID reserved for the namespace table. const namespaceTableID uint32 = math.MaxUint32 - 1 // The number of tables reserved for internal use.