Documentation
¶
Index ¶
- Constants
- type BwrapJsonStatus
- type BwrapStatusJsonI
- type CGroups
- func (c *CGroups) AddPid(cGroup string, pid int) error
- func (c *CGroups) CreateCGroup(limits domain.CGroupLimits) (string, error)
- func (c *CGroups) GetMetrics(cGroup string) (data domain.CGroupData, err error)
- func (c *CGroups) Init() error
- func (c *CGroups) RemoveCGroup(cGroup string) error
- func (c *CGroups) SetLimits(cGroup string, limits domain.CGroupLimits) error
- func (c *CGroups) SetSandboxesMemoryHigh(memHigh int) error
- type ImportPaths
- type Manager
- func (m *Manager) ForApp(appVersion *domain.AppVersion) (domain.SandboxI, error)
- func (m *Manager) ForMigration(appVersion *domain.AppVersion, appspace *domain.Appspace) (domain.SandboxI, error)
- func (m *Manager) GetForAppspace(appVersion *domain.AppVersion, appspace *domain.Appspace) (domain.SandboxI, chan struct{})
- func (m *Manager) Init()
- func (m *Manager) PrintSandboxes()
- func (m *Manager) StopAll()
- func (m *Manager) StopAppspace(appspaceID domain.AppspaceID)
- type Sandbox
- func (s *Sandbox) AppVersion() *domain.AppVersion
- func (s *Sandbox) AppspaceID() (a domain.NullAppspaceID)
- func (s *Sandbox) ExecFn(handler domain.AppspaceRouteHandler) error
- func (s *Sandbox) GetTransport() http.RoundTripper
- func (s *Sandbox) Graceful()
- func (s *Sandbox) Kill()
- func (s *Sandbox) LastActive() time.Time
- func (s *Sandbox) NewTask() chan struct{}
- func (s *Sandbox) Operation() string
- func (s *Sandbox) OwnerID() domain.UserID
- func (s *Sandbox) SendMessage(serviceID int, commandID int, payload []byte) (twine.SentMessageI, error)
- func (s *Sandbox) SetImportMapExtras(extras map[string]string)
- func (s *Sandbox) SetInspect(inspect bool)
- func (s *Sandbox) Start()
- func (s *Sandbox) Status() domain.SandboxStatus
- func (s *Sandbox) SubscribeStatus() chan domain.SandboxStatus
- func (s *Sandbox) TiedUp() bool
- func (s *Sandbox) WaitFor(status domain.SandboxStatus)
Constants ¶
const ( EPOLLET = 1 << 31 MaxEpollEvents = 32 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BwrapJsonStatus ¶ added in v0.10.0
type BwrapJsonStatus struct {
// contains filtered or unexported fields
}
func (*BwrapJsonStatus) GetFile ¶ added in v0.10.0
func (b *BwrapJsonStatus) GetFile() *os.File
func (*BwrapJsonStatus) Stop ¶ added in v0.10.0
func (b *BwrapJsonStatus) Stop()
Stop waiting for changes and clean up everything
func (*BwrapJsonStatus) WaitPid ¶ added in v0.10.0
func (b *BwrapJsonStatus) WaitPid() (int, bool)
type BwrapStatusJsonI ¶ added in v0.10.0
func NewBwrapJsonStatus ¶ added in v0.10.0
func NewBwrapJsonStatus(basePath string) (BwrapStatusJsonI, error)
type CGroups ¶
type CGroups struct { Config *domain.RuntimeConfig `checkinject:"required"` // contains filtered or unexported fields }
func (*CGroups) CreateCGroup ¶
func (c *CGroups) CreateCGroup(limits domain.CGroupLimits) (string, error)
CreateCGroup creates a cgroup for a sandbox
func (*CGroups) GetMetrics ¶
func (c *CGroups) GetMetrics(cGroup string) (data domain.CGroupData, err error)
func (*CGroups) Init ¶
Init creates a CGroup for the host and prepares to create cgroups for the sandboxes
func (*CGroups) RemoveCGroup ¶
func (*CGroups) SetLimits ¶ added in v0.7.3
func (c *CGroups) SetLimits(cGroup string, limits domain.CGroupLimits) error
func (*CGroups) SetSandboxesMemoryHigh ¶ added in v0.7.3
SetSandboxesMemoryHigh sets memory.high for all sandbox parent cgroup memHigh is in bytes
type ImportPaths ¶
ImportPaths defines a type for creating imopsts.json for Deno
type Manager ¶
type Manager struct { Config *domain.RuntimeConfig `checkinject:"required"` SandboxRuns interface { Create(run domain.SandboxRunIDs, start time.Time) (int, error) End(sandboxID int, end time.Time, data domain.SandboxRunData) error } `checkinject:"required"` CGroups interface { CreateCGroup(domain.CGroupLimits) (string, error) AddPid(string, int) error SetLimits(string, domain.CGroupLimits) error GetMetrics(string) (domain.CGroupData, error) RemoveCGroup(string) error } `checkinject:"optional"` AppLogger interface { Get(string) domain.LoggerI } `checkinject:"required"` AppspaceLogger interface { Open(domain.AppspaceID) domain.LoggerI } `checkinject:"required"` Services interface { Get(appspace *domain.Appspace, api domain.APIVersion) domain.ReverseServiceI } `checkinject:"required"` AppLocation2Path interface { Meta(string) string Files(string) string DenoDir(string) string } `checkinject:"required"` AppspaceLocation2Path interface { Base(string) string Data(string) string Files(string) string Avatars(string) string DenoDir(string) string } `checkinject:"required"` // contains filtered or unexported fields }
Manager manages sandboxes
func (*Manager) ForMigration ¶
func (*Manager) GetForAppspace ¶
func (m *Manager) GetForAppspace(appVersion *domain.AppVersion, appspace *domain.Appspace) (domain.SandboxI, chan struct{})
GetForAppspace records the need for a sandbox and returns a channel I wonder if this should essentially tie up the sandbox such that it doesn't get cleaned out before the request gets passed to it.
func (*Manager) PrintSandboxes ¶
func (m *Manager) PrintSandboxes()
PrintSandboxes outputs containersa and status
func (*Manager) StopAll ¶
func (m *Manager) StopAll()
StopAll takes all known sandboxes and stops them. It also stops the ticker
func (*Manager) StopAppspace ¶
func (m *Manager) StopAppspace(appspaceID domain.AppspaceID)
StopAppspace is used to stop an appspace sandbox from running if there is one it returns if/when no sanboxes are running for that appspace
type Sandbox ¶
type Sandbox struct { SandboxRuns interface { Create(run domain.SandboxRunIDs, start time.Time) (int, error) End(int, time.Time, domain.SandboxRunData) error } CGroups interface { CreateCGroup(domain.CGroupLimits) (string, error) AddPid(string, int) error SetLimits(string, domain.CGroupLimits) error GetMetrics(string) (domain.CGroupData, error) RemoveCGroup(string) error } Logger interface{ Log(string, string) } Services domain.ReverseServiceI AppLocation2Path interface { Meta(string) string Files(string) string DenoDir(string) string } AppspaceLocation2Path interface { Base(string) string Data(string) string Files(string) string Avatars(string) string DenoDir(string) string } Config *domain.RuntimeConfig // contains filtered or unexported fields }
Sandbox holds the data necessary to interact with the container
func NewSandbox ¶
func (*Sandbox) AppVersion ¶
func (s *Sandbox) AppVersion() *domain.AppVersion
func (*Sandbox) AppspaceID ¶
func (s *Sandbox) AppspaceID() (a domain.NullAppspaceID)
func (*Sandbox) ExecFn ¶
func (s *Sandbox) ExecFn(handler domain.AppspaceRouteHandler) error
ExecFn executes a function in athesandbox, based on the params of AppspaceRouteHandler
func (*Sandbox) GetTransport ¶
func (s *Sandbox) GetTransport() http.RoundTripper
GetTransport gets the http transport of the sandbox
func (*Sandbox) Graceful ¶
func (s *Sandbox) Graceful()
Graceful politely asks the sandbox to shut itself down
func (*Sandbox) LastActive ¶
LastActive returns the last used time
func (*Sandbox) NewTask ¶
func (s *Sandbox) NewTask() chan struct{}
NewTask returns a channel used to signal the beginning and end of a task. Pass a struct to indicate the task has started, close to indicate it has ended.
func (*Sandbox) SendMessage ¶
func (s *Sandbox) SendMessage(serviceID int, commandID int, payload []byte) (twine.SentMessageI, error)
SendMessage sends to sandbox via twine
func (*Sandbox) SetImportMapExtras ¶ added in v0.7.3
SetImportMap sets items to include in the generated import map
func (*Sandbox) SetInspect ¶
SetInspect sets the inspect flag which will cause the sandbox to start with --inspect-brk
func (*Sandbox) Start ¶
func (s *Sandbox) Start()
Start sets the status to starting and begins the start process in a goroutine.
func (*Sandbox) Status ¶
func (s *Sandbox) Status() domain.SandboxStatus
Status returns the status of the Sandbox
func (*Sandbox) SubscribeStatus ¶
func (s *Sandbox) SubscribeStatus() chan domain.SandboxStatus
SubscribeStatus returns a channel that will receive status for this sandbox It automatically closes the channel after sending sandbox dead
func (*Sandbox) WaitFor ¶
func (s *Sandbox) WaitFor(status domain.SandboxStatus)
WaitFor blocks until status is met, or greater status is met