blockcontroller

package
v0.10.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockController_Shell = "shell"
	BlockController_Cmd   = "cmd"
)
View Source
const (
	BlockFile_Term  = "term"            // used for main pty output
	BlockFile_Cache = "cache:term:full" // for cached block
	BlockFile_VDom  = "vdom"            // used for alt html layout
)
View Source
const (
	Status_Running = "running"
	Status_Done    = "done"
	Status_Init    = "init"
)
View Source
const (
	DefaultTermMaxFileSize = 256 * 1024
	DefaultHtmlMaxFileSize = 256 * 1024
)
View Source
const DefaultTimeout = 2 * time.Second

Variables

This section is empty.

Functions

func CheckConnStatus

func CheckConnStatus(blockId string) error

func HandleAppendBlockFile

func HandleAppendBlockFile(blockId string, blockFile string, data []byte) error

func HandleTruncateBlockFile

func HandleTruncateBlockFile(blockId string) error

func ResyncController

func ResyncController(ctx context.Context, tabId string, blockId string, rtOpts *waveobj.RuntimeOpts, force bool) error

func StopAllBlockControllers

func StopAllBlockControllers()

func StopBlockController

func StopBlockController(blockId string)

func StopBlockControllerAndSetStatus added in v0.10.0

func StopBlockControllerAndSetStatus(blockId string, newStatus string)

Types

type BlockController

type BlockController struct {
	Lock              *sync.Mutex
	ControllerType    string
	TabId             string
	BlockId           string
	BlockDef          *waveobj.BlockDef
	CreatedHtmlFile   bool
	ShellProc         *shellexec.ShellProc
	ShellInputCh      chan *BlockInputUnion
	ShellProcStatus   string
	ShellProcExitCode int
	RunLock           *atomic.Bool
	StatusVersion     int
}

func GetBlockController

func GetBlockController(blockId string) *BlockController

func (*BlockController) DoRunShellCommand

func (bc *BlockController) DoRunShellCommand(rc *RunShellOpts, blockMeta waveobj.MetaMapType) error

func (*BlockController) GetRuntimeStatus

func (bc *BlockController) GetRuntimeStatus() *BlockControllerRuntimeStatus

func (*BlockController) LockRunLock added in v0.10.0

func (bc *BlockController) LockRunLock() bool

func (*BlockController) SendInput

func (bc *BlockController) SendInput(inputUnion *BlockInputUnion) error

func (*BlockController) StopShellProc

func (bc *BlockController) StopShellProc(shouldWait bool)

func (*BlockController) UnlockRunLock added in v0.10.0

func (bc *BlockController) UnlockRunLock()

func (*BlockController) UpdateControllerAndSendUpdate

func (bc *BlockController) UpdateControllerAndSendUpdate(updateFn func() bool)

func (*BlockController) WithLock

func (bc *BlockController) WithLock(f func())

type BlockControllerRuntimeStatus

type BlockControllerRuntimeStatus struct {
	BlockId           string `json:"blockid"`
	Version           int    `json:"version"`
	ShellProcStatus   string `json:"shellprocstatus,omitempty"`
	ShellProcConnName string `json:"shellprocconnname,omitempty"`
	ShellProcExitCode int    `json:"shellprocexitcode"`
}

type BlockInputUnion

type BlockInputUnion struct {
	InputData []byte            `json:"inputdata,omitempty"`
	SigName   string            `json:"signame,omitempty"`
	TermSize  *waveobj.TermSize `json:"termsize,omitempty"`
}

type RunShellOpts

type RunShellOpts struct {
	TermSize waveobj.TermSize `json:"termsize,omitempty"`
}

Jump to

Keyboard shortcuts

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