plugingetter: Avoid all caps for constant declarations
| ... | ... |
@@ -516,7 +516,7 @@ func (cli *DaemonCli) initMiddlewares(s *apiserver.Server, cfg *apiserver.Config |
| 516 | 516 |
// plugins present on the host and available to the daemon |
| 517 | 517 |
func validateAuthzPlugins(requestedPlugins []string, pg plugingetter.PluginGetter) error {
|
| 518 | 518 |
for _, reqPlugin := range requestedPlugins {
|
| 519 |
- if _, err := pg.Get(reqPlugin, authorization.AuthZApiImplements, plugingetter.LOOKUP); err != nil {
|
|
| 519 |
+ if _, err := pg.Get(reqPlugin, authorization.AuthZApiImplements, plugingetter.Lookup); err != nil {
|
|
| 520 | 520 |
return err |
| 521 | 521 |
} |
| 522 | 522 |
} |
| ... | ... |
@@ -22,7 +22,7 @@ func lookupPlugin(name string, pg plugingetter.PluginGetter, config Options) (Dr |
| 22 | 22 |
if !config.ExperimentalEnabled {
|
| 23 | 23 |
return nil, fmt.Errorf("graphdriver plugins are only supported with experimental mode")
|
| 24 | 24 |
} |
| 25 |
- pl, err := pg.Get(name, "GraphDriver", plugingetter.ACQUIRE) |
|
| 25 |
+ pl, err := pg.Get(name, "GraphDriver", plugingetter.Acquire) |
|
| 26 | 26 |
if err != nil {
|
| 27 | 27 |
return nil, fmt.Errorf("Error looking up graphdriver plugin %s: %v", name, err)
|
| 28 | 28 |
} |
| ... | ... |
@@ -301,9 +301,9 @@ func (daemon *Daemon) createNetwork(create types.NetworkCreateRequest, id string |
| 301 | 301 |
return nil, err |
| 302 | 302 |
} |
| 303 | 303 |
|
| 304 |
- daemon.pluginRefCount(driver, driverapi.NetworkPluginEndpointType, plugingetter.ACQUIRE) |
|
| 304 |
+ daemon.pluginRefCount(driver, driverapi.NetworkPluginEndpointType, plugingetter.Acquire) |
|
| 305 | 305 |
if create.IPAM != nil {
|
| 306 |
- daemon.pluginRefCount(create.IPAM.Driver, ipamapi.PluginEndpointType, plugingetter.ACQUIRE) |
|
| 306 |
+ daemon.pluginRefCount(create.IPAM.Driver, ipamapi.PluginEndpointType, plugingetter.Acquire) |
|
| 307 | 307 |
} |
| 308 | 308 |
daemon.LogNetworkEvent(n, "create") |
| 309 | 309 |
|
| ... | ... |
@@ -457,9 +457,9 @@ func (daemon *Daemon) deleteNetwork(networkID string, dynamic bool) error {
|
| 457 | 457 |
if err := nw.Delete(); err != nil {
|
| 458 | 458 |
return err |
| 459 | 459 |
} |
| 460 |
- daemon.pluginRefCount(nw.Type(), driverapi.NetworkPluginEndpointType, plugingetter.RELEASE) |
|
| 460 |
+ daemon.pluginRefCount(nw.Type(), driverapi.NetworkPluginEndpointType, plugingetter.Release) |
|
| 461 | 461 |
ipamType, _, _, _ := nw.Info().IpamConfig() |
| 462 |
- daemon.pluginRefCount(ipamType, ipamapi.PluginEndpointType, plugingetter.RELEASE) |
|
| 462 |
+ daemon.pluginRefCount(ipamType, ipamapi.PluginEndpointType, plugingetter.Release) |
|
| 463 | 463 |
daemon.LogNetworkEvent(nw, "destroy") |
| 464 | 464 |
return nil |
| 465 | 465 |
} |
| ... | ... |
@@ -97,7 +97,7 @@ func (a *authorizationPlugin) initPlugin() error {
|
| 97 | 97 |
var e error |
| 98 | 98 |
|
| 99 | 99 |
if pg := GetPluginGetter(); pg != nil {
|
| 100 |
- plugin, e = pg.Get(a.name, AuthZApiImplements, plugingetter.LOOKUP) |
|
| 100 |
+ plugin, e = pg.Get(a.name, AuthZApiImplements, plugingetter.Lookup) |
|
| 101 | 101 |
} else {
|
| 102 | 102 |
plugin, e = plugins.Get(a.name, AuthZApiImplements) |
| 103 | 103 |
} |
| ... | ... |
@@ -3,12 +3,12 @@ package plugingetter |
| 3 | 3 |
import "github.com/docker/docker/pkg/plugins" |
| 4 | 4 |
|
| 5 | 5 |
const ( |
| 6 |
- // LOOKUP doesn't update RefCount |
|
| 7 |
- LOOKUP = 0 |
|
| 8 |
- // ACQUIRE increments RefCount |
|
| 9 |
- ACQUIRE = 1 |
|
| 10 |
- // RELEASE decrements RefCount |
|
| 11 |
- RELEASE = -1 |
|
| 6 |
+ // Lookup doesn't update RefCount |
|
| 7 |
+ Lookup = 0 |
|
| 8 |
+ // Acquire increments RefCount |
|
| 9 |
+ Acquire = 1 |
|
| 10 |
+ // Release decrements RefCount |
|
| 11 |
+ Release = -1 |
|
| 12 | 12 |
) |
| 13 | 13 |
|
| 14 | 14 |
// CompatPlugin is an abstraction to handle both v2(new) and v1(legacy) plugins. |
| ... | ... |
@@ -233,12 +233,12 @@ func (p *Plugin) AddRefCount(count int) {
|
| 233 | 233 |
// Acquire increments the plugin's reference count |
| 234 | 234 |
// This should be followed up by `Release()` when the plugin is no longer in use. |
| 235 | 235 |
func (p *Plugin) Acquire() {
|
| 236 |
- p.AddRefCount(plugingetter.ACQUIRE) |
|
| 236 |
+ p.AddRefCount(plugingetter.Acquire) |
|
| 237 | 237 |
} |
| 238 | 238 |
|
| 239 | 239 |
// Release decrements the plugin's reference count |
| 240 | 240 |
// This should only be called when the plugin is no longer in use, e.g. with |
| 241 |
-// via `Acquire()` or getter.Get("name", "type", plugingetter.ACQUIRE)
|
|
| 241 |
+// via `Acquire()` or getter.Get("name", "type", plugingetter.Acquire)
|
|
| 242 | 242 |
func (p *Plugin) Release() {
|
| 243 |
- p.AddRefCount(plugingetter.RELEASE) |
|
| 243 |
+ p.AddRefCount(plugingetter.Release) |
|
| 244 | 244 |
} |
| ... | ... |
@@ -23,7 +23,7 @@ github.com/RackSec/srslog 456df3a81436d29ba874f3590eeeee25d666f8a5 |
| 23 | 23 |
github.com/imdario/mergo 0.2.1 |
| 24 | 24 |
|
| 25 | 25 |
#get libnetwork packages |
| 26 |
-github.com/docker/libnetwork 61f01cdbbda7e32e651198b04889f6d825064fa6 |
|
| 26 |
+github.com/docker/libnetwork 382be38ce860738d80b53d7875d83abd5970d9d6 https://github.com/aaronlehmann/libnetwork |
|
| 27 | 27 |
github.com/docker/go-events 18b43f1bc85d9cdd42c05a6cd2d444c7a200a894 |
| 28 | 28 |
github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80 |
| 29 | 29 |
github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec |
| ... | ... |
@@ -1087,7 +1087,7 @@ func (c *controller) loadDriver(networkType string) error {
|
| 1087 | 1087 |
var err error |
| 1088 | 1088 |
|
| 1089 | 1089 |
if pg := c.GetPluginGetter(); pg != nil {
|
| 1090 |
- _, err = pg.Get(networkType, driverapi.NetworkPluginEndpointType, plugingetter.LOOKUP) |
|
| 1090 |
+ _, err = pg.Get(networkType, driverapi.NetworkPluginEndpointType, plugingetter.Lookup) |
|
| 1091 | 1091 |
} else {
|
| 1092 | 1092 |
_, err = plugins.Get(networkType, driverapi.NetworkPluginEndpointType) |
| 1093 | 1093 |
} |
| ... | ... |
@@ -1106,7 +1106,7 @@ func (c *controller) loadIPAMDriver(name string) error {
|
| 1106 | 1106 |
var err error |
| 1107 | 1107 |
|
| 1108 | 1108 |
if pg := c.GetPluginGetter(); pg != nil {
|
| 1109 |
- _, err = pg.Get(name, ipamapi.PluginEndpointType, plugingetter.LOOKUP) |
|
| 1109 |
+ _, err = pg.Get(name, ipamapi.PluginEndpointType, plugingetter.Lookup) |
|
| 1110 | 1110 |
} else {
|
| 1111 | 1111 |
_, err = plugins.Get(name, ipamapi.PluginEndpointType) |
| 1112 | 1112 |
} |
| ... | ... |
@@ -146,7 +146,7 @@ func GetDriver(name string) (volume.Driver, error) {
|
| 146 | 146 |
if name == "" {
|
| 147 | 147 |
name = volume.DefaultDriverName |
| 148 | 148 |
} |
| 149 |
- return lookup(name, getter.LOOKUP) |
|
| 149 |
+ return lookup(name, getter.Lookup) |
|
| 150 | 150 |
} |
| 151 | 151 |
|
| 152 | 152 |
// CreateDriver returns a volume driver by its name and increments RefCount. |
| ... | ... |
@@ -155,7 +155,7 @@ func CreateDriver(name string) (volume.Driver, error) {
|
| 155 | 155 |
if name == "" {
|
| 156 | 156 |
name = volume.DefaultDriverName |
| 157 | 157 |
} |
| 158 |
- return lookup(name, getter.ACQUIRE) |
|
| 158 |
+ return lookup(name, getter.Acquire) |
|
| 159 | 159 |
} |
| 160 | 160 |
|
| 161 | 161 |
// RemoveDriver returns a volume driver by its name and decrements RefCount.. |
| ... | ... |
@@ -164,7 +164,7 @@ func RemoveDriver(name string) (volume.Driver, error) {
|
| 164 | 164 |
if name == "" {
|
| 165 | 165 |
name = volume.DefaultDriverName |
| 166 | 166 |
} |
| 167 |
- return lookup(name, getter.RELEASE) |
|
| 167 |
+ return lookup(name, getter.Release) |
|
| 168 | 168 |
} |
| 169 | 169 |
|
| 170 | 170 |
// GetDriverList returns list of volume drivers registered. |