modules

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package modules provides a way to load various code modules from data providers.

Index

Constants

This section is empty.

Variables

View Source
var (
	// AutoPiSource is the Ethereum address for the AutoPi connection.
	AutoPiSource = common.HexToAddress("0x5e31bBc786D7bEd95216383787deA1ab0f1c1897")

	// RuptelaSource is the Ethereum address for the Ruptela connection.
	RuptelaSource = common.HexToAddress("0xF26421509Efe92861a587482100c6d728aBf1CD0")

	// KaufmannSource is the Ethereum address for the Kaufmann connection.
	KaufmannSource = common.HexToAddress("0x8D8cDB2B26423c8fDbb27321aF20b4659Ce919fD")

	// HashDogSource is the Ethereum address for the HashDog connection.
	HashDogSource = common.HexToAddress("0x4c674ddE8189aEF6e3b58F5a36d7438b2b1f6Bc2")

	// CompassSource is the Ethereum address for the Compass IOT connection.
	CompassSource = common.HexToAddress("0x55BF1c27d468314Ea119CF74979E2b59F962295c")

	// TeslaSource is the Ethereum address for the Tesla connection.
	TeslaSource = common.HexToAddress("0xc4035Fecb1cc906130423EF05f9C20977F643722")

	// SignalRegistry stores signal modules.
	SignalRegistry = NewModuleRegistry[SignalModule]()

	// CloudEventRegistry stores cloud event modules.
	CloudEventRegistry = NewModuleRegistry[CloudEventModule]()

	// FingerprintRegistry stores fingerprint modules.
	FingerprintRegistry = NewModuleRegistry[FingerprintModule]()

	// EventRegistry stores event modules.
	EventRegistry = NewModuleRegistry[EventModule]()
)

Source addresses and global registries for different modules.

Functions

func ConvertToCloudEvents

func ConvertToCloudEvents(ctx context.Context, source string, rawData []byte) ([]cloudevent.CloudEventHeader, []byte, error)

ConvertToCloudEvents takes a module source and raw payload and returns cloud event headers and data. Falls back to the default module (empty source) if the specified module is not found.

func ConvertToEvents added in v0.6.3

func ConvertToEvents(ctx context.Context, source string, event cloudevent.RawEvent) ([]vss.Event, error)

ConvertToEvents takes a module source and raw payload and returns a list of events. Falls back to the default module (empty source) if the specified module is not found.

func ConvertToFingerprint

func ConvertToFingerprint(ctx context.Context, source string, event cloudevent.RawEvent) (cloudevent.Fingerprint, error)

ConvertToFingerprint takes a module source and raw payload and returns a fingerprint event. Falls back to the default module (empty source) if the specified module is not found.

func ConvertToSignals

func ConvertToSignals(ctx context.Context, source string, event cloudevent.RawEvent) ([]vss.Signal, error)

ConvertToSignals takes a module source and raw payload and returns a list of signals. Falls back to the default module (empty source) if the specified module is not found.

func RegisterDefaultModules

func RegisterDefaultModules(
	signalReg *ModuleRegistry[SignalModule],
	cloudEventReg *ModuleRegistry[CloudEventModule],
	fingerprintReg *ModuleRegistry[FingerprintModule],
	eventReg *ModuleRegistry[EventModule],
)

RegisterDefaultModules registers all the default module implementations into the provided registries.

Types

type CloudEventModule

type CloudEventModule interface {
	CloudEventConvert(ctx context.Context, msgData []byte) ([]cloudevent.CloudEventHeader, []byte, error)
}

CloudEventModule is an interface for converting messages to cloud events.

type EventModule added in v0.6.3

type EventModule interface {
	EventConvert(ctx context.Context, event cloudevent.RawEvent) ([]vss.Event, error)
}

EventModule is an interface for converting messages to events.

type FingerprintModule

type FingerprintModule interface {
	FingerprintConvert(ctx context.Context, event cloudevent.RawEvent) (cloudevent.Fingerprint, error)
}

FingerprintModule is an interface for converting messages to fingerprint events.

type ModuleRegistry

type ModuleRegistry[T any] struct {
	// contains filtered or unexported fields
}

ModuleRegistry is a generic registry for storing and retrieving modules.

func NewModuleRegistry

func NewModuleRegistry[T any]() *ModuleRegistry[T]

NewModuleRegistry creates a new module registry.

func (*ModuleRegistry[T]) Get

func (r *ModuleRegistry[T]) Get(source string) (T, bool)

Get retrieves a module from the registry.

func (*ModuleRegistry[T]) GetSources

func (r *ModuleRegistry[T]) GetSources() []string

GetSources returns all registered sources.

func (*ModuleRegistry[T]) Override

func (r *ModuleRegistry[T]) Override(source string, module T)

Override registers or replaces a module in the registry.

func (*ModuleRegistry[T]) Register

func (r *ModuleRegistry[T]) Register(source string, module T) error

Register adds a module to the registry. Returns an error if a module with the same source is already registered.

type NotFoundError

type NotFoundError string

NotFoundError is an error type for when a module is not found.

func (NotFoundError) Error

func (e NotFoundError) Error() string

type SignalModule

type SignalModule interface {
	SignalConvert(ctx context.Context, event cloudevent.RawEvent) ([]vss.Signal, error)
}

SignalModule is an interface for converting messages to signals.

Jump to

Keyboard shortcuts

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