kernel

package
v0.15.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dequeue

func Dequeue[T any](k *Kernel, cat string, codec Codec[T]) (<-chan swarm.Msg[T], chan<- swarm.Msg[T])

Enqueue channels for kernel

func Enqueue

func Enqueue[T any](k *Kernel, cat string, codec Codec[T]) (chan<- T, <-chan T)

Enqueue channels for kernel

Types

type Cathode

type Cathode interface {
	Ack(digest string) error
	Ask() ([]swarm.Bag, error)
}

type Codec

type Codec[T any] interface {
	Encode(T) ([]byte, error)
	Decode([]byte) (T, error)
}

type Emitter

type Emitter interface {
	Enq(swarm.Bag) error
}

type Kernel

type Kernel struct {
	sync.WaitGroup
	sync.RWMutex

	// Kernel configuartion
	Config swarm.Config

	// On the wire protocol emitter (writer) and cathode (receiver)
	Emitter Emitter
	Cathode Cathode
	// contains filtered or unexported fields
}

Event Kernel builds an infrastructure for integrating message brokers, events busses into Golang channel environment. The implementation follows the pattern, defined by https://go101.org/article/channel-closing.html

func New

func New(emitter Emitter, cathode Cathode, config swarm.Config) *Kernel

New routing and dispatch kernel

func (*Kernel) Await

func (k *Kernel) Await()

Await for event delivery

func (*Kernel) Close

func (k *Kernel) Close()

Close event delivery infrastructure

func (*Kernel) Dispatch

func (k *Kernel) Dispatch(seq []swarm.Bag, timeout time.Duration) error

Dispatches batch of messages

type Spawner

type Spawner interface {
	Spawn(*Kernel) error
}

Jump to

Keyboard shortcuts

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