store

package
v0.0.0-...-8ac4b46 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfInt

func ConfInt(cs meshauth.Store, name string, def int) int

ConfInt returns an int setting, with default value, from the Store.

func ConfStr

func ConfStr(cs meshauth.Store, name, def string) string

ConfInt returns an string setting, with default value, from the Store.

func Get

func Get(h2 Store, name string, to interface{}) error

Types

type BlobStore

type BlobStore interface {
	GetChunk(id string, off int, len int) ([]byte, error)

	SaveChunk(id string, off int, data []byte)
}

type BlockStore

type BlockStore interface {
	GetBlock(id string, nr int) ([]byte, error)

	SaveBlock(id string, nr int, data []byte)
}

type Conf

type Conf struct {

	// Flattened config - can be backed by env variables.
	// It is configured from Android side with the config (settings)
	// ssid, pass, vpn_ext.
	Conf map[string]string `json:"Conf,omitempty"`

	// Additional/federated sources
	Sources []meshauth.Store
	// contains filtered or unexported fields
}

Conf impplements a ConfSource and is used for bootstrap info. It may be used for general configuration of the app as well.

func (*Conf) Get

func (c *Conf) Get(name string) ([]byte, error)

Secrets - pem, acl From config dir, fallback to .ssh, .lego and /etc/certs

"name" may be a hostname

func (*Conf) List

func (c *Conf) List(name string, tp string) ([]string, error)

func (*Conf) Set

func (c *Conf) Set(conf string, data []byte) error

type Record

type Record struct {
	Data []byte

	Expiration time.Time

	Id string
}

type Store

type Store interface {
	// Get an object blob
	Get(name string) ([]byte, error)

	// Save a blob.
	Set(conf string, data []byte) error

	// List the configs starting with a prefix, of a given type.
	// Not suitable for large collections - use a database !
	List(name string, tp string) ([]string, error)
}

Store is a minimal store for small number of small objects. Good for configs in a namespace.

Jump to

Keyboard shortcuts

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