Documentation ¶
Index ¶
- Constants
- func AddStack(ctx context.Context, rc ResourcesClient, stackSpec types.StackSpec) (string, error)
- func ConstructSnapshotStack(resource *api.Resource) (*interfaces.SnapshotStack, error)
- func ConstructStack(resource *api.Resource) (*types.Stack, error)
- func DeleteStack(ctx context.Context, rc ResourcesClient, id string) error
- func GetSnapshotStack(ctx context.Context, rc ResourcesClient, id string) (interfaces.SnapshotStack, error)
- func GetStack(ctx context.Context, rc ResourcesClient, id string) (types.Stack, error)
- func InitExtension(ctx context.Context, rc ResourcesClient) error
- func ListStacks(ctx context.Context, rc ResourcesClient) ([]types.Stack, error)
- func MarshalSnapshotStackSnapshot(existingSnapshot *interfaces.SnapshotStack, snapshot *interfaces.SnapshotStack) (*gogotypes.Any, error)
- func MarshalSnapshotStackSpec(existingSnapshot *interfaces.SnapshotStack, stackSpec *types.StackSpec) (*gogotypes.Any, error)
- func MarshalStackSpec(stackSpec *types.StackSpec) (*gogotypes.Any, error)
- func UnmarshalSnapshotStack(payload *gogotypes.Any) (*interfaces.SnapshotStack, error)
- func UnmarshalStackSpec(payload *gogotypes.Any) (*types.StackSpec, error)
- func UpdateSnapshotStack(ctx context.Context, rc ResourcesClient, id string, ...) (interfaces.SnapshotStack, error)
- func UpdateStack(ctx context.Context, rc ResourcesClient, id string, stackSpec types.StackSpec, ...) error
- type ResourcesClient
- type StackStore
- func (s *StackStore) AddStack(stackSpec types.StackSpec) (string, error)
- func (s *StackStore) DeleteStack(id string) error
- func (s *StackStore) GetSnapshotStack(id string) (interfaces.SnapshotStack, error)
- func (s *StackStore) GetStack(id string) (types.Stack, error)
- func (s *StackStore) ListStacks() ([]types.Stack, error)
- func (s *StackStore) UpdateSnapshotStack(id string, snapshotStack interfaces.SnapshotStack, version uint64) (interfaces.SnapshotStack, error)
- func (s *StackStore) UpdateStack(id string, stackSpec types.StackSpec, version uint64) error
Constants ¶
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 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 ¶
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 InitExtension ¶
func InitExtension(ctx context.Context, rc ResourcesClient) error
InitExtension initializes the stack resource extension object
func ListStacks ¶
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 ¶
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 ¶
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 ¶
type ResourcesClient interface { CreateExtension(ctx context.Context, in *swarmapi.CreateExtensionRequest, opts ...grpc.CallOption) (*swarmapi.CreateExtensionResponse, error) GetResource(ctx context.Context, in *swarmapi.GetResourceRequest, opts ...grpc.CallOption) (*swarmapi.GetResourceResponse, error) UpdateResource(ctx context.Context, in *swarmapi.UpdateResourceRequest, opts ...grpc.CallOption) (*swarmapi.UpdateResourceResponse, error) ListResources(ctx context.Context, in *swarmapi.ListResourcesRequest, opts ...grpc.CallOption) (*swarmapi.ListResourcesResponse, error) CreateResource(ctx context.Context, in *swarmapi.CreateResourceRequest, opts ...grpc.CallOption) (*swarmapi.CreateResourceResponse, error) RemoveResource(ctx context.Context, in *swarmapi.RemoveResourceRequest, opts ...grpc.CallOption) (*swarmapi.RemoveResourceResponse, error) }
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 ¶
UpdateStack updates an existing Stack object