itf

package
v0.0.0-...-fa1d311 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventCache

type EventCache interface {
	Get(key string) (any, error)
	Set(key string, data any) error
	Del(key string) error
	Close() error
}

type EventConnection

type EventConnection interface {
	NewInput(config.Input) (EventInput, error)
	NewOutput(config.Output) (EventOutput, error)
	NewCache(config.Cache) (EventCache, error)
	Close() error
}

type EventInput

type EventInput interface {
	Receive() (<-chan EventMessage, error)
	Close() error
}

EventInput is a source of events that can be consumed by the EventRunner

EventInput is an interface for sources of events that can be consumed by the EventRunner. This interface is implemented by sources such as Kafka or Redis.

Receive is called by the EventRunner to receive events from the source. The implementation of this method should block until an event is available or an error occurs. When an event is available the implementation should call the `EventReceiver` function with the event. When an error occurs the implementation should return the error.

type EventMessage

type EventMessage interface {
	Time() (time.Time, error)
	Topic() (string, error)
	ReplyTo() (string, error)
	Metadata(string) ([]string, error)
	Data() ([]byte, error)
	DataString() (string, error)
	Ack() error
	Nak() error
}

EventMessage is an interface for messages that contain event data. The interface is implemented by event sources such as Kafka or Redis.

The methods on EventMessage should be called by the EventRunner when it receives an event. The methods provide access to the details of the event such as the source of the event, the headers, and the data

type EventOutput

type EventOutput interface {
	Ingest(<-chan RunnerResult) error
	Close() error
}

type EventPlugin

type EventPlugin interface {
	Command(key string, data any) (PluginCommandResult, error)
	Input(buffer int, config map[string]string) (<-chan PluginInput, error)
	Output(uuid string, topic string, data []byte, metadata map[string][]string) error
}

type EventPlugins

type EventPlugins interface {
	GetPlugin(id string) (EventPlugin, error)
}

type PluginCommandResult

type PluginCommandResult interface {
	GetCommand() string
	GetUUID() string
	GetData() (any, error)
	IsAsync() bool
}

type PluginInput

type PluginInput interface {
	GetTime() time.Time
	GetInput() *proto.InputRes
}

type Runner

type Runner interface {
	Ingest(<-chan EventMessage) (<-chan RunnerResult, error)
	Stop() error
}

type RunnerManager

type RunnerManager interface {
	New(EventCache, EventPlugins) (Runner, error)
	StopAll() error
}

type RunnerResult

type RunnerResult interface {
	// Setters
	SetData(any)
	AddMetadata(string, string)
	SetMetadata(string, string)
	SetConfig(string, string)
	// Getters
	HasResult() bool
	Message() EventMessage
	Destination() (string, error)
	Metadata() (map[string][]string, error)
	Config() (map[string]string, error)
	Data() (any, error)
	// Ack and Nak
	Ack() error
	Nak() error
}

Jump to

Keyboard shortcuts

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