summaryrefslogtreecommitdiff
path: root/libnetwork/cluster/provider.go
blob: 0259eb700554f741156d0effbccdafa62da4380d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package cluster

import (
	"context"

	"github.com/docker/docker/api/types/network"
)

const (
	// EventSocketChange control socket changed
	EventSocketChange = iota
	// EventNodeReady cluster node in ready state
	EventNodeReady
	// EventNodeLeave node is leaving the cluster
	EventNodeLeave
	// EventNetworkKeysAvailable network keys correctly configured in the networking layer
	EventNetworkKeysAvailable
)

// ConfigEventType type of the event produced by the cluster
type ConfigEventType uint8

// Provider provides clustering config details
type Provider interface {
	IsManager() bool
	IsAgent() bool
	GetLocalAddress() string
	GetListenAddress() string
	GetAdvertiseAddress() string
	GetDataPathAddress() string
	GetRemoteAddressList() []string
	ListenClusterEvents() <-chan ConfigEventType
	AttachNetwork(string, string, []string) (*network.NetworkingConfig, error)
	DetachNetwork(string, string) error
	UpdateAttachment(string, string, *network.NetworkingConfig) error
	WaitForDetachment(context.Context, string, string, string, string) error
}