Make experimental a runtime flag

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure 2016-10-06 07:09:54 -07:00
parent a6a247fdf9
commit 31f5d9b543
19 changed files with 22 additions and 40 deletions

View File

@ -127,6 +127,7 @@ type SystemAPIClient interface {
Info(ctx context.Context) (types.Info, error)
RegistryLogin(ctx context.Context, auth types.AuthConfig) (types.AuthResponse, error)
DiskUsage(ctx context.Context) (types.DiskUsage, error)
Ping(ctx context.Context) (bool, error)
}
// VolumeAPIClient defines API client methods for the volumes

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (
@ -7,9 +5,7 @@ import (
"golang.org/x/net/context"
)
// APIClient is an interface that clients that talk with a docker server must implement.
type APIClient interface {
CommonAPIClient
type apiClientExperimental interface {
CheckpointAPIClient
PluginAPIClient
}
@ -32,6 +28,3 @@ type PluginAPIClient interface {
PluginSet(ctx context.Context, name string, args []string) error
PluginInspectWithRaw(ctx context.Context, name string) (*types.Plugin, []byte, error)
}
// Ensure that Client always implements APIClient.
var _ APIClient = &Client{}

View File

@ -1,10 +1,9 @@
// +build !experimental
package client
// APIClient is an interface that clients that talk with a docker server must implement.
type APIClient interface {
CommonAPIClient
apiClientExperimental
}
// Ensure that Client always implements APIClient.

19
ping.go Normal file
View File

@ -0,0 +1,19 @@
package client
import "golang.org/x/net/context"
// Ping pings the server and return the value of the "Docker-Experimental" header
func (cli *Client) Ping(ctx context.Context) (bool, error) {
serverResp, err := cli.get(ctx, "/_ping", nil, nil)
if err != nil {
return false, err
}
defer ensureReaderClosed(serverResp)
exp := serverResp.header.Get("Docker-Experimental")
if exp != "true" {
return false, nil
}
return true, nil
}

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (

View File

@ -1,5 +1,3 @@
// +build experimental
package client
import (