goffkv

package module
v0.0.0-...-58c9e2e Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2021 License: Apache-2.0, MIT Imports: 2 Imported by: 3

README

goffkv

License Build Status

Go version of liboffkv


License

Licensed under any of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OpErrNoEntry     = OpError{"no entry"}
	OpErrEntryExists = OpError{"entry exists"}
	OpErrEphem       = OpError{"attempt to create a child of ephemeral node"}
)

Functions

func DisassembleKey

func DisassembleKey(key string) ([]string, error)

func DisassemblePath

func DisassemblePath(path string) ([]string, error)

func RegisterClient

func RegisterClient(scheme string, newFunc NewClientFunc)

Types

type Action

type Action int
const (
	Create Action = iota + 1
	Set
	Erase
)

type Check

type Check struct {
	Key string
	Ver Version
}

type Client

type Client interface {
	Create(key string, value []byte, lease bool) (Version, error)
	Set(key string, value []byte) (Version, error)
	Cas(key string, value []byte, ver Version) (Version, error)
	Erase(key string, ver Version) error
	Exists(key string, watch bool) (Version, Watch, error)
	Get(key string, watch bool) (Version, []byte, Watch, error)
	Children(key string, watch bool) ([]string, Watch, error)
	Commit(txn Txn) ([]TxnOpResult, error)
	Close()
}

func Open

func Open(url string, prefix string) (Client, error)

type NewClientFunc

type NewClientFunc func(address string, prefix string) (Client, error)

type OpError

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

This (non-transaction) operation could possibly have successed, but failed.

func (OpError) Error

func (e OpError) Error() string

type Operation

type Operation struct {
	What  Action
	Key   string
	Value []byte
	Lease bool
}

type Txn

type Txn struct {
	Checks []Check
	Ops    []Operation
}

type TxnError

type TxnError struct {
	OpIndex int
}

Transaction failed on some operation.

func (TxnError) Error

func (e TxnError) Error() string

type TxnOpResult

type TxnOpResult struct {
	What Action
	Ver  Version
}

type UsageError

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

This operation could not possibly have successed: for example, a key or address are invalid.

func (UsageError) Error

func (e UsageError) Error() string

type Version

type Version = uint64

type Watch

type Watch = func()

Jump to

Keyboard shortcuts

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