Documentation
¶
Index ¶
- Constants
- func CheckConnStatus(blockId string) error
- func DestroyBlockController(blockId string)
- func HandleAppendBlockFile(blockId string, blockFile string, data []byte) error
- func HandleTruncateBlockFile(blockId string) error
- func InitBlockController()
- func ResyncController(ctx context.Context, tabId string, blockId string, rtOpts *waveobj.RuntimeOpts, ...) error
- func SendInput(blockId string, inputUnion *BlockInputUnion) error
- func StopAllBlockControllersForShutdown()
- type BlockControllerRuntimeStatus
- type BlockInputUnion
- type ConnUnion
- type Controller
- func MakeDurableShellController(tabId string, blockId string, controllerType string, connName string) Controller
- func MakeShellController(tabId string, blockId string, controllerType string, connName string) Controller
- func MakeTsunamiController(tabId string, blockId string, connName string) Controller
- type DurableShellController
- func (dsc *DurableShellController) GetConnName() string
- func (dsc *DurableShellController) GetRuntimeStatus() *BlockControllerRuntimeStatus
- func (dsc *DurableShellController) SendInput(inputUnion *BlockInputUnion) error
- func (dsc *DurableShellController) Start(ctx context.Context, blockMeta waveobj.MetaMapType, ...) error
- func (dsc *DurableShellController) Stop(graceful bool, newStatus string, destroy bool)
- func (dsc *DurableShellController) WithLock(f func())
- type RunShellOpts
- type ShellController
- func (sc *ShellController) DoRunShellCommand(logCtx context.Context, rc *RunShellOpts, blockMeta waveobj.MetaMapType) error
- func (sc *ShellController) GetConnName() string
- func (sc *ShellController) GetRuntimeStatus() *BlockControllerRuntimeStatus
- func (sc *ShellController) LockRunLock() bool
- func (sc *ShellController) SendInput(inputUnion *BlockInputUnion) error
- func (sc *ShellController) Start(ctx context.Context, blockMeta waveobj.MetaMapType, ...) error
- func (sc *ShellController) Stop(graceful bool, newStatus string, destroy bool)
- func (sc *ShellController) UnlockRunLock()
- func (sc *ShellController) UpdateControllerAndSendUpdate(updateFn func() bool)
- func (sc *ShellController) WithLock(f func())
- type TsunamiAppProc
- type TsunamiController
- func (c *TsunamiController) GetConnName() string
- func (c *TsunamiController) GetRuntimeStatus() *BlockControllerRuntimeStatus
- func (c *TsunamiController) SendInput(input *BlockInputUnion) error
- func (c *TsunamiController) Start(ctx context.Context, blockMeta waveobj.MetaMapType, ...) error
- func (c *TsunamiController) Stop(graceful bool, newStatus string, destroy bool)
- func (c *TsunamiController) WithStatusLock(fn func())
Constants ¶
View Source
const ( BlockController_Shell = "shell" BlockController_Cmd = "cmd" BlockController_Tsunami = "tsunami" )
View Source
const ( Status_Running = "running" Status_Done = "done" Status_Init = "init" )
View Source
const ( DefaultTermMaxFileSize = 256 * 1024 DefaultHtmlMaxFileSize = 256 * 1024 MaxInitScriptSize = 50 * 1024 )
View Source
const ( ConnType_Local = "local" ConnType_Wsl = "wsl" ConnType_Ssh = "ssh" )
View Source
const DefaultGracefulKillWait = 400 * time.Millisecond
View Source
const DefaultTimeout = 2 * time.Second
View Source
const (
LocalConnVariant_GitBash = "gitbash"
)
Variables ¶
This section is empty.
Functions ¶
func CheckConnStatus ¶
func DestroyBlockController ¶ added in v0.14.0
func DestroyBlockController(blockId string)
func HandleAppendBlockFile ¶
func HandleTruncateBlockFile ¶
func InitBlockController ¶ added in v0.14.0
func InitBlockController()
func ResyncController ¶
func SendInput ¶ added in v0.11.6
func SendInput(blockId string, inputUnion *BlockInputUnion) error
func StopAllBlockControllersForShutdown ¶ added in v0.14.0
func StopAllBlockControllersForShutdown()
only call this on shutdown
Types ¶
type BlockControllerRuntimeStatus ¶
type BlockControllerRuntimeStatus struct {
BlockId string `json:"blockid"`
Version int64 `json:"version"`
ShellProcStatus string `json:"shellprocstatus,omitempty"`
ShellProcConnName string `json:"shellprocconnname,omitempty"`
ShellProcExitCode int `json:"shellprocexitcode"`
TsunamiPort int `json:"tsunamiport,omitempty"`
}
func GetBlockControllerRuntimeStatus ¶ added in v0.11.6
func GetBlockControllerRuntimeStatus(blockId string) *BlockControllerRuntimeStatus
type BlockInputUnion ¶
type Controller ¶ added in v0.11.6
type Controller interface {
Start(ctx context.Context, blockMeta waveobj.MetaMapType, rtOpts *waveobj.RuntimeOpts, force bool) error
Stop(graceful bool, newStatus string, destroy bool)
GetRuntimeStatus() *BlockControllerRuntimeStatus // does not return nil
GetConnName() string
SendInput(input *BlockInputUnion) error
}
Controller interface that all block controllers must implement
func MakeDurableShellController ¶ added in v0.14.0
func MakeDurableShellController(tabId string, blockId string, controllerType string, connName string) Controller
func MakeShellController ¶ added in v0.11.6
func MakeShellController(tabId string, blockId string, controllerType string, connName string) Controller
Constructor that returns the Controller interface
func MakeTsunamiController ¶ added in v0.11.6
func MakeTsunamiController(tabId string, blockId string, connName string) Controller
type DurableShellController ¶ added in v0.14.0
type DurableShellController struct {
Lock *sync.Mutex
ControllerType string
TabId string
BlockId string
ConnName string
BlockDef *waveobj.BlockDef
VersionTs utilds.VersionTs
InputSessionId string // random uuid
JobId string
LastKnownStatus string
// contains filtered or unexported fields
}
func (*DurableShellController) GetConnName ¶ added in v0.14.0
func (dsc *DurableShellController) GetConnName() string
func (*DurableShellController) GetRuntimeStatus ¶ added in v0.14.0
func (dsc *DurableShellController) GetRuntimeStatus() *BlockControllerRuntimeStatus
func (*DurableShellController) SendInput ¶ added in v0.14.0
func (dsc *DurableShellController) SendInput(inputUnion *BlockInputUnion) error
func (*DurableShellController) Start ¶ added in v0.14.0
func (dsc *DurableShellController) Start(ctx context.Context, blockMeta waveobj.MetaMapType, rtOpts *waveobj.RuntimeOpts, force bool) error
Start initializes or reconnects to a durable shell for the block. Logic: - If block has no existing jobId: starts a new job and attaches it - If block has existing jobId with running job manager: reconnects to existing job - If block has existing jobId with non-running job manager:
- force=true: detaches old job and starts new one
- force=false: returns without starting (leaves block unstarted)
After establishing jobId, ensures job connection is active (reconnects if needed)
func (*DurableShellController) Stop ¶ added in v0.14.0
func (dsc *DurableShellController) Stop(graceful bool, newStatus string, destroy bool)
func (*DurableShellController) WithLock ¶ added in v0.14.0
func (dsc *DurableShellController) WithLock(f func())
type RunShellOpts ¶
type ShellController ¶ added in v0.11.6
type ShellController struct {
Lock *sync.Mutex
// shared fields
ControllerType string
TabId string
BlockId string
ConnName string
BlockDef *waveobj.BlockDef
RunLock *atomic.Bool
ProcStatus string
ProcExitCode int
VersionTs utilds.VersionTs
// for shell/cmd
ShellProc *shellexec.ShellProc
ShellInputCh chan *BlockInputUnion
}
func (*ShellController) DoRunShellCommand ¶ added in v0.11.6
func (sc *ShellController) DoRunShellCommand(logCtx context.Context, rc *RunShellOpts, blockMeta waveobj.MetaMapType) error
func (*ShellController) GetConnName ¶ added in v0.14.0
func (sc *ShellController) GetConnName() string
func (*ShellController) GetRuntimeStatus ¶ added in v0.11.6
func (sc *ShellController) GetRuntimeStatus() *BlockControllerRuntimeStatus
func (*ShellController) LockRunLock ¶ added in v0.11.6
func (sc *ShellController) LockRunLock() bool
func (*ShellController) SendInput ¶ added in v0.11.6
func (sc *ShellController) SendInput(inputUnion *BlockInputUnion) error
func (*ShellController) Start ¶ added in v0.11.6
func (sc *ShellController) Start(ctx context.Context, blockMeta waveobj.MetaMapType, rtOpts *waveobj.RuntimeOpts, force bool) error
func (*ShellController) Stop ¶ added in v0.11.6
func (sc *ShellController) Stop(graceful bool, newStatus string, destroy bool)
func (*ShellController) UnlockRunLock ¶ added in v0.11.6
func (sc *ShellController) UnlockRunLock()
func (*ShellController) UpdateControllerAndSendUpdate ¶ added in v0.11.6
func (sc *ShellController) UpdateControllerAndSendUpdate(updateFn func() bool)
func (*ShellController) WithLock ¶ added in v0.11.6
func (sc *ShellController) WithLock(f func())
type TsunamiAppProc ¶ added in v0.11.6
type TsunamiAppProc struct {
Cmd *exec.Cmd
LineBuffer *utilds.MultiReaderLineBuffer
StdinWriter io.WriteCloser
Port int // Port the tsunami app is listening on
WaitCh chan struct{} // Channel that gets closed when cmd.Wait() returns
WaitRtn error // Error returned by cmd.Wait()
}
type TsunamiController ¶ added in v0.11.6
type TsunamiController struct {
// contains filtered or unexported fields
}
func (*TsunamiController) GetConnName ¶ added in v0.14.0
func (c *TsunamiController) GetConnName() string
func (*TsunamiController) GetRuntimeStatus ¶ added in v0.11.6
func (c *TsunamiController) GetRuntimeStatus() *BlockControllerRuntimeStatus
func (*TsunamiController) SendInput ¶ added in v0.11.6
func (c *TsunamiController) SendInput(input *BlockInputUnion) error
func (*TsunamiController) Start ¶ added in v0.11.6
func (c *TsunamiController) Start(ctx context.Context, blockMeta waveobj.MetaMapType, rtOpts *waveobj.RuntimeOpts, force bool) error
func (*TsunamiController) Stop ¶ added in v0.11.6
func (c *TsunamiController) Stop(graceful bool, newStatus string, destroy bool)
func (*TsunamiController) WithStatusLock ¶ added in v0.11.6
func (c *TsunamiController) WithStatusLock(fn func())
Click to show internal directories.
Click to hide internal directories.