graph

package
v0.0.0-...-da789b0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertProto

func ConvertProto(p *gen.Project) *protoProject[*gen.Node, *gen.Edge]

TODO breadchris figure out how to make this generic

func MessageFromTypes

func MessageFromTypes(name string, types []protoreflect.MessageDescriptor) (*desc.MessageDescriptor, error)

TODO breadchris if there is only one field, set name of message to just the name of the one field. this is canonical in grpc

Types

type DependencyProvider

type DependencyProvider map[string]Node

type Edge

type Edge interface {
	ID() string
	From() string
	To() string
	Connect(from, to Node) error
}

type IO

type IO struct {
	Observable rxgo.Observable
	Cleanup    func()
}

type IOFunc

type IOFunc func(ctx context.Context, input IO) (IO, error)

type Info

type Info struct {
	Method *grpc.MethodDescriptor
}

func NewInfoFromType

func NewInfoFromType(name string, msg protoreflect.ProtoMessage) (*Info, error)

func (*Info) BuildProto

func (s *Info) BuildProto() (string, error)

type Listener

type Listener interface {
	GetNode() Node
	Transform(ctx context.Context, input *IO) (*IO, error)
}

TODO breadchris better name?

type Node

type Node interface {
	ID() string
	Name() string
	NormalizedName() string
	// TODO breadchris type should probably just return a message descriptor
	Type() (*Info, error)

	Provide() ([]*gen.Node, error)

	// Provider returns the node that this node depends on. (eg. a grpc method node will return the service node)
	Provider() (Node, error)
	SetProvider(n Node) error

	// Dependents returns the nodes that depend on this node.
	Dependents() []Node
	AddDependent(n Node)

	// Wire up the node to an input stream of data and return an output stream of data
	Wire(ctx context.Context, input IO) (IO, error)

	// Subscribers returns the nodes that subscribe to this node.
	Subscribers() []Listener
	AddSubscriber(n Listener)

	// Publishers returns the nodes that this node subscribes to.
	Publishers() []Listener
	AddPublishers(n Listener)
}

type ProtoEdge

type ProtoEdge interface {
	protoreflect.ProtoMessage
	GetId() string
	GetFrom() string
	GetTo() string
}

type ProtoGraph

type ProtoGraph[T ProtoNode, U ProtoEdge] interface {
	SetNodes([]T)
	SetEdges([]U)
	GetNodes() []T
	GetEdges() []U
}

type ProtoNode

type ProtoNode interface {
	protoreflect.ProtoMessage
	GetId() string
}

type ProtoProject

type ProtoProject[T ProtoNode, U ProtoEdge] interface {
	GetId() string
	GetGraph() ProtoGraph[T, U]
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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