github.com/rawahars/moby@v24.0.4+incompatible/pkg/plugingetter/getter.go (about)

     1  package plugingetter // import "github.com/docker/docker/pkg/plugingetter"
     2  
     3  import (
     4  	"net"
     5  	"time"
     6  
     7  	"github.com/docker/docker/pkg/plugins"
     8  )
     9  
    10  const (
    11  	// Lookup doesn't update RefCount
    12  	Lookup = 0
    13  	// Acquire increments RefCount
    14  	Acquire = 1
    15  	// Release decrements RefCount
    16  	Release = -1
    17  )
    18  
    19  // CompatPlugin is an abstraction to handle both v2(new) and v1(legacy) plugins.
    20  type CompatPlugin interface {
    21  	Name() string
    22  	ScopedPath(string) string
    23  	IsV1() bool
    24  	PluginWithV1Client
    25  }
    26  
    27  // PluginWithV1Client is a plugin that directly utilizes the v1/http plugin client
    28  type PluginWithV1Client interface {
    29  	Client() *plugins.Client
    30  }
    31  
    32  // PluginAddr is a plugin that exposes the socket address for creating custom clients rather than the built-in `*plugins.Client`
    33  type PluginAddr interface {
    34  	Addr() net.Addr
    35  	Timeout() time.Duration
    36  	Protocol() string
    37  }
    38  
    39  // CountedPlugin is a plugin which is reference counted.
    40  type CountedPlugin interface {
    41  	Acquire()
    42  	Release()
    43  	CompatPlugin
    44  }
    45  
    46  // PluginGetter is the interface implemented by Store
    47  type PluginGetter interface {
    48  	Get(name, capability string, mode int) (CompatPlugin, error)
    49  	GetAllByCap(capability string) ([]CompatPlugin, error)
    50  	GetAllManagedPluginsByCap(capability string) []CompatPlugin
    51  	Handle(capability string, callback func(string, *plugins.Client))
    52  }