Documentation ¶
Index ¶
- type CancelRxFunc
- type EventHandlerFunc
- type RxFunc
- type Worker
- func (w *Worker) Connect(quit <-chan os.Signal) error
- func (w *Worker) EmitEvent(event ipc.WorkerEventName, messageID string, responseTo string, ...) error
- func (w *Worker) GetFeature(name string) string
- func (w *Worker) SetFeature(name, value string) error
- func (w *Worker) Transmit(addr string, id string, responseTo string, metadata map[string]string, ...) (responseCode int, responseMetadata map[string]string, responseData []byte, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CancelRxFunc ¶
CancelRxFunc is a function type that gets called each time the worker receives a cancel message
type EventHandlerFunc ¶
type EventHandlerFunc func(e ipc.DispatcherEvent)
EventHandlerFunc is a function type that gets called each time the worker receives a com.redhat.Yggdrasil1.Dispatcher1.Event signal.
type RxFunc ¶
type RxFunc func(w *Worker, addr string, id string, responseTo string, metadata map[string]string, data []byte) error
RxFunc is a function type that gets called each time the worker receives data.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker implements the com.redhat.Yggdrasil1.Worker1 interface.
func NewWorker ¶
func NewWorker( directive string, remoteContent bool, features map[string]string, cancel CancelRxFunc, rx RxFunc, events EventHandlerFunc, ) (*Worker, error)
NewWorker creates a new worker.
func (*Worker) Connect ¶
Connect connects to the bus, exports the worker on its object path, and requests a well-known bus name. It connects to a private session bus, if DBUS_SESSION_BUS_ADDRESS is set in the environment. Otherwise it connects to the system bus. It exports w onto the bus and waits until a signal is received on quit.
func (*Worker) EmitEvent ¶
func (w *Worker) EmitEvent( event ipc.WorkerEventName, messageID string, responseTo string, data map[string]string, ) error
EmitEvent emits a WorkerEvent, worker message id, and key-value pairs of optional data.
func (*Worker) GetFeature ¶
GetFeature retrieves the value from the feature map for given key.
func (*Worker) SetFeature ¶
SetFeature sets the value for the given key in the feature map and emits the PropertiesChanged signal.
func (*Worker) Transmit ¶
func (w *Worker) Transmit( addr string, id string, responseTo string, metadata map[string]string, data []byte, ) (responseCode int, responseMetadata map[string]string, responseData []byte, err error)
Transmit wraps a com.redhat.Yggdrasil1.Dispatcher1.Transmit method call for ease of use from the worker.