kv

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ClearValueMetaBitMaskCommitted = (^consts.ValueMetaBitMaskCommitted) & 0xff

Variables

This section is empty.

Functions

func RunTestCase

func RunTestCase(t types.T, rounds int, newDB func() (*DB, error), testCase func(t types.T, db *DB) bool) (b bool)

func TestCausalConsistency

func TestCausalConsistency(t types.T, db *DB) (b bool)

func TestConcurrentClearWriteIntent

func TestConcurrentClearWriteIntent(t types.T, db *DB) (b bool)

func TestConcurrentClearWriteIntentRemoveVersion

func TestConcurrentClearWriteIntentRemoveVersion(t types.T, db *DB) (b bool)

func TestConcurrentRemoveVersion

func TestConcurrentRemoveVersion(t types.T, db *DB) (b bool)

func TestDB

func TestDB(t types.T, db *DB) (b bool)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(serverAddr string) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Get

func (c *Client) Get(ctx context.Context, key string, opt types.KVReadOption) (types.Value, error)

func (*Client) RemoveTxnRecord

func (c *Client) RemoveTxnRecord(ctx context.Context, version uint64) error

func (*Client) RollbackKey

func (c *Client) RollbackKey(ctx context.Context, key string, version uint64) error

func (*Client) Set

func (c *Client) Set(ctx context.Context, key string, val types.Value, opt types.KVWriteOption) error

func (*Client) UpdateMeta

func (c *Client) UpdateMeta(ctx context.Context, key string, version uint64, opt types.KVUpdateMetaOption) error

type DB

type DB struct {
	// contains filtered or unexported fields
}

func NewDB

func NewDB(getVersionedValues KeyStore, txnRecordStore TxnRecordStore) *DB

func (*DB) ClearWriteIntent

func (db *DB) ClearWriteIntent(ctx context.Context, key string, version uint64) error

func (*DB) Close

func (db *DB) Close() error

func (*DB) Get

func (db *DB) Get(ctx context.Context, key string, opt types.KVReadOption) (types.Value, error)

func (*DB) RemoveTxnRecord

func (db *DB) RemoveTxnRecord(ctx context.Context, version uint64) error

func (*DB) RollbackKey

func (db *DB) RollbackKey(ctx context.Context, key string, version uint64) error

func (*DB) Set

func (db *DB) Set(ctx context.Context, key string, val types.Value, opt types.KVWriteOption) error

func (*DB) UpdateMeta

func (db *DB) UpdateMeta(ctx context.Context, key string, version uint64, opt types.KVUpdateMetaOption) error

type KeyStore

type KeyStore interface {
	Get(ctx context.Context, key string, version uint64) (types.DBValue, error) // TODO add metaOnly
	Upsert(ctx context.Context, key string, version uint64, val types.DBValue) error
	Remove(ctx context.Context, key string, version uint64) error
	RemoveIf(ctx context.Context, key string, version uint64, pred func(prev types.DBValue) error) error
	UpdateFlag(ctx context.Context, key string, version uint64, newFlag uint8) error
	Floor(ctx context.Context, key string, upperVersion uint64) (types.DBValue, uint64, error)
	Close() error
}

type KeyStoreEx

type KeyStoreEx interface {
	ReadModifyWriteKey(ctx context.Context, key string, version uint64, modifyFlag func(val types.DBValue) types.DBValue, onNotExists func(err error) error) error
}

type Server

type Server struct {
	Port int

	Done chan struct{}
	// contains filtered or unexported fields
}

func NewServer

func NewServer(port int, kv types.KV) Server

outerService indicate this is outer service

func (*Server) Close

func (s *Server) Close() error

func (*Server) Start

func (s *Server) Start() error

type Stub

type Stub struct {
	// contains filtered or unexported fields
}

func (*Stub) Get

func (stub *Stub) Get(ctx context.Context, req *kvpb.KVGetRequest) (*kvpb.KVGetResponse, error)

func (*Stub) RemoveTxnRecord

func (*Stub) RollbackKey

func (stub *Stub) RollbackKey(ctx context.Context, req *kvpb.KVRollbackKeyRequest) (*kvpb.KVRollbackKeyResponse, error)

func (*Stub) Set

func (stub *Stub) Set(ctx context.Context, req *kvpb.KVSetRequest) (*kvpb.KVSetResponse, error)

func (*Stub) UpdateMeta

func (stub *Stub) UpdateMeta(ctx context.Context, req *kvpb.KVUpdateMetaRequest) (*kvpb.KVUpdateMetaResponse, error)

type TxnRecordStore

type TxnRecordStore interface {
	GetTxnRecord(ctx context.Context, version uint64) (types.DBValue, error)
	UpsertTxnRecord(ctx context.Context, version uint64, val types.DBValue) error
	RemoveTxnRecord(ctx context.Context, version uint64) error
	Close() error
}

Directories

Path Synopsis
impl

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL