ctrlc

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package ctrlc contains commands for the Clusterfunk CLI. The commands uses the Kong library for annotations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandList

type CommandList struct {
	Status    StatusCommand    `kong:"cmd,help='Show the node status'"`
	Nodes     ListNodesCommand `kong:"cmd,help='List the nodes in the cluster'"`
	Endpoints EndpointsCommand `kong:"cmd,help='List endpoints known by the node'"`
	Node      NodeCommand      `kong:"cmd,help='Add and remove nodes in cluster'"`
	Shards    ShardsCommand    `kong:"cmd,help='Show the shards in the cluster'"`
	StepDown  StepDownCommand  `kong:"cmd,help='Step down as the current leader'"`
}

CommandList contains all of the commands for the ctrlc utility

type EndpointsCommand

type EndpointsCommand struct {
	Filter string `kong:"optional,arg,help='Filter on prefix'"`
}

EndpointsCommand is the subcommand to list endpoints

func (*EndpointsCommand) Run

func (c *EndpointsCommand) Run(args RunContext) error

Run executes the endpoint command

type ListNodesCommand

type ListNodesCommand struct {
}

ListNodesCommand is the subcommand to list nodes in the cluster

func (*ListNodesCommand) Run

func (c *ListNodesCommand) Run(args RunContext) error

Run executes the list nodes command

type ManagementServerParameters

type ManagementServerParameters struct {
	ClusterName      string `kong:"help='Cluster name',default='clusterfunk',short='n'"`
	Zeroconf         bool   `kong:"help='Use zeroconf discovery for Serf',default='true',short='z'"`
	Endpoint         string `kong:"help='gRPC management endpoint',short='e'"`
	TLS              bool   `kong:"help='TLS enabled for gRPC',short='T'"`
	CertFile         string `kong:"help='Client certificate for management service',type='existingfile',short='C'"`
	HostnameOverride string `kong:"help='Host name override for certificate',short='H'"`
}

ManagementServerParameters holds the gRPC and utility configuration

type NodeCommand

type NodeCommand struct {
	Add addNodeCommand    `kong:"cmd,help='Add node to cluster'"`
	Rm  removeNodeCommand `kong:"cmd,help='Remove node from cluster'"`
	ID  string            `kong:"required,help='Node ID',short='N'"`
}

NodeCommand is the subcommand to add and remove nodes

type Parameters

type Parameters struct {
	Server   ManagementServerParameters `kong:"embed"`
	Commands CommandList                `kong:"embed"`
}

Parameters is the main parameter struct for the ctrlc utility

func (*Parameters) ClusterCommands

func (p *Parameters) ClusterCommands() CommandList

ClusterCommands returns the list of commands for the management utility

func (*Parameters) ClusterServer

func (p *Parameters) ClusterServer() ManagementServerParameters

ClusterServer returns the management server parameters

type RunContext

type RunContext interface {
	ClusterServer() ManagementServerParameters
	ClusterCommands() CommandList
}

RunContext is the context passed on to the subcommands. Override this when reusing the commands in other projects.

type ShardsCommand

type ShardsCommand struct {
}

ShardsCommand is the subcommand that shows the shards in the cluster

func (*ShardsCommand) Run

func (c *ShardsCommand) Run(args RunContext) error

Run shows the current shard distribution in the cluster

type StatusCommand

type StatusCommand struct {
}

StatusCommand is a subcommand for the ctrlc CLI.

func (*StatusCommand) Run

func (c *StatusCommand) Run(args RunContext) error

Run executes the status operation

type StepDownCommand

type StepDownCommand struct {
}

StepDownCommand is the step-down subcommand. The current leader will step down and let another node assume leadership.

func (*StepDownCommand) Run

func (c *StepDownCommand) Run(args RunContext) error

Run executes the step-down command on the node

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL