metadata

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerToStoreUpdateFunc

func ContainerToStoreUpdateFunc(u ContainerUpdateFunc) store.UpdateFunc

ContainerToStoreUpdateFunc generates a metadata store UpdateFunc from ContainerUpdateFunc.

func IsNotExistError

func IsNotExistError(err error) bool

IsNotExistError is a helper function to check whether the error returned by metadata store is not exist error.

Types

type ContainerMetadata

type ContainerMetadata struct {
	// ID is the container id.
	ID string
	// Name is the container name.
	Name string
	// SandboxID is the sandbox id the container belongs to.
	SandboxID string
	// Config is the CRI container config.
	Config *runtime.ContainerConfig
	// ImageRef is the reference of image used by the container.
	ImageRef string
	// Pid is the init process id of the container.
	Pid uint32
	// CreatedAt is the created timestamp.
	CreatedAt int64
	// StartedAt is the started timestamp.
	StartedAt int64
	// FinishedAt is the finished timestamp.
	FinishedAt int64
	// ExitCode is the container exit code.
	ExitCode int32
	// CamelCase string explaining why container is in its current state.
	Reason string
	// Human-readable message indicating details about why container is in its
	// current state.
	Message string
	// Removing indicates that the container is in removing state.
	// In fact, this field doesn't need to be checkpointed.
	// TODO(random-liu): Skip this during serialization when we put object
	// into the store directly.
	// TODO(random-liu): Reset this field to false during state recovery.
	Removing bool
	// TODO(random-liu): Remove following field after switching to new containerd
	// client.
	// Not including them in unit test now because they will be removed soon.
	// Spec is the oci runtime spec used to run the container.
	Spec *runtimespec.Spec
}

ContainerMetadata is the unversioned container metadata.

func (*ContainerMetadata) State

State returns current state of the container based on the metadata.

type ContainerStore

type ContainerStore interface {
	// Create creates a container from ContainerMetadata in the store.
	Create(ContainerMetadata) error
	// Get gets a specified container.
	Get(string) (*ContainerMetadata, error)
	// Update updates a specified container.
	Update(string, ContainerUpdateFunc) error
	// List lists all containers.
	List() ([]*ContainerMetadata, error)
	// Delete deletes the container from the store.
	Delete(string) error
}

ContainerStore is the store for metadata of all containers.

func NewContainerStore

func NewContainerStore(store store.MetadataStore) ContainerStore

NewContainerStore creates a ContainerStore from a basic MetadataStore.

type ContainerUpdateFunc

type ContainerUpdateFunc func(ContainerMetadata) (ContainerMetadata, error)

ContainerUpdateFunc is the function used to update ContainerMetadata.

type ImageMetadata

type ImageMetadata struct {
	// Id of the image. Normally the digest of image config.
	ID string `json:"id,omitempty"`
	// ChainID is the chainID of the image.
	ChainID string `json:"chain_id,omitempty"`
	// Other names by which this image is known.
	RepoTags []string `json:"repo_tags,omitempty"`
	// Digests by which this image is known.
	RepoDigests []string `json:"repo_digests,omitempty"`
	// Size is the compressed size of the image.
	Size int64 `json:"size,omitempty"`
	// Config is the oci image config of the image.
	Config *imagespec.ImageConfig `json:"config,omitempty"`
}

ImageMetadata is the unversioned image metadata.

type ImageMetadataStore

type ImageMetadataStore interface {
	// Create creates an image's metadata from ImageMetadata in the store.
	Create(ImageMetadata) error
	// Get gets the specified image metadata.
	Get(string) (*ImageMetadata, error)
	// Update updates a specified image metatdata.
	Update(string, ImageMetadataUpdateFunc) error
	// List lists all image metadatas.
	List() ([]*ImageMetadata, error)
	// Delete deletes the image's metatdata from the store.
	Delete(string) error
}

ImageMetadataStore is the store for metadata of all images.

func NewImageMetadataStore

func NewImageMetadataStore(store store.MetadataStore) ImageMetadataStore

NewImageMetadataStore creates an ImageMetadataStore from a basic MetadataStore.

type ImageMetadataUpdateFunc

type ImageMetadataUpdateFunc func(ImageMetadata) (ImageMetadata, error)

ImageMetadataUpdateFunc is the function used to update ImageMetadata.

type SandboxMetadata

type SandboxMetadata struct {
	// ID is the sandbox id.
	ID string
	// Name is the sandbox name.
	Name string
	// Config is the CRI sandbox config.
	Config *runtime.PodSandboxConfig
	// CreatedAt is the created timestamp.
	CreatedAt int64
	// NetNS is the network namespace used by the sandbox.
	NetNS string
	// Pid is the process id of the sandbox.
	Pid uint32
}

SandboxMetadata is the unversioned sandbox metadata.

type SandboxStore

type SandboxStore interface {
	// Create creates a sandbox from SandboxMetadata in the store.
	Create(SandboxMetadata) error
	// Get gets the specified sandbox.
	Get(string) (*SandboxMetadata, error)
	// Update updates a specified sandbox.
	Update(string, SandboxUpdateFunc) error
	// List lists all sandboxes.
	List() ([]*SandboxMetadata, error)
	// Delete deletes the sandbox from the store.
	Delete(string) error
}

SandboxStore is the store for metadata of all sandboxes.

func NewSandboxStore

func NewSandboxStore(store store.MetadataStore) SandboxStore

NewSandboxStore creates a SandboxStore from a basic MetadataStore.

type SandboxUpdateFunc

type SandboxUpdateFunc func(SandboxMetadata) (SandboxMetadata, error)

SandboxUpdateFunc is the function used to update SandboxMetadata.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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