keyval

package
v0.0.0-...-3bfe646 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 37 Imported by: 3

Documentation

Overview

Package keyval implements Etcd and BoltDB powered storage

Index

Constants

View Source
const (

	// AllCollectionIDs identifies a collection without a specification (an ID)
	AllCollectionIDs = "__all__"
)
View Source
const NoTimeout = -1

NoTimeout defines a special duration value indicating that the blocking operation should not block

Variables

This section is empty.

Functions

func NewBolt

func NewBolt(cfg BoltConfig) (storage.LocalBackend, error)

NewBolt returns new BoltDB-backed engine

func NewETCD

func NewETCD(cfg ETCDConfig) (*electingBackend, error)

NewETCD returns new ETCD-backed engine

Types

type BoltConfig

type BoltConfig struct {
	// Path is a path to DB file
	Path string `json:"path"`
	// Clock is a clock interface, used in tests
	Clock clockwork.Clock `json:"-"`
	// Readonly sets bolt to read only mode
	Readonly bool `json:"readonly"`
	// Multi enables multi-client support
	Multi bool `json:"multi"`
	// When left unspecified, it will block for maximum of defaults.DBOpenTimeout.
	// When set to a negative duration, it will fail immediately if the file is already locked.
	// This option is only available on Darwin and Linux.
	// Use NoTimeout to make the operation non-blocking
	Timeout time.Duration
}

BoltConfig is a BoltDB configuration

func (*BoltConfig) CheckAndSetDefaults

func (b *BoltConfig) CheckAndSetDefaults() error

CheckAndSetDefaults validates this configuration and sets defaults

type Codec

type Codec interface {
	EncodeToString(val interface{}) (string, error)
	EncodeBytesToString(val []byte) (string, error)
	EncodeToBytes(val interface{}) ([]byte, error)
	DecodeFromString(val string, in interface{}) error
	DecodeBytesFromString(val string) ([]byte, error)
	DecodeFromBytes(val []byte, in interface{}) error
}

Codec is responsible for encoding/decoding objects

type ETCDConfig

type ETCDConfig struct {
	Clock         clockwork.Clock `json:"-"`
	Nodes         []string        `json:"nodes" yaml:"nodes"`
	Key           string          `json:"key" yaml:"key"`
	TLSKeyFile    string          `json:"tls_key_file" yaml:"tls_key_file"`
	TLSCertFile   string          `json:"tls_cert_file" yaml:"tls_cert_file"`
	TLSCAFile     string          `json:"tls_ca_file" yaml:"tls_ca_file"`
	RetryInterval time.Duration   `json:"retry_interval" yaml:"retry_interval"`
}

ETCDConfig represents JSON config for ETCD backend

func LocalEtcdConfig

func LocalEtcdConfig(retryTimeout time.Duration) (*ETCDConfig, error)

LocalEtcdConfig returns config for local etcd

func (*ETCDConfig) Check

func (cfg *ETCDConfig) Check() error

Check checks if all the parameters are valid and sets defaults

type U2FRegistrationCounter

type U2FRegistrationCounter struct {
	// Counter is U2F registration counter
	Counter uint32 `json:"counter"`
}

U2FRegistrationCounter defines U2F registration counter

Jump to

Keyboard shortcuts

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