store

package
v0.0.0-...-43d1ab5 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StackResourceKind defines the Kind of swarmkit Resources belonging to
	// stacks.
	StackResourceKind = "github.com/docker/stacks/Stack"
	// StackResourcesDescription is the description string of the stack
	// extension kind.
	StackResourcesDescription = "Docker server-side stacks"
)

Variables

This section is empty.

Functions

func AddStack

func AddStack(ctx context.Context, rc ResourcesClient, stackSpec types.StackSpec) (string, error)

AddStack adds a stack

func ConstructSnapshotStack

func ConstructSnapshotStack(resource *api.Resource) (*interfaces.SnapshotStack, error)

ConstructSnapshotStack takes a Swarmkit Resource object, calls UnmarshalSnapshotStack and constructs a fresh types.Stack and populates its fields (Meta, Version, and ID) contained in the Resource

func ConstructStack

func ConstructStack(resource *api.Resource) (*types.Stack, error)

ConstructStack takes a Swarmkit Resource object, calls UnmarshalStackSpec and constructs a fresh types.Stack and populates its fields (Meta, Version, and ID) contained in the Resource

func DeleteStack

func DeleteStack(ctx context.Context, rc ResourcesClient, id string) error

DeleteStack deletes a stack

func GetSnapshotStack

func GetSnapshotStack(ctx context.Context, rc ResourcesClient, id string) (interfaces.SnapshotStack, error)

GetSnapshotStack returns a stack

func GetStack

func GetStack(ctx context.Context, rc ResourcesClient, id string) (types.Stack, error)

GetStack returns a stack

func InitExtension

func InitExtension(ctx context.Context, rc ResourcesClient) error

InitExtension initializes the stack resource extension object

func ListStacks

func ListStacks(ctx context.Context, rc ResourcesClient) ([]types.Stack, error)

ListStacks returns all stacks

func MarshalSnapshotStackSnapshot

func MarshalSnapshotStackSnapshot(existingSnapshot *interfaces.SnapshotStack, snapshot *interfaces.SnapshotStack) (*gogotypes.Any, error)

MarshalSnapshotStackSnapshot takes an existing interfaces.SnapshotStack and an interfaces.SnapshotStack object and replaces the existing snapshot data with that contained in the second interfaces.SnapshotStack and marshals it into a protocol buffer Any message. The types.StackSpec is left unchanged Under the hood, this relies on marshaling the objects to JSON.

func MarshalSnapshotStackSpec

func MarshalSnapshotStackSpec(existingSnapshot *interfaces.SnapshotStack, stackSpec *types.StackSpec) (*gogotypes.Any, error)

MarshalSnapshotStackSpec takes a interfaces.SnapshotStack and a types.StackSpec object and replaces the types.StackSpec object contained in interfaces.SnapshotStack and marshals it into a protocol buffer Any. Under the hood, this relies on marshaling the objects to JSON.

func MarshalStackSpec

func MarshalStackSpec(stackSpec *types.StackSpec) (*gogotypes.Any, error)

MarshalStackSpec takes a types.StackSpec, wraps it in a SnapshotStack object and marshals it into a protocol buffer Any message. Under the hood, this relies on marshaling the objects to JSON.

func UnmarshalSnapshotStack

func UnmarshalSnapshotStack(payload *gogotypes.Any) (*interfaces.SnapshotStack, error)

UnmarshalSnapshotStack does the MarshalStackSpec operation in reverse -- takes a proto message, and returns the SnapshotStack contained in it.

func UnmarshalStackSpec

func UnmarshalStackSpec(payload *gogotypes.Any) (*types.StackSpec, error)

UnmarshalStackSpec does the MarshalStackSpec operation in reverse -- takes a proto message, and returns the StackSpec contained in it.

func UpdateSnapshotStack

func UpdateSnapshotStack(ctx context.Context, rc ResourcesClient, id string, snapshot interfaces.SnapshotStack, version uint64) (interfaces.SnapshotStack, error)

UpdateSnapshotStack updates a stack's specs.

func UpdateStack

func UpdateStack(ctx context.Context, rc ResourcesClient, id string, stackSpec types.StackSpec, version uint64) error

UpdateStack updates a stack's specs.

Types

type ResourcesClient

ResourcesClient is a subset of swarmkit's ControlClient interface for operating on Resources and Extensions

type StackStore

type StackStore struct {
	// contains filtered or unexported fields
}

StackStore is an implementation of the types.StackStore interface, which provides for the storage and retrieval of Stack objects from the swarmkit object store.

func New

func New(client ResourcesClient) *StackStore

New creates a new StackStore using the provided client.

func (*StackStore) AddStack

func (s *StackStore) AddStack(stackSpec types.StackSpec) (string, error)

AddStack creates a new Stack object in the swarmkit data store. It returns the ID of the new object if successful, or an error otherwise.

func (*StackStore) DeleteStack

func (s *StackStore) DeleteStack(id string) error

DeleteStack removes the stacks with the given ID.

func (*StackStore) GetSnapshotStack

func (s *StackStore) GetSnapshotStack(id string) (interfaces.SnapshotStack, error)

GetSnapshotStack retrieves and returns an exist types.Stack object by ID.

func (*StackStore) GetStack

func (s *StackStore) GetStack(id string) (types.Stack, error)

GetStack retrieves and returns an exist types.Stack object by ID.

func (*StackStore) ListStacks

func (s *StackStore) ListStacks() ([]types.Stack, error)

ListStacks lists all available stack objects

func (*StackStore) UpdateSnapshotStack

func (s *StackStore) UpdateSnapshotStack(id string, snapshotStack interfaces.SnapshotStack, version uint64) (interfaces.SnapshotStack, error)

UpdateSnapshotStack updates an existing SnapshotStack object

func (*StackStore) UpdateStack

func (s *StackStore) UpdateStack(id string, stackSpec types.StackSpec, version uint64) error

UpdateStack updates an existing Stack object

Jump to

Keyboard shortcuts

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