Documentation
¶
Index ¶
- Constants
- func NewSandboxDaemon()
- type Client
- func (c *Client) DeleteFile(ctx context.Context, filePath string) error
- func (c *Client) ReadFile(ctx context.Context, filePath string) (*fileContent, error)
- func (c *Client) RunBashCommand(ctx context.Context, in *ExecRequest) (*ExecResponse, error)
- func (c *Client) RunPythonScript(ctx context.Context, in *ExecRequest) (*ExecResponse, error)
- func (c *Client) WriteFile(ctx context.Context, filePath, content string) (*fileContent, error)
- type ExecRequest
- type ExecResponse
Constants ¶
View Source
const ( // IdleTimeout is the duration after which the daemon will shut down if no requests are received. // Change this value to adjust how long the daemon waits before auto-terminating. IdleTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func NewSandboxDaemon ¶
func NewSandboxDaemon()
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to a sandbox daemon inside a sandbox pod.
func NewClient ¶
func NewClient(handle *sandbox.SandboxHandle) *Client
NewClient constructs a client for the given sandbox handle.
func (*Client) DeleteFile ¶
DeleteFile deletes a file from the sandbox filesystem.
func (*Client) RunBashCommand ¶
func (c *Client) RunBashCommand(ctx context.Context, in *ExecRequest) (*ExecResponse, error)
RunBashCommand executes a bash command inside the sandbox.
func (*Client) RunPythonScript ¶
func (c *Client) RunPythonScript(ctx context.Context, in *ExecRequest) (*ExecResponse, error)
RunPythonScript executes a Python script inside the sandbox.
type ExecRequest ¶
type ExecRequest struct {
Command string `json:"command,omitempty"` // for bash
Args []string `json:"args,omitempty"` // for bash
Script string `json:"script,omitempty"` // for python
TimeoutSeconds int `json:"timeout_seconds,omitempty"` // defaults to 60
Workdir string `json:"workdir,omitempty"`
Env map[string]string `json:"env,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.