Documentation ¶
Index ¶
- Constants
- Variables
- func CreateFullHorusPacket(horus *HorusPacket, srcIP net.IP, dstIP net.IP) ([]byte, error)
- func InitHorusDefinitions()
- func NewCentralSrvServer(topology *model.Topology, vcm *core.VCManager, ...) *centralSrvServer
- func NewLeafSrvServer(topology *model.Topology, vcm *core.VCManager, ...) *leafSrvServer
- func NewManagerSrvServer(failedLeaves chan *LeafFailedMessage, newLeaves chan *LeafAddedMessage) *managerSrvServer
- func NewSpineSrvServer(topology *model.Topology, vcm *core.VCManager, ...) *spineSrvServer
- func TestHorusPkt(pkt_type byte, pool_id uint16, src_id uint16, dst_id uint16, task_id uint16, ...)
- type CentralRpcEndpoint
- type HorusPacket
- func (horus *HorusPacket) CanDecode() gopacket.LayerClass
- func (horus *HorusPacket) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (horus *HorusPacket) LayerPayload() []byte
- func (horus *HorusPacket) LayerType() gopacket.LayerType
- func (horus *HorusPacket) NextLayerType() gopacket.LayerType
- func (horus *HorusPacket) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type LeafAddedMessage
- type LeafFailedMessage
- type LeafRpcEndpoint
- func (s *LeafRpcEndpoint) GetTopology() (*horus_pb.TopoInfo, error)
- func (s *LeafRpcEndpoint) GetVCs() ([]*horus_pb.VCInfo, error)
- func (s *LeafRpcEndpoint) SetLocalAddress(address string)
- func (s *LeafRpcEndpoint) SetTopology(topology *model.Topology)
- func (s *LeafRpcEndpoint) SetVCManager(vcm *core.VCManager)
- func (s *LeafRpcEndpoint) Start()
- func (s *LeafRpcEndpoint) StartClient()
- func (s *LeafRpcEndpoint) StartServer()
- type LeafUpdatedMessage
- type LocalSock
- type ManagerRpcEndpoint
- type PortDisabledMessage
- type PortEnabledMessage
- type RawSockClient
- type ServerAddedMessage
- type ServerFailedMessage
- type SpineRpcEndpoint
- type SpineRpcEndpointLite
- type UnixSockClient
- type VCUpdateType
- type VCUpdatedMessage
Constants ¶
const ( // Default port HORUS_UDP_PORT layers.UDPPort = 1234 // Pkt types PKT_TYPE_IDLE_SIGNAL byte = 0x06 PKT_TYPE_IDLE_REMOVE byte = 0x0A PKT_TYPE_KEEP_ALIVE byte = 0x0B PKT_TYPE_WORKER_ID byte = 0x0C PKT_TYPE_WORKER_ID_ACK byte = 0x0D // Dst types DST_TYPE_LEAF uint16 = 0x0001 DST_TYPE_SPINE uint16 = 0x0002 )
const DefaultRpcRecvSize = 1000
const DefaultRpcSendSize = 1000
const DefaultUnixSockRecvSize = 1000
const DefaultUnixSockSendSize = 1000
const MaximumConnectionTrialCount = 10
Variables ¶
var LayerTypeHorus = gopacket.RegisterLayerType( 2001, gopacket.LayerTypeMetadata{ Name: "Horus", Decoder: gopacket.DecodeFunc(decodeHorus), }, )
Register the layer type so we can use it The first argument is an ID. Use negative or 2000+ for custom layers. It must be unique
Functions ¶
func CreateFullHorusPacket ¶
func InitHorusDefinitions ¶
func InitHorusDefinitions()
func NewCentralSrvServer ¶
func NewCentralSrvServer(topology *model.Topology, vcm *core.VCManager, failedLeaves chan *LeafFailedMessage, failedServers chan *ServerFailedMessage, newLeaves chan *LeafAddedMessage, newServers chan *ServerAddedMessage, newVCs chan *VCUpdatedMessage, enabledPorts chan *PortEnabledMessage, disabledPorts chan *PortDisabledMessage, ) *centralSrvServer
func NewLeafSrvServer ¶
func NewLeafSrvServer(topology *model.Topology, vcm *core.VCManager, updatedServers chan *core.LeafHealthMsg, newServers chan *ServerAddedMessage, newVCs chan *VCUpdatedMessage, ) *leafSrvServer
func NewManagerSrvServer ¶
func NewManagerSrvServer( failedLeaves chan *LeafFailedMessage, newLeaves chan *LeafAddedMessage, ) *managerSrvServer
func NewSpineSrvServer ¶
func NewSpineSrvServer(topology *model.Topology, vcm *core.VCManager, failedLeavesToRPC chan *LeafFailedMessage, updatedLeavesToRPC chan *LeafUpdatedMessage, failedServersToRPC chan *ServerFailedMessage, newLeavesToRPC chan *LeafAddedMessage, newServers chan *ServerAddedMessage, newVCs chan *VCUpdatedMessage, ) *spineSrvServer
Types ¶
type CentralRpcEndpoint ¶
type CentralRpcEndpoint struct {
// contains filtered or unexported fields
}
func NewCentralRpcEndpoint ¶
func NewCentralRpcEndpoint(srvLAddr string, topology *model.Topology, vcm *core.VCManager, enabledPorts chan *PortEnabledMessage, disabledPorts chan *PortDisabledMessage, ) *CentralRpcEndpoint
func (*CentralRpcEndpoint) Start ¶
func (s *CentralRpcEndpoint) Start()
type HorusPacket ¶
type HorusPacket struct { layers.BaseLayer PktType byte ClusterID uint16 SrcID uint16 DstID uint16 QLen uint16 SeqNum uint16 // fields below are sample app layer headers: not needed for task scheduling and not parsed by switches RestOfData []byte }
Horus Create custom layer structure
func (*HorusPacket) CanDecode ¶
func (horus *HorusPacket) CanDecode() gopacket.LayerClass
func (*HorusPacket) DecodeFromBytes ¶
func (horus *HorusPacket) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
Custom decode function. We can name it whatever we want but it should have the same arguments and return value When the layer is registered we tell it to use this decode function
func (*HorusPacket) LayerPayload ¶
func (horus *HorusPacket) LayerPayload() []byte
LayerPayload returns the subsequent layer built on top of our layer or raw payload
func (*HorusPacket) LayerType ¶
func (horus *HorusPacket) LayerType() gopacket.LayerType
When we inquire about the type, what type of layer should we say it is? We want it to return our custom layer type
func (*HorusPacket) NextLayerType ¶
func (horus *HorusPacket) NextLayerType() gopacket.LayerType
func (*HorusPacket) SerializeTo ¶
func (horus *HorusPacket) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.
type LeafAddedMessage ¶
func NewLeafAddedMessage ¶
func NewLeafAddedMessage(leaf *horus_pb.LeafInfo, dst *model.Node) *LeafAddedMessage
type LeafFailedMessage ¶
func NewLeafFailedMessage ¶
func NewLeafFailedMessage(leaf *horus_pb.LeafInfo, dsts []*model.Node) *LeafFailedMessage
type LeafRpcEndpoint ¶
type LeafRpcEndpoint struct { sync.RWMutex SrvCentralAddr string SrvLAddr string DoneChan chan bool // contains filtered or unexported fields }
func NewBareLeafRpcEndpoint ¶
func NewBareLeafRpcEndpoint(ctrlID uint16, srvCentralAddr string, updatedServers chan *core.LeafHealthMsg, newServers chan *ServerAddedMessage, newVCs chan *VCUpdatedMessage, ) *LeafRpcEndpoint
func NewLeafRpcEndpoint ¶
func NewLeafRpcEndpoint(srvLAddr, srvCentralAddr string, topology *model.Topology, vcm *core.VCManager, updatedServers chan *core.LeafHealthMsg, newServers chan *ServerAddedMessage, newVCs chan *VCUpdatedMessage, ) *LeafRpcEndpoint
func (*LeafRpcEndpoint) GetTopology ¶
func (s *LeafRpcEndpoint) GetTopology() (*horus_pb.TopoInfo, error)
func (*LeafRpcEndpoint) SetLocalAddress ¶
func (s *LeafRpcEndpoint) SetLocalAddress(address string)
func (*LeafRpcEndpoint) SetTopology ¶
func (s *LeafRpcEndpoint) SetTopology(topology *model.Topology)
func (*LeafRpcEndpoint) SetVCManager ¶
func (s *LeafRpcEndpoint) SetVCManager(vcm *core.VCManager)
func (*LeafRpcEndpoint) Start ¶
func (s *LeafRpcEndpoint) Start()
func (*LeafRpcEndpoint) StartClient ¶
func (s *LeafRpcEndpoint) StartClient()
func (*LeafRpcEndpoint) StartServer ¶
func (s *LeafRpcEndpoint) StartServer()
type LeafUpdatedMessage ¶
func NewLeafUpdatedMessage ¶
func NewLeafUpdatedMessage(leaves []*model.Node) *LeafUpdatedMessage
type ManagerRpcEndpoint ¶
func NewManagerRpcEndpoint ¶
func NewManagerRpcEndpoint(srvLAddress string, failedLeaves chan *LeafFailedMessage, newLeaves chan *LeafAddedMessage, ) *ManagerRpcEndpoint
func (*ManagerRpcEndpoint) Start ¶
func (s *ManagerRpcEndpoint) Start()
type PortDisabledMessage ¶
type PortEnabledMessage ¶
type RawSockClient ¶
type RawSockClient struct {
// contains filtered or unexported fields
}
func NewRawSockClient ¶
func NewRawSockClient(ifName string, sendChan chan []byte, recvChan chan []byte) *RawSockClient
func (*RawSockClient) Close ¶
func (rsc *RawSockClient) Close() error
func (*RawSockClient) Connect ¶
func (rsc *RawSockClient) Connect() error
func (*RawSockClient) Start ¶
func (rsc *RawSockClient) Start()
type ServerAddedMessage ¶
type ServerAddedMessage struct { Server *horus_pb.ServerInfo Dst *model.Node }
func NewServerAddedMessage ¶
func NewServerAddedMessage(server *horus_pb.ServerInfo, dst *model.Node) *ServerAddedMessage
type ServerFailedMessage ¶
type ServerFailedMessage struct { Server *horus_pb.ServerInfo Dsts []*model.Node }
func NewServerFailedMessage ¶
func NewServerFailedMessage(server *horus_pb.ServerInfo, dsts []*model.Node) *ServerFailedMessage
type SpineRpcEndpoint ¶
type SpineRpcEndpoint struct { sync.RWMutex SrvLAddr string SrvCentralAddr string // contains filtered or unexported fields }
func NewSpineRpcEndpoint ¶
func NewSpineRpcEndpoint(srvLAddr, srvCentralAddr string, topology *model.Topology, vcm *core.VCManager, failedLeaves chan *LeafFailedMessage, failedServers chan *ServerFailedMessage, newLeaves chan *LeafAddedMessage, newServers chan *ServerAddedMessage, newVCs chan *VCUpdatedMessage, ) *SpineRpcEndpoint
func (*SpineRpcEndpoint) Start ¶
func (s *SpineRpcEndpoint) Start()
type SpineRpcEndpointLite ¶
func NewSpineRpcEndpointLite ¶
func NewSpineRpcEndpointLite(srvCentralAddr string) *SpineRpcEndpointLite
func (*SpineRpcEndpointLite) GetTopology ¶
func (s *SpineRpcEndpointLite) GetTopology() (*horus_pb.TopoInfo, error)
type UnixSockClient ¶
type UnixSockClient struct {
// contains filtered or unexported fields
}
func NewUnixSockClient ¶
func NewUnixSockClient(sockName string, sendChan chan []byte, recvChan chan []byte) *UnixSockClient
func (*UnixSockClient) Close ¶
func (usc *UnixSockClient) Close() error
func (*UnixSockClient) Connect ¶
func (usc *UnixSockClient) Connect() error
func (*UnixSockClient) Start ¶
func (usc *UnixSockClient) Start()
type VCUpdatedMessage ¶
type VCUpdatedMessage struct { VCInfo *horus_pb.VCInfo Dsts []*model.Node Type VCUpdateType }
func NewVCUpdatedMessage ¶
func NewVCUpdatedMessage(vcInfo *horus_pb.VCInfo, vcType VCUpdateType, dsts []*model.Node) *VCUpdatedMessage