leases

package
v0.2.4-0...-e476a30 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GRPCHeader defines the header name for specifying a containerd lease.
	GRPCHeader = "containerd-lease"
)

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) (string, bool)

FromContext returns the lease from the context.

func SynchronousDelete

func SynchronousDelete(ctx context.Context, o *DeleteOptions) error

SynchronousDelete is used to indicate that a lease deletion and removal of any unreferenced resources should occur synchronously before returning the result.

func WithLease

func WithLease(ctx context.Context, lid string) context.Context

WithLease sets a given lease on the context

Types

type DeleteOpt

type DeleteOpt func(context.Context, *DeleteOptions) error

DeleteOpt allows configuring a delete operation

type DeleteOptions

type DeleteOptions struct {
	Synchronous bool
}

DeleteOptions provide options on image delete

type Lease

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

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

type Manager

type Manager interface {
	Create(context.Context, ...Opt) (Lease, error)
	Delete(context.Context, Lease, ...DeleteOpt) error
	List(context.Context, ...string) ([]Lease, error)
}

Manager is used to create, list, and remove leases

type Opt

type Opt func(*Lease) error

Opt is used to set options on a lease

func WithExpiration

func WithExpiration(d time.Duration) Opt

WithExpiration sets an expiration on the lease

func WithID

func WithID(id string) Opt

WithID sets the ID for the lease

func WithLabels

func WithLabels(labels map[string]string) Opt

WithLabels sets labels on a lease

func WithRandomID

func WithRandomID() Opt

WithRandomID sets the lease ID to a random unique value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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