MCPcopy Index your code
hub / github.com/autom8ter/dagger

github.com/autom8ter/dagger @v3.1.6

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.1.6 ↗ · + Follow
126 symbols 313 edges 2 files 103 documented · 82%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

dagger

import "github.com/autom8ter/dagger/v3"

Package dagger is a collection of generic, concurrency safe datastructures including a Directed Acyclic Graph and others. Datastructures are implemented using generics in Go 1.18.

Supported Datastructures:

DAG: thread safe directed acyclic graph

Queue: unbounded thread safe fifo queue

Stack: unbounded thread safe lifo stack

BoundedQueue: bounded thread safe fifo queue with a fixed capacity

PriorityQueue: thread safe priority queue

HashMap: thread safe hashmap

Set: thread safe set

ChannelGroup: thread safe group of channels for broadcasting 1 value to N channels

MultiContext: thread safe context for coordinating the cancellation of multiple contexts

Borrower: thread safe object ownership manager

Index

func UniqueID

func UniqueID(prefix string) string

UniqueID returns a unique identifier with the given prefix

type BoundedQueue

BoundedQueue is a basic FIFO BoundedQueue based on a buffered channel

type BoundedQueue[T any] struct {
    // contains filtered or unexported fields
}

func NewBoundedQueue

func NewBoundedQueue[T any](maxSize int) *BoundedQueue[T]

NewBoundedQueue returns a new BoundedQueue with the given max size. When the max size is reached, the queue will block until a value is removed. If maxSize is 0, the queue will always block until a value is removed. The BoundedQueue is concurrent-safe.

func (*BoundedQueue[T]) Close

func (q *BoundedQueue[T]) Close()

Close closes the BoundedQueue channel.

func (*BoundedQueue[T]) Len

func (q *BoundedQueue[T]) Len() int

Len returns the number of elements in the BoundedQueue.

func (*BoundedQueue[T]) Pop

func (q *BoundedQueue[T]) Pop() (T, bool)

Pop removes and returns an element from the beginning of the BoundedQueue.

func (*BoundedQueue[T]) PopContext

func (q *BoundedQueue[T]) PopContext(ctx context.Context) (T, bool)

PopContext removes and returns an element from the beginning of the BoundedQueue. If no element is available, it will block until an element is available or the context is cancelled.

func (*BoundedQueue[T]) Push

func (q *BoundedQueue[T]) Push(val T) bool

Push adds an element to the end of the BoundedQueue and returns a channel that will block until the element is added. If the queue is full, it will block until an element is removed.

func (*BoundedQueue[T]) PushContext

func (q *BoundedQueue[T]) PushContext(ctx context.Context, val T) bool

PushContext adds an element to the end of the BoundedQueue and returns a channel that will block until the element is added. If the queue is full, it will block until an element is removed or the context is cancelled.

func (*BoundedQueue[T]) Range

func (q *BoundedQueue[T]) Range(fn func(element T) bool)

Range executes a provided function once for each BoundedQueue element until it returns false.

func (*BoundedQueue[T]) RangeContext

func (q *BoundedQueue[T]) RangeContext(ctx context.Context, fn func(element T) bool)

RangeContext executes a provided function once for each BoundedQueue element until it returns false or a value is sent to the done channel. Use this function when you want to continuously process items from the queue until a done signal is received.

type DAG

DAG is a concurrency safe, mutable, in-memory directed graph

type DAG[T Node] struct {
    // contains filtered or unexported fields
}

func NewDAG

func NewDAG[T Node](opts ...DagOpt) (*DAG[T], error)

NewDAG creates a new Directed Acyclic Graph instance

func (*DAG[T]) Acyclic

func (g *DAG[T]) Acyclic() bool

Acyclic returns true if the graph contains no cycles.

func (*DAG[T]) BFS

func (g *DAG[T]) BFS(ctx context.Context, reverse bool, start *GraphNode[T], search GraphSearchFunc[T]) error

BFS executes a depth first search on the graph starting from the current node. The reverse parameter determines whether the search is reversed or not. The fn parameter is a function that is called on each node in the graph. If the function returns false, the search is stopped.

func (*DAG[T]) DFS

func (g *DAG[T]) DFS(ctx context.Context, reverse bool, start *GraphNode[T], fn GraphSearchFunc[T]) error

DFS executes a depth first search on the graph starting from the curre

Extension points exported contracts — how you extend this code

Node (Interface)
Node is a node in the graph. It can be connected to other nodes via edges. [1 implementers]
dagger.go
DagOpt (FuncType)
DagOpt is an option for configuring a DAG
dagger.go
GraphSearchFunc (FuncType)
GraphSearchFunc is a function that is called on each node in the graph during a search
dagger.go

Core symbols most depended-on inside this repo

ID
called by 52
dagger.go
Range
called by 28
dagger.go
SetNode
called by 26
dagger.go
Len
called by 26
dagger.go
SetEdge
called by 12
dagger.go
To
called by 10
dagger.go
From
called by 9
dagger.go
Add
called by 9
dagger.go

Shape

Method 91
Function 17
Struct 15
FuncType 2
Interface 1

Languages

Go100%

Modules by API surface

dagger.go114 symbols
dagger_test.go12 symbols

For agents

$ claude mcp add dagger \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page