Documentation
¶
Overview ¶
Package client is a library that provides abstracted methods for interacting with the Keye database, including GET, PUT, DEL, and WATCH operations.
Index ¶
- type C
- func (c *C) Backup(chunkSize int64) ([]byte, error)
- func (c *C) Close() error
- func (c *C) Del(k string, optfns ...OptFunc) ([]string, error)
- func (c *C) Get(k string, optfns ...OptFunc) ([]*pb.KV, error)
- func (c *C) Put(k string, v []byte, optfns ...OptFunc) ([]string, error)
- func (c *C) Stats(delta time.Duration) (*Measures, error)
- func (c *C) Watch(ctx context.Context, k string, optfns ...OptFunc) (*Watcher, error)
- type Config
- type Measures
- type OptFunc
- type TxStats
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type C ¶
type C struct { Config // contains filtered or unexported fields }
C represents the Keye database client.
func (*C) Del ¶
Del deletes the specified key and its corresponding value from the database, returning the deleted key(s). When used with WithRegex(), Del treats the "key" as a regex, deleting all matching keys.
func (*C) Get ¶
Get retrieves keys. By default, Get returns the value for "key", if any. When WithRegex() is passed, Get treats the "key" as a regex. When WithKeysOnly() is passed, Get only returns the key(s) without the value(s).
func (*C) Put ¶
Put adds a key-value pair to the database and returns the modified key(s). When used with WithRegex(), Put treats the "key" as a regex, updating all matching keys with the specified value.
type Config ¶
type Config struct { // Addr is the Keye database server address. // // Default: localhost:23023 Addr string // Timeout sets the request cancellation time. // // Default: 5s Timeout time.Duration }
Config holds configurations for the Keye client.
type Measures ¶
type Measures struct { // global, ongoing stats TxStats *TxStats // freelist stats FreePageN int32 // total number of free pages on the freelist PendingPageN int32 // total number of pending pages on the freelist FreeAlloc int32 // total bytes allocated in free pages FreelistInuse int32 // total bytes used by the freelist // transaction stats TxN int32 // total number of started read transactions OpenTxN int32 // number of currently open read transactions }
Measures represents statistics about the database.
type OptFunc ¶
type OptFunc func(*opts)
func WithKeysOnly ¶
func WithKeysOnly() OptFunc
WithKeysOnly configures the operation to only return keys without values.
Applicable for: GET, WATCH
type TxStats ¶
type TxStats struct { // page statistics PageCount int64 // number of page allocations PageAlloc int64 // total bytes allocated // cursor statistics CursorCount int64 // number of cursors created // node statistics NodeCount int64 // number of node allocations NodeDeref int64 // number of node dereferences // rebalance statistics Rebalance int64 // number of node rebalances RebalanceTime time.Duration // total time spent rebalancing // split/spill statistics Split int64 // number of nodes split Spill int64 // number of nodes spilled SpillTime time.Duration // total time spent spilling // write statistics Write int64 // number of writes performed WriteTime time.Duration // total time spent writing to disk }
TxStats represents statistics about the actions performed by the transaction.