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)
- func NewSqlStoreBroker(log *logging.Logger, config Config, chainInfo ChainInfoI, ...) *sqlStoreBroker
- type BlockStore
- type Broker
- type BrokerI
- type ChainInfoI
- type Config
- type FileEventSourceConfig
- type OrderEventWithVegaTime
- type SocketConfig
- type SqlBrokerSubscriber
- type SqlStoreEventBroker
- type Subscriber
- type TransactionManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFanOutEventSource ¶
func NewFileEventSource ¶
func NewSqlStoreBroker ¶
func NewSqlStoreBroker(log *logging.Logger, config Config, chainInfo ChainInfoI, eventsource eventSource, transactionManager TransactionManager, blockStore BlockStore, subs ...SqlBrokerSubscriber, ) *sqlStoreBroker
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 BrokerI ¶
type BrokerI interface { Send(event events.Event) Subscribe(s Subscriber) int SubscribeBatch(subs ...Subscriber) Unsubscribe(k int) Receive(ctx context.Context) error }
BrokerI 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.
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 SocketConfig ¶
type SqlBrokerSubscriber ¶
type SqlStoreEventBroker ¶
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.