ftl_orchestrator

package
v0.0.0-...-ad8d7c7 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeIntro     = 0
	TypeOutro     = 1
	TypeNodeState = 2
	// 3 - 15 	Reserved 	Reserved for future use (server state messaging)
	TypeChannelSubscription = 16
	TypeStreamPublishing    = 17
	TypeStreamRelaying      = 20
)

Message Types

Variables

This section is empty.

Functions

This section is empty.

Types

type Callbacks

type Callbacks struct {
	OnIntro               func(message IntroMessage)
	OnOutro               func(message OutroMessage)
	OnNodeState           func(message NodeStateMessage)
	OnChannelSubscription func(message ChannelSubscriptionMessage)
	OnStreamPublishing    func(message StreamPublishingMessage)
	OnStreamRelaying      func(message StreamRelayingMessage)
}

type ChannelSubscriptionMessage

type ChannelSubscriptionMessage struct {
	Context   uint8
	ChannelID types.ChannelID
	StreamKey string
}

ChannelSubscriptionMessage Indicates whether streams for a given channel should be relayed to this node.

func DecodeChannelSubscriptionMessage

func DecodeChannelSubscriptionMessage(buf []byte) ChannelSubscriptionMessage

func (*ChannelSubscriptionMessage) Encode

func (im *ChannelSubscriptionMessage) Encode() []byte

type Client

type Client struct {
	ClientHostname string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config Config) *Client

func (*Client) Close

func (client *Client) Close() error

func (*Client) Connect

func (client *Client) Connect() error

func (*Client) Name

func (client *Client) Name() string

func (*Client) SetLogger

func (client *Client) SetLogger(log logrus.FieldLogger)

func (Client) StartStream

func (client Client) StartStream(channelID types.ChannelID, streamID types.StreamID) error

func (Client) StopStream

func (client Client) StopStream(channelID types.ChannelID, streamID types.StreamID) error

type Config

type Config struct {
	// Address of the remote orchestrator ip:port format
	Address string
	// RegionCode we are representing
	RegionCode string
	// Hostname for ourselves, so edges know how to reach us
	Hostname string
	// Handler for callbacks
	Callbacks Callbacks
}

type IntroMessage

type IntroMessage struct {
	VersionMajor    uint8
	VersionMinor    uint8
	VersionRevision uint8
	RelayLayer      uint8
	RegionCode      string
	Hostname        string
}

IntroMessage Sent on connect with identifying information.

func DecodeIntroMessage

func DecodeIntroMessage(buf []byte) IntroMessage

func (*IntroMessage) Encode

func (im *IntroMessage) Encode() []byte

type MessageHeader

type MessageHeader struct {
	// Request Serializes from Request / Response
	Request bool
	// Success Serializes from Success / Failure
	Success       bool
	Type          uint8
	ID            uint8
	PayloadLength uint16
}

MessageHeader |- 32 bit / 4 byte -| +---------------------------------------------------------------+ | Msg Desc (8) | Msg Id (8) | Payload Length (16) | +---------------------------------------------------------------+

func DecodeMessageHeader

func DecodeMessageHeader(buf []byte) *MessageHeader

func (MessageHeader) Encode

func (msg MessageHeader) Encode() []byte

type NodeStateMessage

type NodeStateMessage struct {
	CurrentLoad uint32
	MaximumLoad uint32
}

NodeStateMessage Sent periodically by nodes to indicate their current state.

func DecodeNodeStateMessage

func DecodeNodeStateMessage(buf []byte) NodeStateMessage

func (*NodeStateMessage) Encode

func (im *NodeStateMessage) Encode() []byte

type OutroMessage

type OutroMessage struct {
	Reason string
}

OutroMessage Sent on disconnect with information on the reason for disconnect.

func DecodeOutroMessage

func DecodeOutroMessage(buf []byte) OutroMessage

func (*OutroMessage) Encode

func (im *OutroMessage) Encode() []byte

type StreamPublishingMessage

type StreamPublishingMessage struct {
	Context   uint8
	ChannelID types.ChannelID
	StreamID  types.StreamID
}

StreamPublishingMessage Indicates that a new stream is now available (or unavailable) from this connection.

func DecodeStreamPublishingMessage

func DecodeStreamPublishingMessage(buf []byte) StreamPublishingMessage

func (*StreamPublishingMessage) Encode

func (im *StreamPublishingMessage) Encode() []byte

type StreamRelayingMessage

type StreamRelayingMessage struct {
	Context        uint8
	ChannelID      types.ChannelID
	StreamID       types.StreamID
	TargetHostname string
	StreamKey      []byte
}

StreamRelayingMessage Contains information used for relaying streams between nodes.

func DecodeStreamRelayingMessage

func DecodeStreamRelayingMessage(buf []byte) StreamRelayingMessage

func (*StreamRelayingMessage) Encode

func (im *StreamRelayingMessage) Encode() []byte

Jump to

Keyboard shortcuts

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