Version: v1.0.1 Latest Latest

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

Go to latest
Published: Jan 17, 2018 License: Apache-2.0, CC-BY-4.0 Imports: 26 Imported by: 0




View Source
const (
	// ResourceUnknown specifies an unknown resource
	ResourceUnknown gc.ResourceType = iota
	// ResourceContent specifies a content resource
	// ResourceSnapshot specifies a snapshot resource
	// ResourceContainer specifies a container resource
	// ResourceTask specifies a task resource


This section is empty.


func NewContainerStore

func NewContainerStore(tx *bolt.Tx) containers.Store

NewContainerStore returns a Store backed by an underlying bolt DB

func NewImageStore

func NewImageStore(tx *bolt.Tx) images.Store

NewImageStore returns a store backed by a bolt DB

func NewNamespaceStore

func NewNamespaceStore(tx *bolt.Tx) namespaces.Store

NewNamespaceStore returns a store backed by a bolt DB

func WithTransactionContext

func WithTransactionContext(ctx context.Context, tx *bolt.Tx) context.Context

WithTransactionContext returns a new context holding the provided bolt transaction. Functions which require a bolt transaction will first check to see if a transaction is already created on the context before creating their own.


type DB

type DB struct {
	// contains filtered or unexported fields

DB represents a metadata database backed by a bolt database. The database is fully namespaced and stores image, container, namespace, snapshot, and content data while proxying data shared across namespaces to backend datastores for content and snapshots.

func NewDB

func NewDB(db *bolt.DB, cs content.Store, ss map[string]snapshots.Snapshotter) *DB

NewDB creates a new metadata database using the provided bolt database, content store, and snapshotters.

func (*DB) ContentStore

func (m *DB) ContentStore() content.Store

ContentStore returns a namespaced content store proxied to a content store.

func (*DB) GarbageCollect

func (m *DB) GarbageCollect(ctx context.Context) (stats GCStats, err error)

GarbageCollect starts garbage collection

func (*DB) Init

func (m *DB) Init(ctx context.Context) error

Init ensures the database is at the correct version and performs any needed migrations.

func (*DB) RegisterMutationCallback

func (m *DB) RegisterMutationCallback(fn func(bool))

RegisterMutationCallback registers a function to be called after a metadata mutations has been performed.

The callback function in an argument for whether a deletion has occurred since the last garbage collection.

func (*DB) Snapshotter

func (m *DB) Snapshotter(name string) snapshots.Snapshotter

Snapshotter returns a namespaced content store for the requested snapshotter name proxied to a snapshotter.

func (*DB) Update

func (m *DB) Update(fn func(*bolt.Tx) error) error

Update runs a writable transaction on the metadata store.

func (*DB) View

func (m *DB) View(fn func(*bolt.Tx) error) error

View runs a readonly transaction on the metadata store.

type GCStats

type GCStats struct {
	MetaD     time.Duration
	ContentD  time.Duration
	SnapshotD map[string]time.Duration

GCStats holds the duration for the different phases of the garbage collector

type Lease

type Lease struct {
	ID        string
	CreatedAt time.Time
	Labels    map[string]string

	Content   []string
	Snapshots map[string][]string

Lease retains resources to prevent garbage collection before the resources can be fully referenced.

type LeaseManager

type LeaseManager struct {
	// contains filtered or unexported fields

LeaseManager manages the create/delete lifecyle of leases and also returns existing leases

func NewLeaseManager

func NewLeaseManager(tx *bolt.Tx) *LeaseManager

NewLeaseManager creates a new lease manager for managing leases using the provided database transaction.

func (*LeaseManager) Create

func (lm *LeaseManager) Create(ctx context.Context, lid string, labels map[string]string) (Lease, error)

Create creates a new lease using the provided lease

func (*LeaseManager) Delete

func (lm *LeaseManager) Delete(ctx context.Context, lid string) error

Delete delets the lease with the provided lease ID

func (*LeaseManager) List

func (lm *LeaseManager) List(ctx context.Context, includeResources bool, filter ...string) ([]Lease, error)

List lists all active leases


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL