Documentation ¶
Index ¶
- Variables
- func CopySpan(span *model.Span) (*model.Span, error)
- type SpanTree
- func (tree *SpanTree) Add(newSpan *model.Span, parentId model.SpanID)
- func (tree *SpanTree) AddTree(childTree *SpanTree, parentId model.SpanID)
- func (tree *SpanTree) Children(id model.SpanID) map[model.SpanID]struct{}
- func (tree *SpanTree) Clone() (*SpanTree, error)
- func (tree *SpanTree) Delete(spanId model.SpanID)
- func (tree *SpanTree) GetSpans() []*model.Span
- func (tree *SpanTree) Move(movedSpanId model.SpanID, newParentId model.SpanID)
- func (tree *SpanTree) SetRoot(id model.SpanID) error
- func (tree *SpanTree) Span(id model.SpanID) *model.Span
- func (tree *SpanTree) Visit(visitor TreeVisitor)
- type TreeVisitor
Constants ¶
This section is empty.
Variables ¶
var ErrRootDoesNotExist = fmt.Errorf("SetRoot can only be used on nodes in the tree")
Functions ¶
Types ¶
type SpanTree ¶
func NewSpanTree ¶
func (*SpanTree) Add ¶
Adds a span as a child of another.
parentId must not be exited yet (and may or may not be entered).
func (*SpanTree) AddTree ¶
Adds all spans in a tree as a subtree in this span.
TODO FIXME: when the two trees have overlapping span IDs, this does not work correctly.
func (*SpanTree) Delete ¶
Deletes a span entirely from the tree.
All remaining children also get deleted from the list of spans. Can only be called when entering/exiting spanId or entering its parents (i.e. deleting descendents). Cannot be used to delete the root span. TreeVisitor.Exit will not be called if Delete is called during enter.
func (*SpanTree) Move ¶
Moves a span from one span to another.
movedSpan must not be entered yet. newParent must not be exited yet (and may or may not be entered).
func (*SpanTree) SetRoot ¶
Sets the root to a span under the current root, and prunes other spans not under the new root.
func (*SpanTree) Visit ¶
func (tree *SpanTree) Visit(visitor TreeVisitor)
type TreeVisitor ¶
type TreeVisitor interface { // Called before entering the descendents of the span. // // This method may call tree.Add, tree.Move and tree.Delete // with the ancestors of span, span itself and its descendents. Enter(tree *SpanTree, span *model.Span) TreeVisitor // Called after exiting the descendents of the span. Exit(tree *SpanTree, span *model.Span) }