Documentation ¶
Index ¶
- func Init() (err error)
- func NewNSenterService() domain.NSenterServiceIface
- type NSenterEvent
- func (e *NSenterEvent) GetProcessID() uint32
- func (e *NSenterEvent) GetRequestMsg() *domain.NSenterMessage
- func (e *NSenterEvent) GetResponseMsg() *domain.NSenterMessage
- func (e *NSenterEvent) ReceiveResponse() *domain.NSenterMessage
- func (e *NSenterEvent) SendRequest() error
- func (e *NSenterEvent) SetRequestMsg(m *domain.NSenterMessage)
- func (e *NSenterEvent) SetResponseMsg(m *domain.NSenterMessage)
- func (e *NSenterEvent) TerminateRequest() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init() (err error)
Sysbox-fs' post-nsexec initialization function. To be executed within the context of one (or more) container namespaces.
func NewNSenterService ¶
func NewNSenterService() domain.NSenterServiceIface
Types ¶
type NSenterEvent ¶
type NSenterEvent struct { // Pid on behalf of which sysbox-fs is creating the nsenter event. Pid uint32 `json:"pid"` // namespace-types to attach to. Namespace *[]domain.NStype `json:"namespace"` // namepsaces to create (i.e., unshare) CloneFlags uint32 // Request message to be sent. ReqMsg *domain.NSenterMessage `json:"request"` // Response message to be received. ResMsg *domain.NSenterMessage `json:"response"` // Sysbox-fs' spawned process carrying out the nsexec instruction. Process *os.Process `json:"process"` // Asynchronous flag to tag events for which no response is expected. Async bool // contains filtered or unexported fields }
NSenterEvent struct serves as a transport abstraction (envelope) to carry all the potential messages that can be exchanged between sysbox-fs master instance and secondary (forked) ones. These sysbox-fs' auxiliary instances are utilized to perform actions over namespaced resources, and as such, cannot be executed by sysbox-fs' main instance.
Every bidirectional transaction is represented by an event structure (nsenterEvent), which holds both 'request' and 'response' messages, as well as the context necessary to complete any action demanding inter-namespace message exchanges.
func (*NSenterEvent) GetProcessID ¶
func (e *NSenterEvent) GetProcessID() uint32
func (*NSenterEvent) GetRequestMsg ¶
func (e *NSenterEvent) GetRequestMsg() *domain.NSenterMessage
func (*NSenterEvent) GetResponseMsg ¶
func (e *NSenterEvent) GetResponseMsg() *domain.NSenterMessage
func (*NSenterEvent) ReceiveResponse ¶
func (e *NSenterEvent) ReceiveResponse() *domain.NSenterMessage
func (*NSenterEvent) SendRequest ¶
func (e *NSenterEvent) SendRequest() error
Sysbox-fs requests are generated through this method. Handlers seeking to access namespaced resources will call this method to invoke nsexec, which will enter the container namespaces that host these resources.
func (*NSenterEvent) SetRequestMsg ¶
func (e *NSenterEvent) SetRequestMsg(m *domain.NSenterMessage)
func (*NSenterEvent) SetResponseMsg ¶
func (e *NSenterEvent) SetResponseMsg(m *domain.NSenterMessage)
func (*NSenterEvent) TerminateRequest ¶
func (e *NSenterEvent) TerminateRequest() error
TerminateRequest serves to unwind the nsenter-event FSM after the generation of an asynchronous event. This method is not required for regular nsenter events, as in those cases the SendRequest() method itself takes care of cleaning all the utilized resources.