Fix exported comments enforcer in CI
Add comments where missing and fix incorrect comments Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
parent
031775ee5e
commit
35eeb24a17
@ -14,6 +14,10 @@ linters:
|
|||||||
disable:
|
disable:
|
||||||
- errcheck
|
- errcheck
|
||||||
|
|
||||||
|
issues:
|
||||||
|
include:
|
||||||
|
- EXC0002
|
||||||
|
|
||||||
run:
|
run:
|
||||||
timeout: 3m
|
timeout: 3m
|
||||||
skip-dirs:
|
skip-dirs:
|
||||||
|
@ -720,10 +720,12 @@ func (c *Client) Version(ctx context.Context) (Version, error) {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ServerInfo represents the introspected server information
|
||||||
type ServerInfo struct {
|
type ServerInfo struct {
|
||||||
UUID string
|
UUID string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Server returns server information from the introspection service
|
||||||
func (c *Client) Server(ctx context.Context) (ServerInfo, error) {
|
func (c *Client) Server(ctx context.Context) (ServerInfo, error) {
|
||||||
c.connMu.Lock()
|
c.connMu.Lock()
|
||||||
if c.conn == nil {
|
if c.conn == nil {
|
||||||
@ -789,6 +791,8 @@ func CheckRuntime(current, expected string) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetSnapshotterSupportedPlatforms returns a platform matchers which represents the
|
||||||
|
// supported platforms for the given snapshotters
|
||||||
func (c *Client) GetSnapshotterSupportedPlatforms(ctx context.Context, snapshotterName string) (platforms.MatchComparer, error) {
|
func (c *Client) GetSnapshotterSupportedPlatforms(ctx context.Context, snapshotterName string) (platforms.MatchComparer, error) {
|
||||||
filters := []string{fmt.Sprintf("type==%s, id==%s", plugin.SnapshotPlugin, snapshotterName)}
|
filters := []string{fmt.Sprintf("type==%s, id==%s", plugin.SnapshotPlugin, snapshotterName)}
|
||||||
in := c.IntrospectionService()
|
in := c.IntrospectionService()
|
||||||
|
@ -198,6 +198,8 @@ func Fetch(ctx context.Context, client *containerd.Client, ref string, config *F
|
|||||||
return img, nil
|
return img, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ShowProgress continuously updates the output with job progress
|
||||||
|
// by checking status in the content store.
|
||||||
func ShowProgress(ctx context.Context, ongoing *Jobs, cs content.Store, out io.Writer) {
|
func ShowProgress(ctx context.Context, ongoing *Jobs, cs content.Store, out io.Writer) {
|
||||||
var (
|
var (
|
||||||
ticker = time.NewTicker(100 * time.Millisecond)
|
ticker = time.NewTicker(100 * time.Millisecond)
|
||||||
@ -328,6 +330,7 @@ type Jobs struct {
|
|||||||
resolved bool
|
resolved bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewJobs creates a new instance of the job status tracker
|
||||||
func NewJobs(name string) *Jobs {
|
func NewJobs(name string) *Jobs {
|
||||||
return &Jobs{
|
return &Jobs{
|
||||||
name: name,
|
name: name,
|
||||||
@ -335,6 +338,7 @@ func NewJobs(name string) *Jobs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add adds a descriptor to be tracked
|
||||||
func (j *Jobs) Add(desc ocispec.Descriptor) {
|
func (j *Jobs) Add(desc ocispec.Descriptor) {
|
||||||
j.mu.Lock()
|
j.mu.Lock()
|
||||||
defer j.mu.Unlock()
|
defer j.mu.Unlock()
|
||||||
@ -347,6 +351,7 @@ func (j *Jobs) Add(desc ocispec.Descriptor) {
|
|||||||
j.added[desc.Digest] = struct{}{}
|
j.added[desc.Digest] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Jobs returns a list of all tracked descriptors
|
||||||
func (j *Jobs) Jobs() []ocispec.Descriptor {
|
func (j *Jobs) Jobs() []ocispec.Descriptor {
|
||||||
j.mu.Lock()
|
j.mu.Lock()
|
||||||
defer j.mu.Unlock()
|
defer j.mu.Unlock()
|
||||||
@ -355,6 +360,7 @@ func (j *Jobs) Jobs() []ocispec.Descriptor {
|
|||||||
return append(descs, j.descs...)
|
return append(descs, j.descs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsResolved checks whether a descriptor has been resolved
|
||||||
func (j *Jobs) IsResolved() bool {
|
func (j *Jobs) IsResolved() bool {
|
||||||
j.mu.Lock()
|
j.mu.Lock()
|
||||||
defer j.mu.Unlock()
|
defer j.mu.Unlock()
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
"github.com/containerd/containerd/oci"
|
"github.com/containerd/containerd/oci"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Command is the parent for all OCI related tools under 'oci'
|
||||||
var Command = cli.Command{
|
var Command = cli.Command{
|
||||||
Name: "oci",
|
Name: "oci",
|
||||||
Usage: "OCI tools",
|
Usage: "OCI tools",
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/containerd/containerd/filters"
|
"github.com/containerd/containerd/filters"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AdoptInfo returns `filters.Adaptor` that handles `content.Info`.
|
// AdaptInfo returns `filters.Adaptor` that handles `content.Info`.
|
||||||
func AdaptInfo(info Info) filters.Adaptor {
|
func AdaptInfo(info Info) filters.Adaptor {
|
||||||
return filters.AdapterFunc(func(fieldpath []string) (string, bool) {
|
return filters.AdapterFunc(func(fieldpath []string) (string, bool) {
|
||||||
if len(fieldpath) == 0 {
|
if len(fieldpath) == 0 {
|
||||||
|
@ -81,7 +81,7 @@ func LoadDefaultProfile(name string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DumpDefaultProfiles dumps the default profile with the given name.
|
// DumpDefaultProfile dumps the default profile with the given name.
|
||||||
func DumpDefaultProfile(name string) (string, error) {
|
func DumpDefaultProfile(name string) (string, error) {
|
||||||
p, err := loadData(name)
|
p, err := loadData(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -168,6 +168,10 @@ func (c *compressedProcessor) Close() error {
|
|||||||
return c.rc.Close()
|
return c.rc.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BinaryHandler creates a new stream processor handler which calls out to the given binary.
|
||||||
|
// The id is used to identify the stream processor and allows the caller to send
|
||||||
|
// payloads specific for that stream processor (i.e. decryption keys for decrypt stream processor).
|
||||||
|
// The binary will be called for the provided mediaTypes and return the given media type.
|
||||||
func BinaryHandler(id, returnsMediaType string, mediaTypes []string, path string, args, env []string) Handler {
|
func BinaryHandler(id, returnsMediaType string, mediaTypes []string, path string, args, env []string) Handler {
|
||||||
set := make(map[string]struct{}, len(mediaTypes))
|
set := make(map[string]struct{}, len(mediaTypes))
|
||||||
for _, m := range mediaTypes {
|
for _, m := range mediaTypes {
|
||||||
|
@ -348,6 +348,7 @@ func clearDockerV1DummyID(cfg DualConfig) (bool, error) {
|
|||||||
return modified, nil
|
return modified, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ObjectWithMediaType represents an object with a MediaType field
|
||||||
type ObjectWithMediaType struct {
|
type ObjectWithMediaType struct {
|
||||||
// MediaType appears on Docker manifests and manifest lists.
|
// MediaType appears on Docker manifests and manifest lists.
|
||||||
// MediaType does not appear on OCI manifests and index
|
// MediaType does not appear on OCI manifests and index
|
||||||
|
@ -91,6 +91,8 @@ func LayerConvertFunc(ctx context.Context, cs content.Store, desc ocispec.Descri
|
|||||||
return &newDesc, nil
|
return &newDesc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsUncompressedType returns whether the provided media type is considered
|
||||||
|
// an uncompressed layer type
|
||||||
func IsUncompressedType(mt string) bool {
|
func IsUncompressedType(mt string) bool {
|
||||||
switch mt {
|
switch mt {
|
||||||
case
|
case
|
||||||
|
@ -551,6 +551,7 @@ func (r *RuntimeService) ContainerStats(containerID string) (*runtimeapi.Contain
|
|||||||
return resp.GetStats(), nil
|
return resp.GetStats(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListContainerStats lists all container stats given the provided filter
|
||||||
func (r *RuntimeService) ListContainerStats(filter *runtimeapi.ContainerStatsFilter) ([]*runtimeapi.ContainerStats, error) {
|
func (r *RuntimeService) ListContainerStats(filter *runtimeapi.ContainerStatsFilter) ([]*runtimeapi.ContainerStats, error) {
|
||||||
klog.V(10).Infof("[RuntimeService] ListContainerStats (filter=%v)", filter)
|
klog.V(10).Infof("[RuntimeService] ListContainerStats (filter=%v)", filter)
|
||||||
// Do not set timeout, because writable layer stats collection takes time.
|
// Do not set timeout, because writable layer stats collection takes time.
|
||||||
@ -570,6 +571,7 @@ func (r *RuntimeService) ListContainerStats(filter *runtimeapi.ContainerStatsFil
|
|||||||
return resp.GetStats(), nil
|
return resp.GetStats(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReopenContainerLog reopens the container log for the given container ID
|
||||||
func (r *RuntimeService) ReopenContainerLog(containerID string) error {
|
func (r *RuntimeService) ReopenContainerLog(containerID string) error {
|
||||||
klog.V(10).Infof("[RuntimeService] ReopenContainerLog (containerID=%v, timeout=%v)", containerID, r.timeout)
|
klog.V(10).Infof("[RuntimeService] ReopenContainerLog (containerID=%v, timeout=%v)", containerID, r.timeout)
|
||||||
ctx, cancel := getContextWithTimeout(r.timeout)
|
ctx, cancel := getContextWithTimeout(r.timeout)
|
||||||
|
@ -186,7 +186,7 @@ func removeLoop(loopdev string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach a specified backing file to a loop device
|
// AttachLoopDevice attaches a specified backing file to a loop device
|
||||||
func AttachLoopDevice(backingFile string) (string, error) {
|
func AttachLoopDevice(backingFile string) (string, error) {
|
||||||
file, err := setupLoop(backingFile, LoopParams{})
|
file, err := setupLoop(backingFile, LoopParams{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -196,7 +196,7 @@ func AttachLoopDevice(backingFile string) (string, error) {
|
|||||||
return file.Name(), nil
|
return file.Name(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detach a loop device
|
// DetachLoopDevice detaches the provided loop devices
|
||||||
func DetachLoopDevice(devices ...string) error {
|
func DetachLoopDevice(devices ...string) error {
|
||||||
for _, dev := range devices {
|
for _, dev := range devices {
|
||||||
if err := removeLoop(dev); err != nil {
|
if err := removeLoop(dev); err != nil {
|
||||||
|
@ -1172,8 +1172,6 @@ func WithLinuxDevices(devices []specs.LinuxDevice) SpecOpts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var ErrNotADevice = errors.New("not a device node")
|
|
||||||
|
|
||||||
// WithLinuxDevice adds the device specified by path to the spec
|
// WithLinuxDevice adds the device specified by path to the spec
|
||||||
func WithLinuxDevice(path, permissions string) SpecOpts {
|
func WithLinuxDevice(path, permissions string) SpecOpts {
|
||||||
return func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error {
|
return func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error {
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
"github.com/containerd/containerd/containers"
|
"github.com/containerd/containerd/containers"
|
||||||
"github.com/containerd/containerd/pkg/cap"
|
"github.com/containerd/containerd/pkg/cap"
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -42,6 +43,8 @@ func WithHostDevices(_ context.Context, _ Client, _ *containers.Container, s *Sp
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var errNotADevice = errors.New("not a device node")
|
||||||
|
|
||||||
func getDevices(path string) ([]specs.LinuxDevice, error) {
|
func getDevices(path string) ([]specs.LinuxDevice, error) {
|
||||||
files, err := ioutil.ReadDir(path)
|
files, err := ioutil.ReadDir(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -70,7 +73,7 @@ func getDevices(path string) ([]specs.LinuxDevice, error) {
|
|||||||
}
|
}
|
||||||
device, err := deviceFromPath(filepath.Join(path, f.Name()), "rwm")
|
device, err := deviceFromPath(filepath.Join(path, f.Name()), "rwm")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == ErrNotADevice {
|
if err == errNotADevice {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
@ -96,7 +99,7 @@ func deviceFromPath(path, permissions string) (*specs.LinuxDevice, error) {
|
|||||||
minor = unix.Minor(devNumber)
|
minor = unix.Minor(devNumber)
|
||||||
)
|
)
|
||||||
if major == 0 {
|
if major == 0 {
|
||||||
return nil, ErrNotADevice
|
return nil, errNotADevice
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/containers"
|
"github.com/containerd/containerd/containers"
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -41,6 +42,8 @@ func WithHostDevices(_ context.Context, _ Client, _ *containers.Container, s *Sp
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var errNotADevice = errors.New("not a device node")
|
||||||
|
|
||||||
func getDevices(path string) ([]specs.LinuxDevice, error) {
|
func getDevices(path string) ([]specs.LinuxDevice, error) {
|
||||||
files, err := ioutil.ReadDir(path)
|
files, err := ioutil.ReadDir(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -69,7 +72,7 @@ func getDevices(path string) ([]specs.LinuxDevice, error) {
|
|||||||
}
|
}
|
||||||
device, err := deviceFromPath(filepath.Join(path, f.Name()), "rwm")
|
device, err := deviceFromPath(filepath.Join(path, f.Name()), "rwm")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == ErrNotADevice {
|
if err == errNotADevice {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
@ -94,7 +97,7 @@ func deviceFromPath(path, permissions string) (*specs.LinuxDevice, error) {
|
|||||||
minor = unix.Minor(devNumber)
|
minor = unix.Minor(devNumber)
|
||||||
)
|
)
|
||||||
if major == 0 {
|
if major == 0 {
|
||||||
return nil, ErrNotADevice
|
return nil, errNotADevice
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -65,7 +65,7 @@ type Type int
|
|||||||
const (
|
const (
|
||||||
// Effective is CapEff
|
// Effective is CapEff
|
||||||
Effective Type = 1 << iota
|
Effective Type = 1 << iota
|
||||||
// Effective is CapPrm
|
// Permitted is CapPrm
|
||||||
Permitted
|
Permitted
|
||||||
// Inheritable is CapInh
|
// Inheritable is CapInh
|
||||||
Inheritable
|
Inheritable
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
"github.com/opencontainers/selinux/go-selinux"
|
"github.com/opencontainers/selinux/go-selinux"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Store is used to store SELinux process labels
|
||||||
type Store struct {
|
type Store struct {
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
levels map[string]int
|
levels map[string]int
|
||||||
@ -29,6 +30,7 @@ type Store struct {
|
|||||||
Reserver func(string)
|
Reserver func(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewStore creates a new SELinux process label store
|
||||||
func NewStore() *Store {
|
func NewStore() *Store {
|
||||||
return &Store{
|
return &Store{
|
||||||
levels: map[string]int{},
|
levels: map[string]int{},
|
||||||
@ -37,6 +39,8 @@ func NewStore() *Store {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reserve reserves the MLS/MCS level component of the specified label
|
||||||
|
// and prevents multiple reserves for the same level
|
||||||
func (s *Store) Reserve(label string) error {
|
func (s *Store) Reserve(label string) error {
|
||||||
s.Lock()
|
s.Lock()
|
||||||
defer s.Unlock()
|
defer s.Unlock()
|
||||||
@ -60,6 +64,9 @@ func (s *Store) Reserve(label string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Release un-reserves the MLS/MCS level component of the specified label,
|
||||||
|
// allowing it to be used by another process once labels with the same
|
||||||
|
// level have been released.
|
||||||
func (s *Store) Release(label string) {
|
func (s *Store) Release(label string) {
|
||||||
s.Lock()
|
s.Lock()
|
||||||
defer s.Unlock()
|
defer s.Unlock()
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// config package containers utilities for helping configure the Docker resolver
|
// Package config contains utilities for helping configure the Docker resolver
|
||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -56,6 +56,7 @@ const (
|
|||||||
// Reserved for future capabilities (i.e. search, catalog, remove)
|
// Reserved for future capabilities (i.e. search, catalog, remove)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Has checks whether the capabilities list has the provide capability
|
||||||
func (c HostCapabilities) Has(t HostCapabilities) bool {
|
func (c HostCapabilities) Has(t HostCapabilities) bool {
|
||||||
return c&t == t
|
return c&t == t
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ type item struct {
|
|||||||
count int
|
count int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewPublisher creates a new remote events publisher
|
||||||
func NewPublisher(address string) (*RemoteEventsPublisher, error) {
|
func NewPublisher(address string) (*RemoteEventsPublisher, error) {
|
||||||
client, err := ttrpcutil.NewClient(address)
|
client, err := ttrpcutil.NewClient(address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -57,6 +58,7 @@ func NewPublisher(address string) (*RemoteEventsPublisher, error) {
|
|||||||
return l, nil
|
return l, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RemoteEventsPublisher forwards events to a ttrpc server
|
||||||
type RemoteEventsPublisher struct {
|
type RemoteEventsPublisher struct {
|
||||||
client *ttrpcutil.Client
|
client *ttrpcutil.Client
|
||||||
closed chan struct{}
|
closed chan struct{}
|
||||||
@ -64,10 +66,12 @@ type RemoteEventsPublisher struct {
|
|||||||
requeue chan *item
|
requeue chan *item
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Done returns a channel which closes when done
|
||||||
func (l *RemoteEventsPublisher) Done() <-chan struct{} {
|
func (l *RemoteEventsPublisher) Done() <-chan struct{} {
|
||||||
return l.closed
|
return l.closed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close closes the remote connection and closes the done channel
|
||||||
func (l *RemoteEventsPublisher) Close() (err error) {
|
func (l *RemoteEventsPublisher) Close() (err error) {
|
||||||
err = l.client.Close()
|
err = l.client.Close()
|
||||||
l.closer.Do(func() {
|
l.closer.Do(func() {
|
||||||
@ -100,6 +104,7 @@ func (l *RemoteEventsPublisher) queue(i *item) {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Publish publishes the event by forwarding it to the configured ttrpc server
|
||||||
func (l *RemoteEventsPublisher) Publish(ctx context.Context, topic string, event events.Event) error {
|
func (l *RemoteEventsPublisher) Publish(ctx context.Context, topic string, event events.Event) error {
|
||||||
ns, err := namespaces.NamespaceRequired(ctx)
|
ns, err := namespaces.NamespaceRequired(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -87,6 +87,7 @@ func AnonDialer(address string, timeout time.Duration) (net.Conn, error) {
|
|||||||
return dialer.Dialer(socket(address).path(), timeout)
|
return dialer.Dialer(socket(address).path(), timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AnonReconnectDialer returns a dialer for an existing socket on reconnection
|
||||||
func AnonReconnectDialer(address string, timeout time.Duration) (net.Conn, error) {
|
func AnonReconnectDialer(address string, timeout time.Duration) (net.Conn, error) {
|
||||||
return AnonDialer(address, timeout)
|
return AnonDialer(address, timeout)
|
||||||
}
|
}
|
||||||
|
@ -34,4 +34,4 @@ GO111MODULE=off go get -d github.com/gogo/googleapis || true
|
|||||||
GO111MODULE=off go get -d github.com/gogo/protobuf || true
|
GO111MODULE=off go get -d github.com/gogo/protobuf || true
|
||||||
|
|
||||||
GO111MODULE=on go get github.com/cpuguy83/go-md2man/v2@v2.0.0
|
GO111MODULE=on go get github.com/cpuguy83/go-md2man/v2@v2.0.0
|
||||||
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.23.8
|
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.38.0
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
ptypes "github.com/gogo/protobuf/types"
|
ptypes "github.com/gogo/protobuf/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Service defines the instrospection service interface
|
||||||
type Service interface {
|
type Service interface {
|
||||||
Plugins(context.Context, []string) (*api.PluginsResponse, error)
|
Plugins(context.Context, []string) (*api.PluginsResponse, error)
|
||||||
Server(context.Context, *ptypes.Empty) (*api.ServerResponse, error)
|
Server(context.Context, *ptypes.Empty) (*api.ServerResponse, error)
|
||||||
@ -36,6 +37,7 @@ type introspectionRemote struct {
|
|||||||
|
|
||||||
var _ = (Service)(&introspectionRemote{})
|
var _ = (Service)(&introspectionRemote{})
|
||||||
|
|
||||||
|
// NewIntrospectionServiceFromClient creates a new introspection service from an API client
|
||||||
func NewIntrospectionServiceFromClient(c api.IntrospectionClient) Service {
|
func NewIntrospectionServiceFromClient(c api.IntrospectionClient) Service {
|
||||||
return &introspectionRemote{client: c}
|
return &introspectionRemote{client: c}
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ func init() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Local is a local implementation of the introspection service
|
||||||
type Local struct {
|
type Local struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
plugins []api.Plugin
|
plugins []api.Plugin
|
||||||
@ -62,6 +63,7 @@ type Local struct {
|
|||||||
|
|
||||||
var _ = (api.IntrospectionClient)(&Local{})
|
var _ = (api.IntrospectionClient)(&Local{})
|
||||||
|
|
||||||
|
// UpdateLocal updates the local introspection service
|
||||||
func (l *Local) UpdateLocal(root string, plugins []api.Plugin) {
|
func (l *Local) UpdateLocal(root string, plugins []api.Plugin) {
|
||||||
l.mu.Lock()
|
l.mu.Lock()
|
||||||
defer l.mu.Unlock()
|
defer l.mu.Unlock()
|
||||||
@ -69,6 +71,7 @@ func (l *Local) UpdateLocal(root string, plugins []api.Plugin) {
|
|||||||
l.plugins = plugins
|
l.plugins = plugins
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Plugins returns the locally defined plugins
|
||||||
func (l *Local) Plugins(ctx context.Context, req *api.PluginsRequest, _ ...grpc.CallOption) (*api.PluginsResponse, error) {
|
func (l *Local) Plugins(ctx context.Context, req *api.PluginsRequest, _ ...grpc.CallOption) (*api.PluginsResponse, error) {
|
||||||
filter, err := filters.ParseAll(req.Filters...)
|
filter, err := filters.ParseAll(req.Filters...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -96,6 +99,7 @@ func (l *Local) getPlugins() []api.Plugin {
|
|||||||
return l.plugins
|
return l.plugins
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Server returns the local server information
|
||||||
func (l *Local) Server(ctx context.Context, _ *ptypes.Empty, _ ...grpc.CallOption) (*api.ServerResponse, error) {
|
func (l *Local) Server(ctx context.Context, _ *ptypes.Empty, _ ...grpc.CallOption) (*api.ServerResponse, error) {
|
||||||
u, err := l.getUUID()
|
u, err := l.getUUID()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -395,6 +395,7 @@ func (p *PoolDevice) SuspendDevice(ctx context.Context, deviceName string) error
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ResumeDevice resumes IO for the given device
|
||||||
func (p *PoolDevice) ResumeDevice(ctx context.Context, deviceName string) error {
|
func (p *PoolDevice) ResumeDevice(ctx context.Context, deviceName string) error {
|
||||||
if err := p.transition(ctx, deviceName, Resuming, Resumed, func() error {
|
if err := p.transition(ctx, deviceName, Resuming, Resumed, func() error {
|
||||||
return dmsetup.ResumeDevice(deviceName)
|
return dmsetup.ResumeDevice(deviceName)
|
||||||
|
@ -482,6 +482,7 @@ func (s *Snapshotter) withTransaction(ctx context.Context, writable bool, fn fun
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cleanup cleans up all removed and unused resources
|
||||||
func (s *Snapshotter) Cleanup(ctx context.Context) error {
|
func (s *Snapshotter) Cleanup(ctx context.Context) error {
|
||||||
var removedDevices []*DeviceInfo
|
var removedDevices []*DeviceInfo
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@ import (
|
|||||||
const (
|
const (
|
||||||
// UnpackKeyPrefix is the beginning of the key format used for snapshots that will have
|
// UnpackKeyPrefix is the beginning of the key format used for snapshots that will have
|
||||||
// image content unpacked into them.
|
// image content unpacked into them.
|
||||||
UnpackKeyPrefix = "extract"
|
UnpackKeyPrefix = "extract"
|
||||||
|
// UnpackKeyFormat is the format for the snapshotter keys used for extraction
|
||||||
UnpackKeyFormat = UnpackKeyPrefix + "-%s %s"
|
UnpackKeyFormat = UnpackKeyPrefix + "-%s %s"
|
||||||
inheritedLabelsPrefix = "containerd.io/snapshot/"
|
inheritedLabelsPrefix = "containerd.io/snapshot/"
|
||||||
labelSnapshotRef = "containerd.io/snapshot.ref"
|
labelSnapshotRef = "containerd.io/snapshot.ref"
|
||||||
|
Loading…
Reference in New Issue
Block a user