Documentation ¶
Index ¶
- Constants
- Variables
- func NewStoreError(code StoreErrCode, msg string, args ...interface{}) error
- type Iterator
- type IteratorImpl
- type KV
- type Key
- type KeyPart
- type KeyValue
- type KeyValueStore
- type KeyValueStoreImpl
- func (d KeyValueStoreImpl) Batch() (baseTx, error)
- func (k *KeyValueStoreImpl) BeginTx(ctx context.Context) (Tx, error)
- func (d KeyValueStoreImpl) CreateTable(_ context.Context, name []byte) error
- func (d KeyValueStoreImpl) Delete(ctx context.Context, table []byte, key Key) error
- func (d KeyValueStoreImpl) DeleteRange(ctx context.Context, table []byte, lKey Key, rKey Key) error
- func (d KeyValueStoreImpl) DropTable(ctx context.Context, name []byte) error
- func (d KeyValueStoreImpl) Get(ctx context.Context, key []byte) ([]byte, error)
- func (k *KeyValueStoreImpl) GetInternalDatabase() interface{}
- func (k *KeyValueStoreImpl) Insert(ctx context.Context, table []byte, key Key, data *internal.TableData) error
- func (k *KeyValueStoreImpl) Read(ctx context.Context, table []byte, key Key) (Iterator, error)
- func (k *KeyValueStoreImpl) ReadRange(ctx context.Context, table []byte, lkey Key, rkey Key) (Iterator, error)
- func (k *KeyValueStoreImpl) Replace(ctx context.Context, table []byte, key Key, data *internal.TableData) error
- func (d KeyValueStoreImpl) SetVersionstampedValue(ctx context.Context, key []byte, value []byte) error
- func (k *KeyValueStoreImpl) Update(ctx context.Context, table []byte, key Key, ...) (int32, error)
- func (k *KeyValueStoreImpl) UpdateRange(ctx context.Context, table []byte, lKey Key, rKey Key, ...) (int32, error)
- type Listener
- type ListenerCtxKey
- type NoListener
- type StoreErrCode
- type StoreError
- type Tx
- type TxImpl
- func (t TxImpl) Commit(ctx context.Context) error
- func (t TxImpl) Delete(ctx context.Context, table []byte, key Key) error
- func (t TxImpl) DeleteRange(ctx context.Context, table []byte, lKey Key, rKey Key) error
- func (t TxImpl) Get(_ context.Context, key []byte) ([]byte, error)
- func (tx *TxImpl) Insert(ctx context.Context, table []byte, key Key, data *internal.TableData) error
- func (t TxImpl) IsRetriable() bool
- func (tx *TxImpl) Read(ctx context.Context, table []byte, key Key) (Iterator, error)
- func (tx *TxImpl) ReadRange(ctx context.Context, table []byte, lkey Key, rkey Key) (Iterator, error)
- func (tx *TxImpl) Replace(ctx context.Context, table []byte, key Key, data *internal.TableData) error
- func (t TxImpl) Rollback(ctx context.Context) error
- func (t TxImpl) SetVersionstampedValue(_ context.Context, key []byte, value []byte) error
- func (tx *TxImpl) Update(ctx context.Context, table []byte, key Key, ...) (int32, error)
- func (tx *TxImpl) UpdateRange(ctx context.Context, table []byte, lKey Key, rKey Key, ...) (int32, error)
Constants ¶
View Source
const ( InsertOp = "insert" ReplaceOp = "replace" UpdateOp = "update" UpdateRangeOp = "updateRange" DeleteOp = "delete" DeleteRangeOp = "deleteRange" )
Variables ¶
View Source
var ( // ErrDuplicateKey is returned when an insert call is made for a key that already exist. ErrDuplicateKey = NewStoreError(ErrCodeDuplicateKey, "duplicate key value, violates key constraint") // ErrConflictingTransaction is returned when there are conflicting transactions. ErrConflictingTransaction = NewStoreError(ErrCodeConflictingTransaction, "transaction not committed due to conflict with another transaction") )
Functions ¶
func NewStoreError ¶
func NewStoreError(code StoreErrCode, msg string, args ...interface{}) error
Types ¶
type IteratorImpl ¶
type IteratorImpl struct {
// contains filtered or unexported fields
}
func (*IteratorImpl) Err ¶
func (i *IteratorImpl) Err() error
func (*IteratorImpl) Next ¶
func (i *IteratorImpl) Next(value *KeyValue) bool
type KV ¶
type KV interface { Insert(ctx context.Context, table []byte, key Key, data *internal.TableData) error Replace(ctx context.Context, table []byte, key Key, data *internal.TableData) error Delete(ctx context.Context, table []byte, key Key) error DeleteRange(ctx context.Context, table []byte, lKey Key, rKey Key) error Read(ctx context.Context, table []byte, key Key) (Iterator, error) ReadRange(ctx context.Context, table []byte, lkey Key, rkey Key) (Iterator, error) Update(ctx context.Context, table []byte, key Key, apply func(*internal.TableData) (*internal.TableData, error)) (int32, error) UpdateRange(ctx context.Context, table []byte, lKey Key, rKey Key, apply func(*internal.TableData) (*internal.TableData, error)) (int32, error) SetVersionstampedValue(ctx context.Context, key []byte, value []byte) error Get(ctx context.Context, key []byte) ([]byte, error) }
type KeyValueStore ¶
type KeyValueStore interface { KV BeginTx(ctx context.Context) (Tx, error) CreateTable(ctx context.Context, name []byte) error DropTable(ctx context.Context, name []byte) error GetInternalDatabase() interface{} // TODO: CDC remove workaround }
func NewKeyValueStore ¶
func NewKeyValueStore(cfg *config.FoundationDBConfig) (KeyValueStore, error)
type KeyValueStoreImpl ¶
type KeyValueStoreImpl struct {
// contains filtered or unexported fields
}
func (*KeyValueStoreImpl) BeginTx ¶
func (k *KeyValueStoreImpl) BeginTx(ctx context.Context) (Tx, error)
func (KeyValueStoreImpl) CreateTable ¶
func (KeyValueStoreImpl) DeleteRange ¶
func (*KeyValueStoreImpl) GetInternalDatabase ¶
func (k *KeyValueStoreImpl) GetInternalDatabase() interface{}
func (KeyValueStoreImpl) SetVersionstampedValue ¶
type Listener ¶
type Listener interface { OnSet(op string, table []byte, key []byte, data []byte) OnClearRange(op string, table []byte, lKey []byte, rKey []byte) OnCommit(tx *fdb.Transaction) error OnCancel() }
func GetListener ¶
type ListenerCtxKey ¶
type ListenerCtxKey struct{}
type NoListener ¶
type NoListener struct{}
func (*NoListener) OnCancel ¶
func (l *NoListener) OnCancel()
func (*NoListener) OnClearRange ¶
func (l *NoListener) OnClearRange(string, []byte, []byte, []byte)
func (*NoListener) OnCommit ¶
func (l *NoListener) OnCommit(*fdb.Transaction) error
type StoreErrCode ¶
type StoreErrCode byte
const ( ErrCodeInvalid StoreErrCode = 0x00 ErrCodeDuplicateKey StoreErrCode = 0x01 ErrCodeConflictingTransaction StoreErrCode = 0x02 )
type StoreError ¶
type StoreError struct {
// contains filtered or unexported fields
}
func (StoreError) Error ¶
func (se StoreError) Error() string
type TxImpl ¶
type TxImpl struct {
// contains filtered or unexported fields
}
func (TxImpl) DeleteRange ¶
func (TxImpl) IsRetriable ¶
func (t TxImpl) IsRetriable() bool
IsRetriable returns true if transaction can be retried after error
func (TxImpl) SetVersionstampedValue ¶
Click to show internal directories.
Click to hide internal directories.