Documentation ¶
Index ¶
- Constants
- func NewFarmStatusEvent(farmstatus api.FarmStatusReport) api.EventFarmStatus
- func NewJobUpdate(job *persistence.Job) api.EventJobUpdate
- func NewLastRenderedUpdate(jobUUID string) api.EventLastRenderedUpdate
- func NewLifeCycleEvent(lifeCycleType api.LifeCycleEventType) api.EventLifeCycle
- func NewTaskLogUpdate(taskUUID string, logchunk string) api.EventTaskLogUpdate
- func NewTaskUpdate(task *persistence.Task) api.EventTaskUpdate
- func NewWorkerTagDeletedUpdate(tagUUID string) api.EventWorkerTagUpdate
- func NewWorkerTagUpdate(tag *persistence.WorkerTag) api.EventWorkerTagUpdate
- func NewWorkerUpdate(worker *persistence.Worker) api.EventWorkerUpdate
- type Broker
- func (b *Broker) AddForwarder(forwarder Forwarder)
- func (b *Broker) AddListener(listener Listener)
- func (b *Broker) BroadcastFarmStatusEvent(event api.EventFarmStatus)
- func (b *Broker) BroadcastJobUpdate(jobUpdate api.EventJobUpdate)
- func (b *Broker) BroadcastLastRenderedImage(update api.EventLastRenderedUpdate)
- func (b *Broker) BroadcastLifeCycleEvent(event api.EventLifeCycle)
- func (b *Broker) BroadcastNewJob(jobUpdate api.EventJobUpdate)
- func (b *Broker) BroadcastNewWorker(workerUpdate api.EventWorkerUpdate)
- func (b *Broker) BroadcastNewWorkerTag(workerTagUpdate api.EventWorkerTagUpdate)
- func (b *Broker) BroadcastTaskLogUpdate(taskLogUpdate api.EventTaskLogUpdate)
- func (b *Broker) BroadcastTaskUpdate(taskUpdate api.EventTaskUpdate)
- func (b *Broker) BroadcastWorkerTagUpdate(workerTagUpdate api.EventWorkerTagUpdate)
- func (b *Broker) BroadcastWorkerUpdate(workerUpdate api.EventWorkerUpdate)
- type EventTopic
- type Forwarder
- type Listener
- type MQTTClientConfig
- type MQTTForwarder
- type Message
- type SocketIOEventType
- type SocketIOForwarder
Constants ¶
const ( MQTTDefaultTopicPrefix = "flamenco" MQTTDefaultClientID = "flamenco" )
Variables ¶
This section is empty.
Functions ¶
func NewFarmStatusEvent ¶
func NewFarmStatusEvent(farmstatus api.FarmStatusReport) api.EventFarmStatus
func NewJobUpdate ¶
func NewJobUpdate(job *persistence.Job) api.EventJobUpdate
NewJobUpdate returns a partial EventJobUpdate struct for the given job. It only fills in the fields that represent the current state of the job. For example, it omits `PreviousStatus`. The ommitted fields can be filled in by the caller.
func NewLastRenderedUpdate ¶
func NewLastRenderedUpdate(jobUUID string) api.EventLastRenderedUpdate
NewLastRenderedUpdate returns a partial EventLastRenderedUpdate struct. The `Thumbnail` field still needs to be filled in, but that requires information from the `api_impl.Flamenco` service.
func NewLifeCycleEvent ¶
func NewLifeCycleEvent(lifeCycleType api.LifeCycleEventType) api.EventLifeCycle
func NewTaskLogUpdate ¶
func NewTaskLogUpdate(taskUUID string, logchunk string) api.EventTaskLogUpdate
NewTaskLogUpdate returns a EventTaskLogUpdate for the given task.
func NewTaskUpdate ¶
func NewTaskUpdate(task *persistence.Task) api.EventTaskUpdate
NewTaskUpdate returns a partial TaskUpdate struct for the given task. It only fills in the fields that represent the current state of the task. For example, it omits `PreviousStatus`. The omitted fields can be filled in by the caller.
Assumes task.Job is not nil.
func NewWorkerTagDeletedUpdate ¶
func NewWorkerTagDeletedUpdate(tagUUID string) api.EventWorkerTagUpdate
NewWorkerTagDeletedUpdate returns a EventWorkerTagUpdate struct that indicates the worker tag has been deleted.
func NewWorkerTagUpdate ¶
func NewWorkerTagUpdate(tag *persistence.WorkerTag) api.EventWorkerTagUpdate
NewWorkerTagUpdate returns a partial EventWorkerTagUpdate struct for the given worker tag. It only fills in the fields that represent the current state of the tag.
func NewWorkerUpdate ¶
func NewWorkerUpdate(worker *persistence.Worker) api.EventWorkerUpdate
NewWorkerUpdate returns a partial EventWorkerUpdate struct for the given worker. It only fills in the fields that represent the current state of the worker. For example, it omits `PreviousStatus`. The ommitted fields can be filled in by the caller.
Types ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
func (*Broker) AddForwarder ¶
func (*Broker) AddListener ¶
func (*Broker) BroadcastFarmStatusEvent ¶
func (b *Broker) BroadcastFarmStatusEvent(event api.EventFarmStatus)
func (*Broker) BroadcastJobUpdate ¶
func (b *Broker) BroadcastJobUpdate(jobUpdate api.EventJobUpdate)
func (*Broker) BroadcastLastRenderedImage ¶
func (b *Broker) BroadcastLastRenderedImage(update api.EventLastRenderedUpdate)
func (*Broker) BroadcastLifeCycleEvent ¶
func (b *Broker) BroadcastLifeCycleEvent(event api.EventLifeCycle)
func (*Broker) BroadcastNewJob ¶
func (b *Broker) BroadcastNewJob(jobUpdate api.EventJobUpdate)
BroadcastNewJob sends a "new job" notification to clients. This function should be called when the job has been completely created, so including its tasks.
func (*Broker) BroadcastNewWorker ¶
func (b *Broker) BroadcastNewWorker(workerUpdate api.EventWorkerUpdate)
func (*Broker) BroadcastNewWorkerTag ¶
func (b *Broker) BroadcastNewWorkerTag(workerTagUpdate api.EventWorkerTagUpdate)
func (*Broker) BroadcastTaskLogUpdate ¶
func (b *Broker) BroadcastTaskLogUpdate(taskLogUpdate api.EventTaskLogUpdate)
func (*Broker) BroadcastTaskUpdate ¶
func (b *Broker) BroadcastTaskUpdate(taskUpdate api.EventTaskUpdate)
func (*Broker) BroadcastWorkerTagUpdate ¶
func (b *Broker) BroadcastWorkerTagUpdate(workerTagUpdate api.EventWorkerTagUpdate)
func (*Broker) BroadcastWorkerUpdate ¶
func (b *Broker) BroadcastWorkerUpdate(workerUpdate api.EventWorkerUpdate)
type EventTopic ¶
type EventTopic string
const ( // Topics on which events are published. // NOTE: when adding here, also add to socketIOEventTypes in socketio.go. TopicLifeCycle EventTopic = "/lifecycle" // sends api.EventLifeCycle TopicFarmStatus EventTopic = "/status" // sends api.EventFarmStatus TopicJobUpdate EventTopic = "/jobs" // sends api.EventJobUpdate TopicLastRenderedImage EventTopic = "/last-rendered" // sends api.EventLastRenderedUpdate TopicTaskUpdate EventTopic = "/task" // sends api.EventTaskUpdate TopicWorkerUpdate EventTopic = "/workers" // sends api.EventWorkerUpdate TopicWorkerTagUpdate EventTopic = "/workertags" // sends api.EventWorkerTagUpdate TopicSubscription EventTopic = "/subscription" // clients send api.EventSubscription // Parameterised topics. TopicJobSpecific EventTopic = "/jobs/%s" // %s = job UUID TopicJobLastRendered EventTopic = "/jobs/%s/last-rendered" // %s = job UUID TopicTaskLog EventTopic = "/tasklog/%s" // %s = task UUID )
type Forwarder ¶
type Forwarder interface {
Broadcast(topic EventTopic, payload interface{})
}
Forwarder is the interface for components that forward events to external systems.
type Listener ¶
type Listener interface {
OnEvent(topic EventTopic, payload interface{})
}
Listener is the interface for internal components that want to respond to events.
type MQTTClientConfig ¶
type MQTTClientConfig struct { BrokerURL string `yaml:"broker"` ClientID string `yaml:"clientID"` TopicPrefix string `yaml:"topic_prefix"` Username string `yaml:"username"` Password string `yaml:"password"` }
MQTTClientConfig contains the MQTT client configuration.
type MQTTForwarder ¶
type MQTTForwarder struct {
// contains filtered or unexported fields
}
func NewMQTTForwarder ¶
func NewMQTTForwarder(config MQTTClientConfig) *MQTTForwarder
func (*MQTTForwarder) Broadcast ¶
func (m *MQTTForwarder) Broadcast(topic EventTopic, payload interface{})
func (*MQTTForwarder) Connect ¶
func (m *MQTTForwarder) Connect(ctx context.Context)
type SocketIOEventType ¶
type SocketIOEventType string
const (
SIOEventSubscription SocketIOEventType = "/subscription" // clients send api.SocketIOSubscription
)
type SocketIOForwarder ¶
type SocketIOForwarder struct {
// contains filtered or unexported fields
}
SocketIOForwarder is an event forwarder via SocketIO.
func NewSocketIOForwarder ¶
func NewSocketIOForwarder() *SocketIOForwarder
func (*SocketIOForwarder) Broadcast ¶
func (s *SocketIOForwarder) Broadcast(topic EventTopic, payload interface{})
func (*SocketIOForwarder) RegisterHandlers ¶
func (s *SocketIOForwarder) RegisterHandlers(router *echo.Echo)