Documentation ¶
Index ¶
- type BaseNode
- func (node *BaseNode) AddChild(child Node)
- func (node *BaseNode) GetChildren() map[Node]struct{}
- func (node *BaseNode) GetID() string
- func (node *BaseNode) GetName() string
- func (node *BaseNode) HasChild(child Node) bool
- func (node *BaseNode) RemoveChild(child Node)
- func (node *BaseNode) Send(bytes []byte)
- func (node *BaseNode) ToJSON() ([]byte, error)
- type MongoNode
- type Node
- type Tree
- type WebsocketNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoNode ¶
func CreateMongoNode ¶
type Tree ¶
Tree is a flat structure that contains a map of nodes. The individual nodes are responsible for keeping track of their children.
func (*Tree) GetNodeByNameOrID ¶
GetNodeByNameOrID returns node and if found. When searching by ID, the algorithm has O(1) time complexity. When searching by name, the algorithm has O(n) time complexity.
func (*Tree) IsNotEmpty ¶
IsNotEmpty checks if the tree contains at least one node.
func (*Tree) RemoveNode ¶
RemoveNode removes a node from the tree. This can be done concurrently.
func (*Tree) ToJSON ¶
ToJSON converts the tree to sendable bytes. This is necessary as each node in the tree must also having its own ToJSON function that converts each child node of a particular node into an ID. This ID can then be used by the tree to lookup a particular node when sent to the client as JSON.
type WebsocketNode ¶
func CreateWebsocketNode ¶
func CreateWebsocketNode(url string, ctx context.Context) *WebsocketNode
func (*WebsocketNode) Receive ¶
func (node *WebsocketNode) Receive(bytes []byte) error