Documentation ¶
Index ¶
- type BotInstance
- type BotState
- type KelpOS
- func (kos *KelpOS) AdvanceBotState(botName string, expectedCurrentState BotState) error
- func (kos *KelpOS) Background(namespace string, cmd string) (*Process, error)
- func (kos *KelpOS) Blocking(namespace string, cmd string) ([]byte, error)
- func (kos *KelpOS) GetBinDir() *OSPath
- func (kos *KelpOS) GetBot(botName string) (*BotInstance, error)
- func (kos *KelpOS) GetDotKelpWorkingDir() *OSPath
- func (kos *KelpOS) GetProcess(namespace string) (*Process, bool)
- func (kos *KelpOS) Mkdir(dirPath *OSPath) error
- func (kos *KelpOS) QueryBotState(botName string) (BotState, error)
- func (kos *KelpOS) RegisterBot(bot *model2.Bot) error
- func (kos *KelpOS) RegisterBotWithState(bot *model2.Bot, state BotState) error
- func (kos *KelpOS) RegisterBotWithStateUpsert(bot *model2.Bot, state BotState)
- func (kos *KelpOS) RegisteredBots() []string
- func (kos *KelpOS) RegisteredProcesses() []string
- func (kos *KelpOS) SafeUnregister(namespace string)
- func (kos *KelpOS) SafeUnregisterBot(botName string)
- func (kos *KelpOS) SetSilentRegistrations()
- func (kos *KelpOS) Stop(namespace string) error
- func (kos *KelpOS) StreamOutput(command *exec.Cmd) error
- func (kos *KelpOS) Unregister(namespace string) error
- type OSPath
- func (o *OSPath) AsString() string
- func (o *OSPath) IsRelative() bool
- func (o *OSPath) Join(elem ...string) *OSPath
- func (o *OSPath) JoinRelPath(relPaths ...*OSPath) (*OSPath, error)
- func (o *OSPath) MakeFromNativePath(targetNativePath string) (*OSPath, error)
- func (o *OSPath) MakeFromUnixPath(targetUnixPath string) (*OSPath, error)
- func (o *OSPath) Native() string
- func (o *OSPath) RelFromPath(basepath *OSPath) (*OSPath, error)
- func (o *OSPath) String() string
- func (o *OSPath) Unix() string
- type Process
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BotInstance ¶
BotInstance is an instance of a given bot along with the metadata
type KelpOS ¶
type KelpOS struct {
// contains filtered or unexported fields
}
KelpOS is a struct that manages all subprocesses started by this Kelp process
func (*KelpOS) AdvanceBotState ¶
AdvanceBotState advances the state of the given bot atomically, ensuring the bot is currently at the expected state
func (*KelpOS) Background ¶
Background runs the provided bash command in the background and registers the command
func (*KelpOS) GetBot ¶
func (kos *KelpOS) GetBot(botName string) (*BotInstance, error)
GetBot fetches the bot state for the given name
func (*KelpOS) GetDotKelpWorkingDir ¶ added in v1.9.0
GetDotKelpWorkingDir accessor
func (*KelpOS) GetProcess ¶
GetProcess gets the process tied to the provided namespace
func (*KelpOS) QueryBotState ¶
QueryBotState checks to see if the bot is actually running and returns the state accordingly
func (*KelpOS) RegisterBot ¶
RegisterBot registers a new bot, returning an error if one already exists with the same name
func (*KelpOS) RegisterBotWithState ¶
RegisterBotWithState registers a new bot with a given state, returning an error if one already exists with the same name
func (*KelpOS) RegisterBotWithStateUpsert ¶
RegisterBotWithStateUpsert registers a new bot with a given state, it always registers the bot even if it is already registered, never returning an error
func (*KelpOS) RegisteredBots ¶
RegisteredBots returns the list of registered bots
func (*KelpOS) RegisteredProcesses ¶
RegisteredProcesses returns the list of registered processes
func (*KelpOS) SafeUnregister ¶
SafeUnregister ignores erros when unregistering the command at the provided namespace
func (*KelpOS) SafeUnregisterBot ¶
SafeUnregisterBot unregister a bot without any errors
func (*KelpOS) SetSilentRegistrations ¶
func (kos *KelpOS) SetSilentRegistrations()
SetSilentRegistrations does not log every time we register and unregister commands
func (*KelpOS) StreamOutput ¶
StreamOutput runs the provided command in a streaming fashion
func (*KelpOS) Unregister ¶
Unregister unregisters the command at the provided namespace, returning an error if needed
type OSPath ¶ added in v1.9.0
type OSPath struct {
// contains filtered or unexported fields
}
OSPath encapsulates the pair of the native path (i.e. windows or unix) and the unix path this allows certain commands which are unix-specific to have access to the path instead of running transformations
func MakeOsPathBase ¶ added in v1.9.0
MakeOsPathBase is a factory method for the OSPath struct based on the current binary's directory
func (*OSPath) AsString ¶ added in v1.9.0
AsString produces a string representation and we intentionally don't use the Stringer API because this can mistakenly be used in place of a string path which will produce hidden runtime errors which is dangerous
func (*OSPath) IsRelative ¶ added in v1.9.0
IsRelative returns true if this is a relative path, otherwise false
func (*OSPath) Join ¶ added in v1.9.0
Join makes a new OSPath struct by modifying the internal path representations together
func (*OSPath) JoinRelPath ¶ added in v1.9.0
JoinRelPath makes a new OSPath struct by modifying the internal path representations together
func (*OSPath) MakeFromNativePath ¶ added in v1.9.0
MakeFromNativePath returns a new OSPath at the passed in native path string by using the existing OSPath
func (*OSPath) MakeFromUnixPath ¶ added in v1.9.0
MakeFromUnixPath returns a new OSPath at the passed in unix path string by using the existing OSPath
func (*OSPath) Native ¶ added in v1.9.0
Native returns the native representation of the path as a string
func (*OSPath) RelFromPath ¶ added in v1.9.0
RelFromPath returns a *OSPath that is relative from the provided path
type Process ¶
type Process struct { Cmd *exec.Cmd Stdin io.WriteCloser Stdout io.ReadCloser }
Process contains all the pieces that can be used to control a given process