Documentation ¶
Index ¶
- func NewEventSource(config Config, log *logging.Logger, chainID string) (eventSource, error)
- func NewFanOutEventSource(source eventSource, sendChannelBufferSize int, expectedNumSubscribers int) *fanOutEventSource
- func NewFileEventSource(file string, timeBetweenBlocks time.Duration, sendChannelBufferSize int, ...) (*fileEventSource, error)
- type BlockStore
- type Broker
- type BufferedEventSourceConfig
- type ChainInfoI
- type Config
- type FileBufferedEventSource
- type FileEventSourceConfig
- type OrderEventWithVegaTime
- type SQLBrokerSubscriber
- type SQLStoreBroker
- type SQLStoreEventBroker
- type SocketConfig
- type Subscriber
- type TestInterface
- type TransactionManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEventSource ¶
func NewFanOutEventSource ¶
Types ¶
type BlockStore ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker - the base broker type perhaps we can extend this to embed into type-specific brokers.
func New ¶
func New(ctx context.Context, log *logging.Logger, config Config, chainID string, eventsource eventSource, ) (*Broker, error)
New creates a new base broker.
func (*Broker) Subscribe ¶
func (b *Broker) Subscribe(s Subscriber) int
Subscribe registers a new subscriber, returning the key.
func (*Broker) SubscribeBatch ¶
func (b *Broker) SubscribeBatch(subs ...Subscriber)
func (*Broker) Unsubscribe ¶
Unsubscribe removes subscriber from broker this does not change the state of the subscriber.
type BufferedEventSourceConfig ¶ added in v0.61.0
type BufferedEventSourceConfig struct { EventsPerFile int `long:"events-per-file" description:"the number of events to store in a file buffer, set to 0 to disable the buffer"` SendChannelBufferSize int `long:"send-buffer-size" description:"sink event channel buffer size"` MaxBufferedEvents int `` /* 134-byte string literal not displayed */ }
type ChainInfoI ¶
type Config ¶
type Config struct { Level encoding.LogLevel `long:"log-level"` SocketConfig SocketConfig `group:"Socket" namespace:"socket"` SocketServerInboundBufferSize int `long:"socket-server-inbound-buffer-size"` SocketServerOutboundBufferSize int `long:"socket-server-outbound-buffer-size"` FileEventSourceConfig FileEventSourceConfig `group:"FileEventSourceConfig" namespace:"fileeventsource"` UseEventFile encoding.Bool `long:"use-event-file" description:"set to true to source events from a file"` PanicOnError encoding.Bool `long:"panic-on-error" description:"if an error occurs on event push the broker will panic, else log the error"` UseBufferedEventSource encoding.Bool `long:"use-buffered-event-source" description:"if true datanode will buffer events"` BufferedEventSourceConfig BufferedEventSourceConfig `group:"BufferedEventSource" namespace:"bufferedeventsource"` }
Config represents the configuration of the broker.
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig creates an instance of config with default values.
type FileBufferedEventSource ¶ added in v0.61.0
type FileBufferedEventSource struct {
// contains filtered or unexported fields
}
func NewBufferedEventSource ¶ added in v0.61.0
func NewBufferedEventSource(log *logging.Logger, config BufferedEventSourceConfig, source eventSource, bufferFilePath string) (*FileBufferedEventSource, error)
func (*FileBufferedEventSource) Listen ¶ added in v0.61.0
func (m *FileBufferedEventSource) Listen() error
type FileEventSourceConfig ¶
type FileEventSourceConfig struct { File string `long:"file" description:"the event file"` TimeBetweenBlocks encoding.Duration `string:"time-between-blocks" description:"the time between sending blocks"` SendChannelBufferSize int `long:"send-buffer-size" description:"size of channel buffer used to send events to broker "` }
type OrderEventWithVegaTime ¶
func (*OrderEventWithVegaTime) GetOrder ¶
func (oe *OrderEventWithVegaTime) GetOrder() *vega.Order
func (*OrderEventWithVegaTime) VegaTime ¶
func (oe *OrderEventWithVegaTime) VegaTime() time.Time
type SQLBrokerSubscriber ¶ added in v0.55.0
type SQLStoreBroker ¶ added in v0.57.0
type SQLStoreBroker struct {
// contains filtered or unexported fields
}
SQLStoreBroker : push events to each subscriber with a single go routine across all types.
func NewSQLStoreBroker ¶ added in v0.55.0
func NewSQLStoreBroker( log *logging.Logger, config Config, chainID string, eventsource eventSource, transactionManager TransactionManager, blockStore BlockStore, protocolUpgradeService *service.ProtocolUpgrade, onBlockCommitted func(ctx context.Context, chainId string, lastCommittedBlockHeight int64), subs []SQLBrokerSubscriber, ) *SQLStoreBroker
type SQLStoreEventBroker ¶ added in v0.55.0
type SocketConfig ¶
type Subscriber ¶
type Subscriber interface { Push(val ...events.Event) Skip() <-chan struct{} Closed() <-chan struct{} C() chan<- []events.Event Types() []events.Type SetID(id int) ID() int Ack() bool }
Subscriber interface allows pushing values to subscribers, can be set to a Skip state (temporarily not receiving any events), or closed. Otherwise events are pushed.
type TestInterface ¶ added in v0.55.0
type TestInterface interface { Send(event events.Event) Subscribe(s Subscriber) int SubscribeBatch(subs ...Subscriber) Unsubscribe(k int) Receive(ctx context.Context) error }
TestInterface interface (horribly named) is declared here to provide a drop-in replacement for broker mocks used throughout in addition to providing the classical mockgen functionality, this mock can be used to check the actual events that will be generated so we don't have to rely on test-only helper functions.