connect

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Forker

type Forker[OUT any] struct {
	// contains filtered or unexported fields
}

Forker manages the access to a Node's output (send) channel. When a node sends to only one node, this will work as a single channel. When a node sends to N nodes, it will spawn N channels that are cloned from the original channel in a goroutine.

func Fork

func Fork[T any](joiners ...*Joiner[T]) Forker[T]

Fork provides connection to a group of output Nodes, accessible through their respective Joiner instances.

func (*Forker[OUT]) AcquireSender added in v0.6.0

func (f *Forker[OUT]) AcquireSender() chan OUT

AcquireSender acquires the channel that will receive the data from the source node. Each call to AcquireSender requires an eventual call to ReleaseSender

func (*Forker[OUT]) ReleaseSender added in v0.6.0

func (f *Forker[OUT]) ReleaseSender()

ReleaseSender closes the input channel when the number of invocations is equal to AcquireSender invocations.

type Joiner

type Joiner[IN any] struct {
	// contains filtered or unexported fields
}

Joiner provides shared access to the input channel of a node of the type IN

func NewJoiner

func NewJoiner[IN any](bufferLength int) Joiner[IN]

NewJoiner creates a joiner for a given channel type and buffer length

func (*Joiner[IN]) AcquireSender

func (j *Joiner[IN]) AcquireSender() chan IN

AcquireSender gets acces to the channel as a sender. The acquirer must finally invoke ReleaseSender to make sure that the channel is closed when all the senders released it.

func (*Joiner[IN]) Receiver

func (j *Joiner[IN]) Receiver() chan IN

Receiver gets access to the channel as a receiver

func (*Joiner[IN]) ReleaseSender

func (j *Joiner[IN]) ReleaseSender()

ReleaseSender will close the channel when all the invokers of the AcquireSender have invoked this function

type Releaser

type Releaser func()

Releaser is a function that will allow releasing a forked channel.

Jump to

Keyboard shortcuts

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