Documentation ¶
Index ¶
- Variables
- type Agent
- type Config
- type Node
- func (n *Node) Agent() *Agent
- func (n *Node) Err(ctx context.Context) error
- func (n *Node) ListenControlSocket(ctx context.Context) <-chan *grpc.ClientConn
- func (n *Node) Manager() *manager.Manager
- func (n *Node) NodeID() string
- func (n *Node) Ready(ctx context.Context) <-chan struct{}
- func (n *Node) Remotes() []api.Peer
- func (n *Node) Start(ctx context.Context) error
- func (n *Node) Stop(ctx context.Context) error
- type NodeConfig
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAgentClosed is returned by agent methods after the agent has been // fully closed. ErrAgentClosed = errors.New("agent: closed") )
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent implements the primary node functionality for a member of a swarm cluster. The primary functionality id to run and report on the status of tasks assigned to the node.
func (*Agent) Err ¶
Err returns the error that caused the agent to shutdown or nil. Err blocks until the agent is fully shutdown.
func (*Agent) Ready ¶
func (a *Agent) Ready() <-chan struct{}
Ready returns a channel that will be closed when agent first becomes ready.
type Config ¶
type Config struct { // Hostname the name of host for agent instance. Hostname string // Managers provides the manager backend used by the agent. It will be // updated with managers weights as observed by the agent. Managers picker.Remotes // Executor specifies the executor to use for the agent. Executor exec.Executor // Conn specifies the client connection Agent will use Conn *grpc.ClientConn // NotifyRoleChange channel receives new roles from session messages. NotifyRoleChange chan<- api.NodeRole }
Config provides values for an Agent.
type Node ¶
Node implements the primary node functionality for a member of a swarm cluster. Node handles workloads and may also run as a manager.
func (*Node) Err ¶
Err returns the error that caused the node to shutdown or nil. Err blocks until the node has fully shut down.
func (*Node) ListenControlSocket ¶
func (n *Node) ListenControlSocket(ctx context.Context) <-chan *grpc.ClientConn
ListenControlSocket listens changes of a connection for managing the cluster control api
func (*Node) Ready ¶
Ready returns a channel that is closed after node's initialization has completes for the first time.
type NodeConfig ¶
type NodeConfig struct { // Hostname the name of host for agent instance. Hostname string // JoinAddrs specifies node that should be used for the initial connection to // other manager in cluster. This should be only one address and optional, // the actual remotes come from the stored state. JoinAddr string // StateDir specifies the directory the node uses to keep the state of the // remote managers and certificates. StateDir string // CAHash to be used on the first certificate request. CAHash string // Secret to be used on the first certificate request. Secret string // ForceNewCluster creates a new cluster from current raft state. ForceNewCluster bool // ListenControlAPI specifies address the control API should listen on. ListenControlAPI string // ListenRemoteAPI specifies the address for the remote API that agents // and raft members connect to. ListenRemoteAPI string // Executor specifies the executor to use for the agent. Executor exec.Executor // ElectionTick defines the amount of ticks needed without // leader to trigger a new election ElectionTick uint32 // HeartbeatTick defines the amount of ticks between each // heartbeat sent to other members for health-check purposes HeartbeatTick uint32 // todo: temporary to bypass promotion not working yet IsManager bool }
NodeConfig provides values for a Node.