package work

import "github.com/redhatinsights/yggdrasil/internal/work"

Index

Constants

const (
	TransmitResponseErr int = -1
	TransmitResponseOK  int = 0
)

Functions

func NewDBusError

func NewDBusError(name string, body ...string) *dbus.Error

func ScrubName

func ScrubName(name string) (string, error)

ScrubName cleans up invalid bus names to ensure D-Bus name specification conformance. An error is returned along with the scrubbed value if the name contained invalid characters.

Types

type Dispatcher

type Dispatcher struct {
	HTTPClient *internalhttp.Client

	MessageJournal *messagejournal.MessageJournal
	Dispatchers    chan map[string]map[string]string
	WorkerEvents   chan ipc.WorkerEvent
	Inbound        chan yggdrasil.Data
	Outbound       chan struct {
		Data yggdrasil.Data
		Resp chan yggdrasil.Response
	}
	// contains filtered or unexported fields
}

Dispatcher implements the com.redhat.Yggdrasil1.Dispatcher1 D-Bus interface and is suitable to be exported onto a bus.

Dispatcher receives values on its 'inbound' channel and sends them via D-Bus to the destination worker. It sends values on the 'outbound' channel to relay data received from workers to a remote address.

func NewDispatcher

func NewDispatcher(client *internalhttp.Client) *Dispatcher

func (*Dispatcher) CancelMessage

func (d *Dispatcher) CancelMessage(directive, message_id, cancel_id string) error

CancelMessage implements the dispatching of a cancel message to the worker.

func (*Dispatcher) Connect

func (d *Dispatcher) Connect() error

Connect connects the dispatcher to an appropriate D-Bus broker and begins processing messages received on the inbound channel.

func (*Dispatcher) DisconnectWorkers

func (d *Dispatcher) DisconnectWorkers()

func (*Dispatcher) Dispatch

func (d *Dispatcher) Dispatch(data yggdrasil.Data) error

func (*Dispatcher) EmitEvent

func (d *Dispatcher) EmitEvent(event ipc.DispatcherEvent) error

func (*Dispatcher) FlattenDispatchers

func (d *Dispatcher) FlattenDispatchers() map[string]map[string]string

func (*Dispatcher) Transmit

func (d *Dispatcher) Transmit(
	sender dbus.Sender,
	addr string,
	messageID string,
	responseTo string,
	metadata map[string]string,
	data []byte,
) (responseCode int, responseMetadata map[string]string, responseData []byte, responseError *dbus.Error)

Transmit implements the com.redhat.Yggdrasil1.Dispatcher1.Transmit method.

Source Files

dbus.go dispatcher.go errors.go

Version
v0.4.5 (latest)
Published
Feb 3, 2025
Platform
linux/amd64
Imports
19 packages
Last checked
3 weeks ago

Tools for package owners.