client: move snapshot client to containerd package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
This commit is contained in:
parent
fc149f0ef9
commit
5b64f7030d
@ -37,7 +37,6 @@ import (
|
|||||||
diffservice "github.com/containerd/containerd/services/diff"
|
diffservice "github.com/containerd/containerd/services/diff"
|
||||||
imagesservice "github.com/containerd/containerd/services/images"
|
imagesservice "github.com/containerd/containerd/services/images"
|
||||||
namespacesservice "github.com/containerd/containerd/services/namespaces"
|
namespacesservice "github.com/containerd/containerd/services/namespaces"
|
||||||
snapshotservice "github.com/containerd/containerd/services/snapshot"
|
|
||||||
"github.com/containerd/containerd/snapshot"
|
"github.com/containerd/containerd/snapshot"
|
||||||
"github.com/containerd/typeurl"
|
"github.com/containerd/typeurl"
|
||||||
ptypes "github.com/gogo/protobuf/types"
|
ptypes "github.com/gogo/protobuf/types"
|
||||||
@ -441,7 +440,7 @@ func (c *Client) ContentStore() content.Store {
|
|||||||
|
|
||||||
// SnapshotService returns the underlying snapshotter for the provided snapshotter name
|
// SnapshotService returns the underlying snapshotter for the provided snapshotter name
|
||||||
func (c *Client) SnapshotService(snapshotterName string) snapshot.Snapshotter {
|
func (c *Client) SnapshotService(snapshotterName string) snapshot.Snapshotter {
|
||||||
return snapshotservice.NewSnapshotterFromClient(snapshotapi.NewSnapshotsClient(c.conn), snapshotterName)
|
return NewSnapshotterFromClient(snapshotapi.NewSnapshotsClient(c.conn), snapshotterName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TaskService returns the underlying TasksClient
|
// TaskService returns the underlying TasksClient
|
||||||
|
@ -293,3 +293,24 @@ func fromMounts(mounts []mount.Mount) []*types.Mount {
|
|||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func toInfo(info snapshotapi.Info) snapshot.Info {
|
||||||
|
return snapshot.Info{
|
||||||
|
Name: info.Name,
|
||||||
|
Parent: info.Parent,
|
||||||
|
Kind: toKind(info.Kind),
|
||||||
|
Created: info.CreatedAt,
|
||||||
|
Updated: info.UpdatedAt,
|
||||||
|
Labels: info.Labels,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func toKind(kind snapshotapi.Kind) snapshot.Kind {
|
||||||
|
if kind == snapshotapi.KindActive {
|
||||||
|
return snapshot.KindActive
|
||||||
|
}
|
||||||
|
if kind == snapshotapi.KindView {
|
||||||
|
return snapshot.KindView
|
||||||
|
}
|
||||||
|
return snapshot.KindCommitted
|
||||||
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package snapshot
|
package containerd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@ -206,3 +206,24 @@ func toMounts(mm []*types.Mount) []mount.Mount {
|
|||||||
}
|
}
|
||||||
return mounts
|
return mounts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func fromKind(kind snapshot.Kind) snapshotapi.Kind {
|
||||||
|
if kind == snapshot.KindActive {
|
||||||
|
return snapshotapi.KindActive
|
||||||
|
}
|
||||||
|
if kind == snapshot.KindView {
|
||||||
|
return snapshotapi.KindView
|
||||||
|
}
|
||||||
|
return snapshotapi.KindCommitted
|
||||||
|
}
|
||||||
|
|
||||||
|
func fromInfo(info snapshot.Info) snapshotapi.Info {
|
||||||
|
return snapshotapi.Info{
|
||||||
|
Name: info.Name,
|
||||||
|
Parent: info.Parent,
|
||||||
|
Kind: fromKind(info.Kind),
|
||||||
|
CreatedAt: info.Created,
|
||||||
|
UpdatedAt: info.Updated,
|
||||||
|
Labels: info.Labels,
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user