source

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: Unlicense Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadUpgrade = errors.New("matt::chasm::source: bad upgrade")
	ErrBadRead    = errors.New("matt::chasm::source: bad read")
)

Functions

This section is empty.

Types

type DecodeKeyFunc

type DecodeKeyFunc func(raw []byte) []core.Key

TODO: we should be returning an error

type EventDecoder

type EventDecoder[T core.Event] interface {
	Feed(key core.Key, frame []byte) (T, bool, error)
}

type KeyGetter

type KeyGetter interface {
	Online() []core.Key
	Offline() []core.Key
	All() []core.Key
}

func NewKeyGetter

func NewKeyGetter(online, offline, all DecodeKeyFunc, req http.Request) KeyGetter

type Proto

type Proto[T core.Event] interface {
	Endpoint() string
	Subscribe(key core.Key) []byte
	Unsubscribe(key core.Key) []byte
	EventDecoder[T]
}

type Reader

type Reader[T core.Event] interface {
	Open() error
	Close() error
	Read() (T, bool)
	Next() error
}

type Source

type Source interface {
	Symbol(key core.Key) Reader[core.SymbolEvent]
	Book(key core.Key) Reader[core.BookEvent]
	Candle(key core.Key) Reader[core.CandleEvent]
	Trade(key core.Key) Reader[core.TradeEvent]
	Get() KeyGetter
}

func NewSource

func NewSource(
	origin string,
	symbol Proto[core.SymbolEvent],
	book Proto[core.BookEvent],
	trade Proto[core.TradeEvent],
	candle Proto[core.CandleEvent],
	getter KeyGetter,
) Source

Jump to

Keyboard shortcuts

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