broker

package
v1.0.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackupManual                        = "backup_manual"
	RestoreManual                       = "restore_manual"
	ConfigUpdate                        = "update_config"
	ConfigRefresh                       = "refresh_config"
	AgentUpgrade                        = "agent_upgrade"
	ConfigUpdateActionAddPolicy         = "add_policy"
	ConfigUpdateActionDelPolicy         = "del_policy"
	ConfigUpdateActionUpdatePolicy      = "update_policy"
	ConfigUpdateActionActiveDirectory   = "active_directory"
	ConfigUpdateActionDeactiveDirectory = "deactive_directory"
	ConfigUpdateActionAddDirectory      = "add_directory"
	ConfigUpdateActionDelDirectory      = "del_directory"
	StatusNotify                        = "status_notify"
	StopAction                          = "stop_action"
	UpdateNumGoroutine                  = "update_num_goroutine"
)

Variables

View Source
var ErrUnknownEventType = errors.New("unknown event type")

ErrUnknownEventType is raised when receiving unhandled event from broker.

Functions

This section is empty.

Types

type Broker

type Broker interface {
	Connect() error
	ConnectAndSubscribe(subHandler Handler, subTopics []string) error
	Disconnect() error
	Publish(topic string, payload interface{}) error
	Subscribe(topics []string, h Handler) error
	String() string
}

Broker is the interface to perform async messaging.

type Event

type Event struct {
	Topic     string
	Payload   []byte
	Duplicate bool
	Qos       byte
	Retained  bool
	Ack       func()
}

Event is the event passed to Handler

type Handler

type Handler func(Event) error

Handler handles a message receive from a topic.

type Message

type Message struct {
	EventType string `json:"event_type"`
	MachineID string `json:"machine_id"`
	CreatedAt string `json:"created_at"`

	// For notify status
	Status string `json:"status"`

	// For performing backup/update cron/manual.
	BackupDirectory   string `json:"backup_directory"`
	BackupDirectoryID string `json:"backup_directory_id"`
	PolicyID          string `json:"policy_id"`
	Name              string `json:"name"`

	// For performing restore.
	SourceMachineID      string `json:"source_machine_id"`
	DestinationMachineID string `json:"dest_machine_id"`
	SourceDirectory      string `json:"source_directory"`
	DestinationDirectory string `json:"dest_directory"`
	RecoveryPointID      string `json:"recovery_point_id"`
	RestoreSessionKey    string `json:"restore_session_key"`
	ActionId             string `json:"action_id"`
	StorageVaultId       string `json:"storage_vault_id"`

	// For config update
	BackupDirectories []backupapi.BackupDirectoryConfig `json:"backup_directories"`
	Action            string                            `json:"action"`
	NumGoroutine      int                               `json:"num_goroutine"`
}

Message is the message event format.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL