kvapi

package
v0.0.0-...-3606079 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errors.New("key not found")

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Method string
	Err    error
}

func (*APIError) Error

func (a *APIError) Error() string

func (*APIError) Unwrap

func (a *APIError) Unwrap() error

type AuthError

type AuthError struct {
	Msg string
}

func (*AuthError) Error

func (a *AuthError) Error() string

type Client

type Client interface {
	// Get the value of key.
	Get(req *GetRequest) (*GetResponse, error)

	// Set key to hold given value.
	Set(rsp *SetRequest) (*SetResponse, error)
}

type ConflictError

type ConflictError struct {
	ProvidedVersion, ExpectedVersion uuid.UUID
}

func (*ConflictError) Error

func (a *ConflictError) Error() string

type GetRequest

type GetRequest struct {
	Key string
}

type GetResponse

type GetResponse struct {
	Value   string
	Version uuid.UUID
}

type SetRequest

type SetRequest struct {
	Key, Value string

	// OldVersion field is checked before updating value.
	//
	// When updating old value, OldVersion must specify uuid of currently stored value.
	// When creating new value, OldVersion must hold zero value of UUID.
	OldVersion, NewVersion uuid.UUID
}

type SetResponse

type SetResponse struct{}

Jump to

Keyboard shortcuts

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