storage

package
v0.1.1-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMetadataNotExist should be returned by ReadMetadata() when no metadata is found.
	// Callers should check for this error, since in certain conditions no metadata is desired.
	ErrMetadataNotExist = errors.New("metadata does not exist")
)

Functions

This section is empty.

Types

type Backend

type Backend interface {
	ReadMetadata(context.Context, *v1alpha1.Metadata, string) error
	WriteMetadata(context.Context, *v1alpha1.Metadata, string) error
	ReadObject(context.Context, string, interface{}) error
	WriteObject(context.Context, string, interface{}) error
	GetWriter(context.Context, string) (io.Writer, error)
}

func NewGitBackend

func NewGitBackend(ctx context.Context, dir string, clOpts git.CloneOptions, cmtOpts git.CommitOptions) (Backend, error)

NewGitBackend returns a Backend that transacts with a remote git repo. This repo must already exist and be accessible using CloneOptions.{Auth,CABundle,InsecureSkipTLS}.

func NewLocalBackend

func NewLocalBackend(dir string) (Backend, error)

type Committer

type Committer interface {
	// Commit the set of writes to the Backend for persistence.
	// Commit is NOT guaranteed to be threadsafe, see implementer comments for details.
	Commit(context.Context) error
}

Committer is a Backend that collects a set of write operations into a transaction then commits them atomically. The technologies underlying these Backends are typically transactional by nature (like git); this interface exposes that nature.

Jump to

Keyboard shortcuts

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