Documentation ¶
Index ¶
- type Base
- type BaseLayer
- func (l *BaseLayer) IsNexusAnnounced(nexus nexusHelper.Nexus) bool
- func (l *BaseLayer) RegisterLayerEvent(fn OnLayerEventFn, layerName string)
- func (l *BaseLayer) RevokeNexus(belowNexus nexusHelper.Nexus)
- func (l *BaseLayer) SendLayerEvent(nexus nexusHelper.Nexus, status string)
- func (l *BaseLayer) SetOnAnnounce(o OnAnnounceFn)
- func (l *BaseLayer) SetOnLayerEvent(o OnLayerEventFn)
- func (l *BaseLayer) SetOnRevoke(o OnRevokeFn)
- func (l *BaseLayer) TrackNexus(nexus nexusHelper.Nexus, belowNexus nexusHelper.Nexus)
- func (l *BaseLayer) TrackNexusAnnounced(nexus nexusHelper.Nexus)
- func (l *BaseLayer) TrackNexusRevoked(nexus nexusHelper.Nexus)
- func (l *BaseLayer) UntrackNexus(nexus nexusHelper.Nexus, belowNexus nexusHelper.Nexus)
- type NexusMap
- type NexusStringMap
- type NexusUUIDMap
- type OnAnnounceFn
- type OnLayerEventFn
- type OnRevokeFn
- type UnknownNexus
- func (u UnknownNexus) GetDownwardNexusList() []nexus.Nexus
- func (u UnknownNexus) InitiateClose()
- func (u UnknownNexus) IsEqual(n nexus.Nexus) bool
- func (u UnknownNexus) Name() string
- func (u UnknownNexus) OnBinMessage(belowNexus nexus.Nexus, msg []byte)
- func (u UnknownNexus) OnMessage(belowNexus nexus.Nexus, msg base.MoneysocketMessage)
- func (u UnknownNexus) Send(msg base.MoneysocketMessage) error
- func (u UnknownNexus) SendBin(msg []byte) error
- func (u UnknownNexus) SetOnBinMessage(messageBinFunc nexus.OnBinMessage)
- func (u UnknownNexus) SetOnMessage(messageFunc nexus.OnMessage)
- func (u UnknownNexus) SharedSeed() *beacon.SharedSeed
- func (u UnknownNexus) UUID() uuid.UUID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶ added in v0.63.0
type Base interface { // SetOnLayerEvent set on layer event SetOnLayerEvent(o OnLayerEventFn) // SetOnAnnounce on announce event SetOnAnnounce(o OnAnnounceFn) // SetOnRevoke on revoke event SetOnRevoke(o OnAnnounceFn) // RegisterAboveLayer above layer events with current layer // must be done here since announce nexus // is not available form base layer RegisterAboveLayer(belowLayer Base) // RegisterLayerEvent layer event with nexuses RegisterLayerEvent(fn OnLayerEventFn, layerName string) // AnnounceNexus nexusHelper AnnounceNexus(belowNexus nexusHelper.Nexus) // TrackNexus nexusHelper events TrackNexus(nexus nexusHelper.Nexus, belowNexus nexusHelper.Nexus) // UntrackNexus remove's tracker from nexusHelper events UntrackNexus(nexus nexusHelper.Nexus, belowNexus nexusHelper.Nexus) // TrackNexusAnnounced tracks that a nexus has been announced TrackNexusAnnounced(nexus nexusHelper.Nexus) // IsNexusAnnounced checks wether or not a nexus has been announced IsNexusAnnounced(nexus nexusHelper.Nexus) bool // RevokeNexus revokes a nexus RevokeNexus(belowNexus nexusHelper.Nexus) }
Base is the base class for all layers.
type BaseLayer ¶
type BaseLayer struct { // LayerName is the name of the current layer this is // a string rather than a method call to make debugging easier LayerName string // OnLayerEvent is a nullable function to be called when a layer // event occurs OnLayerEvent OnLayerEventFn // OnAnnounce is called when a nexus is announced to the layer (from below) OnAnnounce OnAnnounceFn // OnRevoke is called when a nexus is revoked from the layer (from below) OnRevoke OnRevokeFn // Nexuses is a thread-safe map of Nexuses to their ids uuid[nexus] Nexuses NexusMap // Announced is a thread-safe map of Nexuses to their ids uuid[nexus] Announced NexusMap // BelowNexuses is a thread-safe map of BelowNexuses to their ids uuid[nexus] BelowNexuses NexusMap // NexusByBelow is a map of below nexuses by nexus[uuid] NexusByBelow NexusUUIDMap // BelowByNexus is a map of nexus->uuid BelowByNexus NexusUUIDMap }
BaseLayer is used as a superclass for layers.
func NewBaseLayer ¶
func NewBaseLayer() BaseLayer
NewBaseLayer creates a new base layer, note you still have to call register_above nexus.
func (*BaseLayer) IsNexusAnnounced ¶
func (l *BaseLayer) IsNexusAnnounced(nexus nexusHelper.Nexus) bool
IsNexusAnnounced determines wether or not a given nexus has been announced.
func (*BaseLayer) RegisterLayerEvent ¶
func (l *BaseLayer) RegisterLayerEvent(fn OnLayerEventFn, layerName string)
RegisterLayerEvent registers the layer event.
func (*BaseLayer) RevokeNexus ¶
func (l *BaseLayer) RevokeNexus(belowNexus nexusHelper.Nexus)
RevokeNexus removes the nexus from directories/layers.
func (*BaseLayer) SendLayerEvent ¶
func (l *BaseLayer) SendLayerEvent(nexus nexusHelper.Nexus, status string)
SendLayerEvent sends an event up the chain.
func (*BaseLayer) SetOnAnnounce ¶
func (l *BaseLayer) SetOnAnnounce(o OnAnnounceFn)
SetOnAnnounce sets an on announce function.
func (*BaseLayer) SetOnLayerEvent ¶
func (l *BaseLayer) SetOnLayerEvent(o OnLayerEventFn)
SetOnLayerEvent sets the layer event.
func (*BaseLayer) SetOnRevoke ¶
func (l *BaseLayer) SetOnRevoke(o OnRevokeFn)
SetOnRevoke sets the revoke callback.
func (*BaseLayer) TrackNexus ¶
func (l *BaseLayer) TrackNexus(nexus nexusHelper.Nexus, belowNexus nexusHelper.Nexus)
TrackNexus trackers the nexus.
func (*BaseLayer) TrackNexusAnnounced ¶
func (l *BaseLayer) TrackNexusAnnounced(nexus nexusHelper.Nexus)
TrackNexusAnnounced tracks the nexus.
func (*BaseLayer) TrackNexusRevoked ¶
func (l *BaseLayer) TrackNexusRevoked(nexus nexusHelper.Nexus)
TrackNexusRevoked tracks that a nexus has been revoked.
func (*BaseLayer) UntrackNexus ¶
func (l *BaseLayer) UntrackNexus(nexus nexusHelper.Nexus, belowNexus nexusHelper.Nexus)
UntrackNexus untracks the nexus.
type NexusMap ¶
type NexusMap struct {
// contains filtered or unexported fields
}
NexusMap that enforces types TODO this should get replaced with a string map.
type NexusStringMap ¶
type NexusStringMap struct {
// contains filtered or unexported fields
}
NexusStringMap is a nexus map that enforces types.
func (*NexusStringMap) Delete ¶
func (num *NexusStringMap) Delete(key string)
Delete an item from a map.
func (*NexusStringMap) Get ¶
func (num *NexusStringMap) Get(key string) (nexusHelper.Nexus, bool)
Get a nexus from the map, don't check for key presence.
func (*NexusStringMap) Range ¶
func (num *NexusStringMap) Range(f func(key string, value nexusHelper.Nexus) bool)
Range loops through a NexusStringMap.
func (*NexusStringMap) Store ¶
func (num *NexusStringMap) Store(key string, nexus nexusHelper.Nexus)
Store idempotently adds an item to map.
type NexusUUIDMap ¶ added in v0.54.0
type NexusUUIDMap struct {
// contains filtered or unexported fields
}
NexusUUIDMap is the nexus map that enforces types.
func (*NexusUUIDMap) Delete ¶ added in v0.54.0
func (num *NexusUUIDMap) Delete(nexusUUID uuid.UUID)
Delete an item from a map.
type OnAnnounceFn ¶
type OnAnnounceFn = func(nexus nexusHelper.Nexus)
OnAnnounceFn is the announce function for the nexus.
type OnLayerEventFn ¶
type OnLayerEventFn = func(layerName string, nexus nexusHelper.Nexus, event string)
OnLayerEventFn is a function downstream layers call on an event.
type OnRevokeFn ¶
type OnRevokeFn = func(nexus nexusHelper.Nexus)
OnRevokeFn is the revoke function for the nexus.
type UnknownNexus ¶
type UnknownNexus struct{}
UnknownNexus is a non-existent nexus that allows us to avoid returning a null value.
func (UnknownNexus) GetDownwardNexusList ¶
func (u UnknownNexus) GetDownwardNexusList() []nexus.Nexus
nolint
func (UnknownNexus) OnBinMessage ¶
func (u UnknownNexus) OnBinMessage(belowNexus nexus.Nexus, msg []byte)
nolint
func (UnknownNexus) OnMessage ¶
func (u UnknownNexus) OnMessage(belowNexus nexus.Nexus, msg base.MoneysocketMessage)
nolint
func (UnknownNexus) SetOnBinMessage ¶
func (u UnknownNexus) SetOnBinMessage(messageBinFunc nexus.OnBinMessage)
nolint
func (UnknownNexus) SetOnMessage ¶
func (u UnknownNexus) SetOnMessage(messageFunc nexus.OnMessage)
nolint