backend

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BackendNameList = []string{"local", "s3", "git"}

BackendNameList is an ordered list of backend names for listing in help message.

View Source
var Backends = map[string]Factory{}

Backends associates backend type names to constructor functions.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// Exists returns true if a store exists in the backend, false otherwise
	Exists() (bool, error)
	// Save persists encrypted data to the backend
	Save(data []byte) error
	// Load reads encrypted data from the backend
	Load() ([]byte, error)

	ExistsContext(ctx context.Context) (bool, error)
	SaveContext(ctx context.Context, data []byte) error
	LoadContext(ctx context.Context) ([]byte, error)
}

Backend implements the common backend operations.

type Factory

type Factory interface {
	// New returns an initialized backend from the given configuration
	New(conf map[string]interface{}) (Backend, error)
	NewContext(ctx context.Context, conf map[string]interface{}) (Backend, error)

	// Name returns a human-readable name for the backend
	Name() string
	// Description returns a short, human-readable description of the backend
	Description() string
	// Flags returns a pflag FlagSet containing the options related to the
	// backend
	Flags() *pflag.FlagSet
}

Factory can instantiate a new Backend with New, and other static backend-related functions.

Jump to

Keyboard shortcuts

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