graph

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer[K any] interface {
	Consume(ctx context.Context, input <-chan K) error
}

type Context

type Context interface {
	context.Context
	Initialized()
}

type DefaultIOWorkerVertex

type DefaultIOWorkerVertex[K any] struct {
	IOWorker[K]
	// contains filtered or unexported fields
}

func NewDefaultIOWorkerVertex

func NewDefaultIOWorkerVertex[K any](name string, parents []string, decorated IOWorker[K]) *DefaultIOWorkerVertex[K]

func (*DefaultIOWorkerVertex[K]) GetName

func (dwv *DefaultIOWorkerVertex[K]) GetName() string

func (*DefaultIOWorkerVertex[K]) GetParents

func (dwv *DefaultIOWorkerVertex[K]) GetParents() []string

type IOGraph

type IOGraph[K any] struct {
	graph.Graph[string, IOWorkerVertex[K]]
}

func New

func New[K any](opt ...IOGraphOption[K]) *IOGraph[K]

func (*IOGraph[K]) AddIOWorkerVertex

func (sg *IOGraph[K]) AddIOWorkerVertex(vertices iter.Seq[IOWorkerVertex[K]]) error

func (*IOGraph[K]) AdjancyVertices

func (sg *IOGraph[K]) AdjancyVertices() (map[string]map[string]IOWorkerVertex[K], error)

func (*IOGraph[K]) DrawGraph

func (sg *IOGraph[K]) DrawGraph(filepath string) error

func (*IOGraph[K]) IterChildlessVertex

func (sg *IOGraph[K]) IterChildlessVertex() iter.Seq[IOWorker[K]]

func (*IOGraph[K]) IterParentlessVertex

func (sg *IOGraph[K]) IterParentlessVertex() iter.Seq[IOWorker[K]]

func (*IOGraph[K]) MergeVertexOutput

func (sg *IOGraph[K]) MergeVertexOutput(vertices iter.Seq[IOWorker[K]]) <-chan K

func (*IOGraph[K]) NeighborVertices

func (sg *IOGraph[K]) NeighborVertices(orientedNeighborSearch func() (map[string]map[string]graph.Edge[string], error)) (map[string]map[string]IOWorkerVertex[K], error)

func (*IOGraph[K]) PredecessorVertices

func (sg *IOGraph[K]) PredecessorVertices() (map[string]map[string]IOWorkerVertex[K], error)

func (*IOGraph[K]) Run

func (sg *IOGraph[K]) Run(ctx context.Context) <-chan error

type IOGraphOption

type IOGraphOption[K any] func(*IOGraph[K])

func WithIOWorkerVertexIterator

func WithIOWorkerVertexIterator[K any](it iter.Seq[IOWorkerVertex[K]]) IOGraphOption[K]

type IOWorker

type IOWorker[K any] interface {
	Run(ctx SyncContext) <-chan error
	SetInput(input <-chan K)
	Output() <-chan K
}

func NewIOWorkerFromConsumer

func NewIOWorkerFromConsumer[K any](consumer Consumer[K]) IOWorker[K]

func NewIOWorkerFromProducer

func NewIOWorkerFromProducer[K any](producer Producer[K]) IOWorker[K]

func NewIOWorkerFromRunner

func NewIOWorkerFromRunner[K any](runner Runner[K]) IOWorker[K]

func NewIOWorkerFromWorker

func NewIOWorkerFromWorker[K any](worker Worker[K]) IOWorker[K]

type IOWorkerVertex

type IOWorkerVertex[K any] interface {
	IOWorker[K]
	GetName() string
	GetParents() []string
}

type Producer

type Producer[K any] interface {
	Produce(ctx context.Context, yield func(elem K) error) error
}

type Runner

type Runner[K any] interface {
	Run(ctx context.Context, input <-chan K, yield func(elem K) error) error
}

type SyncContext

type SyncContext interface {
	Context
	Initializing()
	Synchronize()
}

func NewContext

func NewContext(parent context.Context) SyncContext

type WaitGroupContext

type WaitGroupContext struct {
	context.Context
	// contains filtered or unexported fields
}

func (*WaitGroupContext) Initialized

func (c *WaitGroupContext) Initialized()

func (*WaitGroupContext) Initializing

func (c *WaitGroupContext) Initializing()

func (*WaitGroupContext) Synchronize

func (c *WaitGroupContext) Synchronize()

type Worker

type Worker[K any] interface {
	Work(ctx context.Context, input K, yield func(elem K) error) error
}

Jump to

Keyboard shortcuts

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