cache

package
v0.0.0-...-94cc96a Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLocked = errors.New("locked")
)

Functions

func CachePolicyRetain

func CachePolicyRetain(m withMetadata) error

func GetCreatedAt

func GetCreatedAt(si *metadata.StorageItem) time.Time

func GetDescription

func GetDescription(si *metadata.StorageItem) string

func GetLayerType

func GetLayerType(m withMetadata) string

func GetRecordType

func GetRecordType(m withMetadata) client.UsageRecordType

func HasCachePolicyRetain

func HasCachePolicyRetain(m withMetadata) bool

func IsLocked

func IsLocked(err error) bool

func IsNotFound

func IsNotFound(err error) bool

func ReadFile

func ReadFile(ctx context.Context, ref ImmutableRef, req ReadRequest) ([]byte, error)

func SetLayerType

func SetLayerType(m withMetadata, value string) error

func SetRecordType

func SetRecordType(m withMetadata, value client.UsageRecordType) error

Types

type Accessor

type Accessor interface {
	Get(ctx context.Context, id string, opts ...RefOption) (ImmutableRef, error)
	GetFromSnapshotter(ctx context.Context, id string, opts ...RefOption) (ImmutableRef, error)
	New(ctx context.Context, s ImmutableRef, opts ...RefOption) (MutableRef, error)
	GetMutable(ctx context.Context, id string) (MutableRef, error) // Rebase?
}

type Controller

type Controller interface {
	DiskUsage(ctx context.Context, info client.DiskUsageInfo) ([]*client.UsageInfo, error)
	Prune(ctx context.Context, ch chan client.UsageInfo, info client.PruneInfo) error
	GC(ctx context.Context) error
}

type ExternalRefChecker

type ExternalRefChecker interface {
	Exists(key string) bool
}

type ExternalRefCheckerFunc

type ExternalRefCheckerFunc func() (ExternalRefChecker, error)

type FileRange

type FileRange struct {
	Offset int
	Length int
}

type GCPolicy

type GCPolicy struct {
	MaxSize         uint64
	MaxKeepDuration time.Duration
}

GCPolicy defines policy for garbage collection

type ImmutableRef

type ImmutableRef interface {
	Ref
	Parent() ImmutableRef
	Finalize(ctx context.Context, commit bool) error // Make sure reference is flushed to driver
	Clone() ImmutableRef
}

type Manager

type Manager interface {
	Accessor
	Controller
	Close() error
}

func NewManager

func NewManager(opt ManagerOpt) (Manager, error)

type ManagerOpt

type ManagerOpt struct {
	Snapshotter     snapshot.SnapshotterBase
	GCPolicy        GCPolicy
	MetadataStore   *metadata.Store
	PruneRefChecker ExternalRefCheckerFunc
}

type Mountable

type Mountable interface {
	Mount(ctx context.Context, readonly bool) (snapshot.Mountable, error)
}

type MutableRef

type MutableRef interface {
	Ref
	Commit(context.Context) (ImmutableRef, error)
}

type ReadRequest

type ReadRequest struct {
	Filename string
	Range    *FileRange
}

type Ref

type Ref interface {
	Mountable
	ID() string
	Release(context.Context) error
	Size(ctx context.Context) (int64, error)
	Metadata() *metadata.StorageItem
}

Ref is a reference to cacheable objects.

type RefOption

type RefOption func(withMetadata) error

func WithCreationTime

func WithCreationTime(tm time.Time) RefOption

func WithDescription

func WithDescription(descr string) RefOption

func WithRecordType

func WithRecordType(t client.UsageRecordType) RefOption

Directories

Path Synopsis
Package contenthash is a generated protocol buffer package.
Package contenthash is a generated protocol buffer package.
v1

Jump to

Keyboard shortcuts

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