store

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Snapshot

type Snapshot struct {
	Module    string
	Version   vcs.Version
	Timestamp time.Time
	Data      []byte
}

Snapshot is a module source code of the speciic version.

func (Snapshot) Key

func (s Snapshot) Key() string

Key returns a snapshot key string that can be used in cache stores.

type Store

type Store interface {
	Put(ctx context.Context, snapshot Snapshot) error
	Get(ctx context.Context, module string, version vcs.Version) (Snapshot, error)
	Del(ctx context.Context, module string, version vcs.Version) error
	Close() error
}

Store is an interface for a typical cache. It allows to put a snapshot and to get snapshot of the specific version.

func Disk

func Disk(dir string) Store

Disk returns a local disk cache that stores files within a given directory.

func Memory

func Memory(log logger, limit int64) Store

Memory creates an in-memory LRU cache.

Jump to

Keyboard shortcuts

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