
The primary feature we get with this PR is support for filters and labels on the image metadata store. In the process of doing this, the conventions for the API have been converged between containers and images, providing a model for other services. With images, `Put` (renamed to `Update` briefly) has been split into a `Create` and `Update`, allowing one to control the behavior around these operations. `Update` now includes support for masking fields at the datastore-level across both the containers and image service. Filters are now just string values to interpreted directly within the data store. This should allow for some interesting future use cases in which the datastore might use the syntax for more efficient query paths. The containers service has been updated to follow these conventions as closely as possible. Signed-off-by: Stephen J Day <stephen.day@docker.com>
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package containers
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/gogo/protobuf/types"
|
|
)
|
|
|
|
// Container represents the set of data pinned by a container. Unless otherwise
|
|
// noted, the resources here are considered in use by the container.
|
|
//
|
|
// The resources specified in this object are used to create tasks from the container.
|
|
type Container struct {
|
|
ID string
|
|
Labels map[string]string
|
|
Image string
|
|
Runtime RuntimeInfo
|
|
Spec *types.Any
|
|
RootFS string
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type RuntimeInfo struct {
|
|
Name string
|
|
Options *types.Any
|
|
}
|
|
|
|
type Store interface {
|
|
Get(ctx context.Context, id string) (Container, error)
|
|
|
|
// List returns containers that match one or more of the provided filters.
|
|
List(ctx context.Context, filters ...string) ([]Container, error)
|
|
|
|
Create(ctx context.Context, container Container) (Container, error)
|
|
|
|
// Update the container with the provided container object. ID must be set.
|
|
//
|
|
// If one or more fieldpaths are provided, only the field corresponding to
|
|
// the fieldpaths will be mutated.
|
|
Update(ctx context.Context, container Container, fieldpaths ...string) (Container, error)
|
|
|
|
Delete(ctx context.Context, id string) error
|
|
}
|