connect

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: Apache-2.0 Imports: 2 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 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(joiners ...*Joiner) Forker

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

func (*Forker) Close

func (f *Forker) Close()

Close the input channel and, in cascade, all the forked channels

func (*Forker) Sender

func (f *Forker) Sender() refl.Channel

Sender acquires the channel that will receive the data from the source node

type Joiner

type Joiner struct {
	// contains filtered or unexported fields
}

Joiner provides shared access to the input channel of a node.

func NewJoiner

func NewJoiner(ct refl.ChannelType, bufferLength int) Joiner

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

func (*Joiner) AcquireSender

func (j *Joiner) AcquireSender() refl.Channel

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) Receiver

func (j *Joiner) Receiver() refl.Channel

Receiver gets access to the channel as a receiver

func (*Joiner) ReleaseSender

func (j *Joiner) 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