Move plugin type definitions to containerd plugins package
The plugins packages defines the plugins used by containerd. Move all the types and properties to this package. Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
@@ -24,8 +24,9 @@ import (
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/pkg/streaming"
|
||||
"github.com/containerd/containerd/pkg/transfer"
|
||||
"github.com/containerd/containerd/pkg/transfer/plugins"
|
||||
tplugins "github.com/containerd/containerd/pkg/transfer/plugins"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/plugins"
|
||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||
"github.com/containerd/log"
|
||||
"github.com/containerd/typeurl/v2"
|
||||
@@ -37,11 +38,11 @@ import (
|
||||
|
||||
func init() {
|
||||
plugin.Register(&plugin.Registration{
|
||||
Type: plugin.GRPCPlugin,
|
||||
Type: plugins.GRPCPlugin,
|
||||
ID: "transfer",
|
||||
Requires: []plugin.Type{
|
||||
plugin.TransferPlugin,
|
||||
plugin.StreamingPlugin,
|
||||
plugins.TransferPlugin,
|
||||
plugins.StreamingPlugin,
|
||||
},
|
||||
InitFn: newService,
|
||||
})
|
||||
@@ -54,21 +55,21 @@ type service struct {
|
||||
}
|
||||
|
||||
func newService(ic *plugin.InitContext) (interface{}, error) {
|
||||
plugins, err := ic.GetByType(plugin.TransferPlugin)
|
||||
sps, err := ic.GetByType(plugins.TransferPlugin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO: how to determine order?
|
||||
t := make([]transfer.Transferrer, 0, len(plugins))
|
||||
for _, p := range plugins {
|
||||
t := make([]transfer.Transferrer, 0, len(sps))
|
||||
for _, p := range sps {
|
||||
i, err := p.Instance()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
t = append(t, i.(transfer.Transferrer))
|
||||
}
|
||||
sp, err := ic.GetByID(plugin.StreamingPlugin, "manager")
|
||||
sp, err := ic.GetByID(plugins.StreamingPlugin, "manager")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -134,7 +135,7 @@ func (s *service) Transfer(ctx context.Context, req *transferapi.TransferRequest
|
||||
}
|
||||
|
||||
func (s *service) convertAny(ctx context.Context, a typeurl.Any) (interface{}, error) {
|
||||
obj, err := plugins.ResolveType(a)
|
||||
obj, err := tplugins.ResolveType(a)
|
||||
if err != nil {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return typeurl.UnmarshalAny(a)
|
||||
|
||||
Reference in New Issue
Block a user