cc

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 24 Imported by: 5

Documentation

Index

Constants

View Source
const (
	StatusNotRunning runStatus = iota
	StatusRunning
)
View Source
const (
	DefaultValue string = ""
)

Variables

View Source
var (
	ErrNotRunning = errors.New("topaz is not running, use 'topaz start' or 'topaz run' to start")
	ErrIsRunning  = errors.New("topaz is already running, use 'topaz stop' to stop")
	ErrNotServing = errors.New("topaz gRPC endpoint not SERVING")
)

Functions

func Container added in v0.31.0

func Container(registry, image, tag string) string

Container returns the fully qualified container name (registry/image:tag).

func ContainerImage added in v0.31.0

func ContainerImage() string

ContainerImage returns the container image name.

func ContainerName added in v0.31.0

func ContainerName(defaultConfigFile string) string

ContainerName returns the container instance name (docker run --name CONTAINER_NAME).

func ContainerPlatform added in v0.31.0

func ContainerPlatform() string

ContainerPlatform, returns the container platform for multi-platform capable servers.

func ContainerRegistry added in v0.31.0

func ContainerRegistry() string

ContainerRegistry returns the container registry (host[:port]/repo).

func ContainerTag added in v0.31.0

func ContainerTag() string

ContainerTag returns the container tag (label or semantic version).

func ContainerVersionTag added in v0.31.0

func ContainerVersionTag(version, tag string) string

ContainerVersionTag consolidates the old --container-version with the --container-tag value, the command handlers will read the environment variable versions $CONTAINER_VERSION and $CONTAINER_TAG, which is why they are not explicitly handled in this function.

func EnsureDirs added in v0.32.0

func EnsureDirs() error

func EnsureTopazCertsDir added in v0.32.0

func EnsureTopazCertsDir() error

func EnsureTopazCfgDir added in v0.32.0

func EnsureTopazCfgDir() error

func EnsureTopazDataDir added in v0.32.0

func EnsureTopazDataDir() error

func GetTopazCertsDir added in v0.30.25

func GetTopazCertsDir() string

GetTopazCertsDir returns the topaz certs directory ($TOPAZ_DIR/certs).

func GetTopazCfgDir added in v0.30.25

func GetTopazCfgDir() string

GetTopazCfgDir returns the topaz config directory ($TOPAZ_DIR/cfg).

func GetTopazDataDir added in v0.30.29

func GetTopazDataDir() string

GetTopazDataDir returns the topaz db directory ($TOPAZ_DIR/db).

func GetTopazDir added in v0.30.25

func GetTopazDir() string

GetTopazDir returns the topaz root directory ($TOPAZ_DIR).

func Retry added in v0.31.5

func Retry(timeout, interval time.Duration, f func() error) (err error)

func ServiceHealthStatus added in v0.31.5

func ServiceHealthStatus(addr, service string) bool

ServiceHealthStatus adopted from grpc-health-probe cli implementation https://github.com/grpc-ecosystem/grpc-health-probe/blob/master/main.go.

func WaitForPorts added in v0.31.5

func WaitForPorts(ports []string, expectedStatus PortStatus) error

Types

type ActiveConfig added in v0.32.0

type ActiveConfig struct {
	Config     string `json:"config"`
	ConfigFile string `json:"config_file"`
}

type CLIConfig added in v0.32.0

type CLIConfig struct {
	Version  int            `json:"version"`
	Active   ActiveConfig   `json:"active"`
	Running  RunningConfig  `json:"running"`
	Defaults DefaultsConfig `json:"defaults"`
}

type CommonCtx

type CommonCtx struct {
	Context context.Context
	UI      *clui.UI
	Config  *CLIConfig
}

func NewCommonContext

func NewCommonContext(noCheck bool, configFilePath string) (*CommonCtx, error)

func (*CommonCtx) CheckRunStatus added in v0.31.0

func (c *CommonCtx) CheckRunStatus(containerName string, expectedStatus runStatus) bool

func (*CommonCtx) GetRunningContainers added in v0.32.0

func (c *CommonCtx) GetRunningContainers() ([]*types.Container, error)

func (*CommonCtx) IsServing added in v0.31.2

func (c *CommonCtx) IsServing(grpcAddress string) bool

func (*CommonCtx) SaveContextConfig added in v0.32.0

func (c *CommonCtx) SaveContextConfig(configurationFile string) error

type DefaultsConfig added in v0.32.0

type DefaultsConfig struct {
	NoCheck           bool   `json:"no_check"`
	ContainerRegistry string `json:"container_registry"`
	ContainerImage    string `json:"container_image"`
	ContainerTag      string `json:"container_tag"`
	ContainerPlatform string `json:"container_platform"`
}

type PortStatus added in v0.31.5

type PortStatus int
const (
	PortOpened PortStatus = iota
	PortClosed
)

func (PortStatus) String added in v0.31.5

func (p PortStatus) String() string

type RunningConfig added in v0.32.0

type RunningConfig struct {
	ActiveConfig
	ContainerName string `json:"container_name"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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