Skip to content

Commit

Permalink
Made suggested changes.
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Littley <[email protected]>
  • Loading branch information
cody-littley committed Oct 3, 2024
1 parent 39a3521 commit 3921d4a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
6 changes: 0 additions & 6 deletions common/kvstore/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
6 changes: 3 additions & 3 deletions common/kvstore/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions common/kvstore/table_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down
4 changes: 2 additions & 2 deletions common/kvstore/tablestore/table_store_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3921d4a

Please sign in to comment.