gate

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: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(key []byte) uint32

Types

type Gate

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

TODO the routing logic is not the key point of this project, thus here is the simplest implementation. Cannot be used in product.

func NewGate

func NewGate(store *topo.Store) (*Gate, error)

func (*Gate) Close

func (g *Gate) Close() (err error)

func (*Gate) Get

func (g *Gate) Get(ctx context.Context, key string, opt types.KVCCReadOption) (types.ValueCC, error)

func (*Gate) MustRoute

func (g *Gate) MustRoute(key types.TxnKeyUnion) *Shard

func (*Gate) RemoveTxnRecord

func (g *Gate) RemoveTxnRecord(ctx context.Context, version uint64, opt types.KVCCRemoveTxnRecordOption) error

func (*Gate) RollbackKey

func (g *Gate) RollbackKey(ctx context.Context, key string, version uint64, opt types.KVCCRollbackKeyOption) error

func (*Gate) Route

func (g *Gate) Route(key types.TxnKeyUnion) (*Shard, error)

func (*Gate) Set

func (g *Gate) Set(ctx context.Context, key string, val types.Value, opt types.KVCCWriteOption) error

func (*Gate) UpdateMeta

func (g *Gate) UpdateMeta(ctx context.Context, key string, version uint64, opt types.KVCCUpdateMetaOption) error

type ReadOnlyKV

type ReadOnlyKV struct {
	*Gate
}

Use a gate as a kv server

func NewReadOnlyKV

func NewReadOnlyKV(gate *Gate) *ReadOnlyKV

func (*ReadOnlyKV) Get

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

func (*ReadOnlyKV) Set

type Shard

type Shard struct {
	types.KVCC

	ID int
}

func NewShard

func NewShard(g *topo.Group) (*Shard, error)

Jump to

Keyboard shortcuts

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