Documentation
¶
Index ¶
- Constants
- func Banner(padding int) string
- func FormatTable(data [][]string) string
- func InstanceEventUsageTemplate() string
- func NewCmdInstance() *cobra.Command
- func NewCmdInstanceEvent() *cobra.Command
- func NewCmdOpenState() *cobra.Command
- func NewCmdServer() *cobra.Command
- func NewCmdTask() *cobra.Command
- func NewCmdTaskDefine() *cobra.Command
- func NewCmdTaskList() *cobra.Command
- func NewCmdTaskPs() *cobra.Command
- func NewCmdTaskRun() *cobra.Command
- func ServerUsageTemplate() string
- func SharedUsageTemplate() string
- func TableWriter(writer io.Writer) *tablewriter.Table
- func TaskDefineUsageTemplate() string
- func TaskListUsageTemplate() string
- func TaskPsUsageTemplate() string
- func TaskRunUsageTemplate() string
- type AdvertiseAddrs
- type Config
- type InstanceEventOptions
- type Meta
- type ServerConfig
- type ServerOptions
- type TaskDefineOptions
- type TaskListOptions
- type TaskPsOptions
- type TaskRunOptions
Constants ¶
const ( CONFIG_DIR = ".openstate" CONFIG_FILENAME = "config" )
Variables ¶
This section is empty.
Functions ¶
func FormatTable ¶
FormatTable returns a properly formatted string given some input. The first row of the data matrix must be the column headers.
func InstanceEventUsageTemplate ¶
func InstanceEventUsageTemplate() string
func NewCmdInstance ¶
func NewCmdInstanceEvent ¶
func NewCmdOpenState ¶
func NewCmdServer ¶
NewCmdServer initializes ServerOptions, creates the new Cobra command, and adds the flags
func NewCmdTask ¶
func NewCmdTaskDefine ¶
func NewCmdTaskList ¶
func NewCmdTaskPs ¶
func NewCmdTaskRun ¶
func ServerUsageTemplate ¶
func ServerUsageTemplate() string
func SharedUsageTemplate ¶
func SharedUsageTemplate() string
SharedUsageTemplate retuns a formatted string enumerating each shared CLI flag. It should not be used as an argument to SetUsageTemplate, but instead factored into a command's own usage template.
func TableWriter ¶
func TableWriter(writer io.Writer) *tablewriter.Table
TableWriter initializes and configures a tablewriter.Table object. This table should only be used by the FormatTable function.
func TaskDefineUsageTemplate ¶
func TaskDefineUsageTemplate() string
func TaskListUsageTemplate ¶
func TaskListUsageTemplate() string
func TaskPsUsageTemplate ¶
func TaskPsUsageTemplate() string
func TaskRunUsageTemplate ¶
func TaskRunUsageTemplate() string
Types ¶
type AdvertiseAddrs ¶
type AdvertiseAddrs struct {
HTTP string `mapstructure:"http"`
Serf string `mapstructure:"serf"`
Raft string `mapstructure:"raft"`
}
AdvertiseAddrs are the addresses for Raft, Serf, and HTTP endpoints.
type Config ¶
type Config struct {
// NoBanner indicates if we should not print the ASCII OpenState banner
NoBanner bool `mapstructure:"no_banner"`
// DevMode indicates if the OpenState server should run in development mode.
// This disables the log, stable, and snapshot stores, and uses a simple
// in-memory store instead.
DevMode bool `mapstructure:"dev_mode"`
// DataDirectory is a path to directory where OpenState stores state related
// objects; primarily snapshots, logs, and the stable store.
DataDirectory string `mapstructure:data_directory`
// LogLevel is the verbosity of OpenState's logger. Options include: DEBUG,
// INFO, WARN, and ERROR. See hashicorp/hclog for more info.
LogLevel string `mapstructure:"log_level"`
// Addrs are the addresses for Raft, Serf, and HTTP endpoints.
Addrs *AdvertiseAddrs `mapstructure:"advertise"`
// Server contains server-specific configs.
Server *ServerConfig `yaml:"server"`
}
Config is the umbrella struct with encompasses every configurable value in OpenState's config file.
type InstanceEventOptions ¶
type InstanceEventOptions struct {
Meta
// contains filtered or unexported fields
}
func NewInstanceEventOptions ¶
func NewInstanceEventOptions() *InstanceEventOptions
func (*InstanceEventOptions) Complete ¶
func (o *InstanceEventOptions) Complete(cmd *cobra.Command, args []string) error
func (*InstanceEventOptions) Name ¶
func (o *InstanceEventOptions) Name() string
func (*InstanceEventOptions) Run ¶
func (o *InstanceEventOptions) Run()
type Meta ¶
type ServerConfig ¶
type ServerConfig struct {
// NodeNameis the advertised name of the server. It's most commonly used in
// Serf's gossip protocol.
NodeName string `mapstructure:"node_name"`
// Join is the initial list of peer serf addresses. This option is a hack
// to bypass the need for service discovery (TODO). This list only needs to
// contain ONE valid peer; the gossip layer will propogate the new peer
// across all nodes.
Join []string `mapstructure:"join"`
// BootstrapExpect is the number of peers the new server should expect. If
// 1, the new server will create a single node cluster and elect itself
// leader.
BootstrapExpect int `mapstructure:"bootstrap_expect"`
}
ServerConfig contains server-specific configs.
type ServerOptions ¶
type ServerOptions struct {
Meta
// contains filtered or unexported fields
}
ServerOptions wraps the Config and any additional flags needed to run a new server.
func NewServerOptions ¶
func NewServerOptions() *ServerOptions
func (*ServerOptions) Complete ¶
func (o *ServerOptions) Complete(cmd *cobra.Command, args []string) error
func (*ServerOptions) Run ¶
func (o *ServerOptions) Run()
Run reads in the config file, overwrites any values with flags, and starts the server.
type TaskDefineOptions ¶
type TaskDefineOptions struct {
Meta
// contains filtered or unexported fields
}
func NewTaskDefineOptions ¶
func NewTaskDefineOptions() *TaskDefineOptions
func (*TaskDefineOptions) Complete ¶
func (o *TaskDefineOptions) Complete(cmd *cobra.Command, args []string) error
func (*TaskDefineOptions) Name ¶
func (o *TaskDefineOptions) Name() string
func (*TaskDefineOptions) Run ¶
func (o *TaskDefineOptions) Run()
type TaskListOptions ¶
type TaskListOptions struct {
Meta
}
func NewTaskListOptions ¶
func NewTaskListOptions() *TaskListOptions
func (*TaskListOptions) Name ¶
func (o *TaskListOptions) Name() string
func (*TaskListOptions) Run ¶
func (o *TaskListOptions) Run()
type TaskPsOptions ¶
func NewTaskPsOptions ¶
func NewTaskPsOptions() *TaskPsOptions
func (*TaskPsOptions) Complete ¶
func (o *TaskPsOptions) Complete(cmd *cobra.Command, args []string) error
func (*TaskPsOptions) Name ¶
func (o *TaskPsOptions) Name() string
func (*TaskPsOptions) Run ¶
func (o *TaskPsOptions) Run()
type TaskRunOptions ¶
func NewTaskRunOptions ¶
func NewTaskRunOptions() *TaskRunOptions
func (*TaskRunOptions) Complete ¶
func (o *TaskRunOptions) Complete(cmd *cobra.Command, args []string) error
func (*TaskRunOptions) Name ¶
func (o *TaskRunOptions) Name() string
func (*TaskRunOptions) Run ¶
func (o *TaskRunOptions) Run()