Documentation ¶
Overview ¶
Package nanotoolbox provides a minimal set of tools for communicating with the vmx.
Index ¶
- Variables
- func NewHypervisorChannelPair() (Channel, Channel)
- type Channel
- type ChannelOut
- type CommandHandler
- type OptionHandler
- type Service
- func (s *Service) AddCapability(name string)
- func (s *Service) Dispatch(request []byte) []byte
- func (s *Service) HandleCapabilitiesRegister([]byte) ([]byte, error)
- func (s *Service) HandlePing([]byte) ([]byte, error)
- func (s *Service) HandleReset([]byte) ([]byte, error)
- func (s *Service) HandleSetOption(args []byte) ([]byte, error)
- func (s *Service) RegisterCommandHandler(name string, handler CommandHandler)
- func (s *Service) RegisterOptionHandler(key string, handler OptionHandler)
- func (s *Service) RegisterResetHandler(f func())
- func (s *Service) Start() error
- func (s *Service) Stop()
- func (s *Service) Wait()
Constants ¶
This section is empty.
Variables ¶
var ( // RpciOK is the return code for a successful RPCI request. RpciOK = []byte{'1', ' '} // RpciERR is the return code for a failed RPCI request. RpciERR = []byte{'0', ' '} )
var ErrNotVirtualWorld = errors.New("not in a virtual world")
ErrNotVirtualWorld is returned when the current process is not running in a virtual world.
Functions ¶
func NewHypervisorChannelPair ¶
NewHypervisorChannelPair returns a pair of channels for communicating with the vmx.
Types ¶
type ChannelOut ¶
type ChannelOut struct {
Channel
}
ChannelOut extends Channel to provide RPCI protocol helpers.
type CommandHandler ¶
CommandHandler is given the raw argument portion of an RPC request and returns a response.
type OptionHandler ¶
type OptionHandler func(key, value string)
OptionHandler is given the raw key and value of Set_Option requests.
type Service ¶
type Service struct { Log logrus.FieldLogger Out *ChannelOut // contains filtered or unexported fields }
Service receives and dispatches incoming RPC requests from the vmx.
func NewService ¶
func NewService(log logrus.FieldLogger, rpcIn Channel, rpcOut Channel) *Service
NewService initializes a Service instance.
func (*Service) AddCapability ¶
AddCapability adds a capability to the Service.
func (*Service) HandleCapabilitiesRegister ¶
HandleCapabilitiesRegister sends the Service's capabilities to the vmx.
func (*Service) HandlePing ¶
HandlePing responds to a ping request.
func (*Service) HandleReset ¶
HandleReset resets the Service.
func (*Service) HandleSetOption ¶
HandleSetOption handles Set_Option requests.
func (*Service) RegisterCommandHandler ¶
func (s *Service) RegisterCommandHandler(name string, handler CommandHandler)
RegisterCommandHandler adds a CommandHandler to the Service.
func (*Service) RegisterOptionHandler ¶
func (s *Service) RegisterOptionHandler(key string, handler OptionHandler)
RegisterOptionHandler adds an OptionHandler to the Service.
func (*Service) RegisterResetHandler ¶
func (s *Service) RegisterResetHandler(f func())
RegisterResetHandler adds a function to be called when the Service is reset.
func (*Service) Start ¶
Start initializes the RPC channels and starts a goroutine to listen for incoming RPC requests.