snapshot

package
v3.3.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2018 License: Apache-2.0 Imports: 7 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSnapshot = errors.New("no snapshot available")
)

Functions

func AsList

func AsList() []string

AsList returns the names of registered providers.

func AsMap

func AsMap() map[string]Provider

AsMap returns a map representing the registered Providers.

func Register

func Register(name string, p Provider)

Register makes a Provider available by the provided name.

If called twice with the same name, the name is blank, or if the provided Provider is nil, this function panics.

Types

type Config

type Config struct {
	Interval time.Duration `yaml:"interval"`
	TTL      time.Duration `yaml:"ttl"`

	Provider string                 `yaml:"provider"`
	Params   map[string]interface{} `yaml:",inline"`
}

Config represents the configuration of the snapshot provider.

type Metadata

type Metadata struct {
	Name     string
	Revision int64
	Size     int64

	Source Provider
}

func NewMetadata

func NewMetadata(name string, revision int64, size int64, source Provider) (*Metadata, error)

func (*Metadata) Filename

func (m *Metadata) Filename() string

func (*Metadata) IsValid

func (m *Metadata) IsValid() bool

type MetadataSorter

type MetadataSorter []*Metadata

func (MetadataSorter) Len

func (ms MetadataSorter) Len() int

func (MetadataSorter) Less

func (ms MetadataSorter) Less(i, j int) bool

func (MetadataSorter) Swap

func (ms MetadataSorter) Swap(i, j int)

type Provider

type Provider interface {
	Configure(Config) error

	Save(io.ReadCloser, *Metadata) error
	Get(*Metadata) (string, bool, error)
	Info() (*Metadata, error)
	Purge(time.Duration) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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