Documentation ¶
Index ¶
- func NewEventSource(config Config, log *logging.Logger) (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 ChainInfoI
- type Config
- 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 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, chainInfo ChainInfoI, 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 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"` }
Config represents the configuration of the broker.
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig creates an instance of config with default values.
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, chainInfo ChainInfoI, eventsource eventSource, transactionManager TransactionManager, blockStore BlockStore, onBlockCommitted func(ctx context.Context, chainId string, lastCommittedBlockHeight int64) bool, 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.