layer

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseLayer

type BaseLayer struct {
	LayerName    string
	OnLayerEvent OnLayerEventFn
	OnAnnounce   OnAnnounceFn
	OnRevoke     OnRevokeFn

	Nexuses      NexusMap
	Announced    NexusMap
	BelowNexuses NexusMap
	NexusByBelow NexusUuidMap
	BelowByNexus NexusUuidMap
}

func NewBaseLayer

func NewBaseLayer() BaseLayer

create a new base layer, note you still have to call register_above nexus

func (*BaseLayer) IsNexusAnnounced

func (l *BaseLayer) IsNexusAnnounced(nexus nexusHelper.Nexus) bool

func (*BaseLayer) RegisterLayerEvent

func (l *BaseLayer) RegisterLayerEvent(fn OnLayerEventFn, layerName string)

func (*BaseLayer) RevokeNexus

func (l *BaseLayer) RevokeNexus(belowNexus nexusHelper.Nexus)

func (*BaseLayer) SendLayerEvent

func (l *BaseLayer) SendLayerEvent(nexus nexusHelper.Nexus, status string)

func (*BaseLayer) SetOnAnnounce

func (l *BaseLayer) SetOnAnnounce(o OnAnnounceFn)

func (*BaseLayer) SetOnLayerEvent

func (l *BaseLayer) SetOnLayerEvent(o OnLayerEventFn)

func (*BaseLayer) SetOnRevoke

func (l *BaseLayer) SetOnRevoke(o OnRevokeFn)

func (*BaseLayer) TrackNexus

func (l *BaseLayer) TrackNexus(nexus nexusHelper.Nexus, belowNexus nexusHelper.Nexus)

func (*BaseLayer) TrackNexusAnnounced

func (l *BaseLayer) TrackNexusAnnounced(nexus nexusHelper.Nexus)

func (*BaseLayer) TrackNexusRevoked

func (l *BaseLayer) TrackNexusRevoked(nexus nexusHelper.Nexus)

func (*BaseLayer) UntrackNexus

func (l *BaseLayer) UntrackNexus(nexus nexusHelper.Nexus, belowNexus nexusHelper.Nexus)

type Layer

type Layer interface {
	// set on layer event
	SetOnLayerEvent(o OnLayerEventFn)
	// set on announce event
	SetOnAnnounce(o OnAnnounceFn)
	// set on revoke event
	SetOnRevoke(o OnAnnounceFn)
	// register above layer events with current layer
	// must be done here since announce nexus
	// is not available form base layer
	RegisterAboveLayer(belowLayer Layer)
	// register layer event with nexuses
	RegisterLayerEvent(fn OnLayerEventFn, layerName string)
	// announce nexusHelper
	AnnounceNexus(belowNexus nexusHelper.Nexus)
	// track nexusHelper events
	TrackNexus(nexus nexusHelper.Nexus, belowNexus nexusHelper.Nexus)
	// remove tracker from nexusHelper events
	UntrackNexus(nexus nexusHelper.Nexus, belowNexus nexusHelper.Nexus)
	// track that a nexus has been announced
	TrackNexusAnnounced(nexus nexusHelper.Nexus)
	// check wether or not a nexus has been announced
	IsNexusAnnounced(nexus nexusHelper.Nexus) bool
	// revoke a nexus
	RevokeNexus(belowNexus nexusHelper.Nexus)
}

type NexusMap

type NexusMap struct {
	// contains filtered or unexported fields
}

nexus map that enforces TODO this should get replaced with a string map

func (*NexusMap) Delete

func (nm *NexusMap) Delete(nexusUuid uuid.UUID)

delete an item from a map

func (*NexusMap) Get

func (nm *NexusMap) Get(nexusUuid uuid.UUID) (nexusHelper.Nexus, bool)

get a nexus from the map, don't check for key presence

func (*NexusMap) Range

func (nm *NexusMap) Range(f func(key uuid.UUID, nexus nexusHelper.Nexus) bool)

func (*NexusMap) Store

func (nm *NexusMap) Store(nexusUuid uuid.UUID, nexus nexusHelper.Nexus)

idempotently add an idea to map

type NexusStringMap

type NexusStringMap struct {
	// contains filtered or unexported fields
}

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)

func (*NexusStringMap) Store

func (num *NexusStringMap) Store(key string, nexus nexusHelper.Nexus)

idempotently add an idea to map

type NexusUuidMap

type NexusUuidMap struct {
	// contains filtered or unexported fields
}

nexus map that enforces types

func (*NexusUuidMap) Delete

func (num *NexusUuidMap) Delete(nexusUuid uuid.UUID)

delete an item from a map

func (*NexusUuidMap) Get

func (num *NexusUuidMap) Get(nexusUuid uuid.UUID) (uuid.UUID, bool)

get a nexus from the map, don't check for key presence

func (*NexusUuidMap) Range

func (num *NexusUuidMap) Range(f func(key uuid.UUID, value uuid.UUID) bool)

func (*NexusUuidMap) Store

func (num *NexusUuidMap) Store(nexusUuid uuid.UUID, nexus uuid.UUID)

idempotently add an idea to map

type OnAnnounceFn

type OnAnnounceFn = func(nexus nexusHelper.Nexus)

type OnLayerEventFn

type OnLayerEventFn = func(layerName string, nexus nexusHelper.Nexus, event string)

type OnRevokeFn

type OnRevokeFn = func(nexus nexusHelper.Nexus)

type UnknownNexus

type UnknownNexus struct{}

a non-existent nexus that allows us to avoid returning a null value

func NewUnknownNexus

func NewUnknownNexus() UnknownNexus

func (UnknownNexus) GetDownwardNexusList

func (u UnknownNexus) GetDownwardNexusList() []nexus.Nexus

func (UnknownNexus) InitiateClose

func (u UnknownNexus) InitiateClose()

func (UnknownNexus) IsEqual

func (u UnknownNexus) IsEqual(n nexus.Nexus) bool

func (UnknownNexus) Name

func (u UnknownNexus) Name() string

func (UnknownNexus) OnBinMessage

func (u UnknownNexus) OnBinMessage(belowNexus nexus.Nexus, msg []byte)

func (UnknownNexus) OnMessage

func (u UnknownNexus) OnMessage(belowNexus nexus.Nexus, msg base.MoneysocketMessage)

func (UnknownNexus) Send

func (UnknownNexus) SendBin

func (u UnknownNexus) SendBin(msg []byte) error

func (UnknownNexus) SetOnBinMessage

func (u UnknownNexus) SetOnBinMessage(messageBinFunc nexus.OnBinMessage)

func (UnknownNexus) SetOnMessage

func (u UnknownNexus) SetOnMessage(messageFunc nexus.OnMessage)

func (UnknownNexus) SharedSeed

func (u UnknownNexus) SharedSeed() *beacon.SharedSeed

func (UnknownNexus) Uuid

func (u UnknownNexus) Uuid() uuid.UUID

TODO disable

Directories

Path Synopsis
provides interfaces for nexuses imported by a lyer to avoid circular imports
provides interfaces for nexuses imported by a lyer to avoid circular imports

Jump to

Keyboard shortcuts

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