Documentation ¶
Index ¶
- Constants
- func Get(m []byte, i int64) bool
- func GetBit(b byte, i int64) bool
- func Len(m []byte) int
- func NewSlice(l int64) []byte
- func Set(m []byte, i int64, v bool)
- func SetBit(b byte, i int64, v bool) byte
- func StartEngine()
- type Base
- type Bitmap
- type BookOrder
- type DoneLog
- type Engine
- type KafkaLogReader
- type KafkaLogStore
- type KafkaOrderReader
- type Log
- type LogObserver
- type LogReader
- type LogStore
- type LogType
- type MatchLog
- type OffsetOrder
- type OpenLog
- type OrderBook
- type OrderReader
- type ReceivedLog
- type RedisSnapshotStore
- type Snapshot
- type SnapshotStore
- type Window
Constants ¶
View Source
const ( LogTypeMatch = LogType("match") LogTypeOpen = LogType("open") LogTypeDone = LogType("done") )
View Source
const (
TopicOrderPrefix = "matching_order_"
)
Variables ¶
This section is empty.
Functions ¶
func StartEngine ¶
func StartEngine()
Types ¶
type DoneLog ¶
type Engine ¶
type Engine struct { OrderBook *OrderBook OrderReader OrderReader OrderOffset int64 OrderCh chan *OffsetOrder LogStore LogStore LogCh chan Log SnapshotReqCh chan *Snapshot SnapshotApproveReqCh chan *Snapshot SnapshotCh chan *Snapshot SnapShotStore SnapshotStore // contains filtered or unexported fields }
func NewEngine ¶
func NewEngine(product *entities.Product, orderReader OrderReader, logStore LogStore, snapshotStore SnapshotStore) *Engine
type KafkaLogReader ¶
type KafkaLogReader struct {
// contains filtered or unexported fields
}
func (*KafkaLogReader) GetProductId ¶
func (r *KafkaLogReader) GetProductId() string
func (*KafkaLogReader) RegisterObserver ¶
func (r *KafkaLogReader) RegisterObserver(observer LogObserver)
func (*KafkaLogReader) Run ¶
func (r *KafkaLogReader) Run(seq, offset int64)
type KafkaLogStore ¶
type KafkaLogStore struct {
// contains filtered or unexported fields
}
func NewKafkaLogStore ¶
func NewKafkaLogStore(productId string, brokers []string) *KafkaLogStore
func (*KafkaLogStore) Store ¶
func (s *KafkaLogStore) Store(logs []interface{}) error
type KafkaOrderReader ¶
type KafkaOrderReader struct {
OrderReader *kafka.Reader
}
func NewKafkaOrderReader ¶
func NewKafkaOrderReader(productId string, brokers []string) *KafkaOrderReader
func (*KafkaOrderReader) FetchOrder ¶
func (s *KafkaOrderReader) FetchOrder() (offset int64, order *entities.Order, err error)
func (*KafkaOrderReader) SetOffset ¶
func (s *KafkaOrderReader) SetOffset(offset int64) error
type LogObserver ¶
type LogReader ¶
type LogReader interface { GetProductId() string RegisterObserver(observer LogObserver) Run(seq, offset int64) }
type MatchLog ¶
type OffsetOrder ¶
type OpenLog ¶
type OrderBook ¶
type OrderBook struct { // stricly continiously increasing log SEQ, used to write matching log LogSeq int64 // contains filtered or unexported fields }
func NewOrderBook ¶
type OrderReader ¶
type ReceivedLog ¶
type ReceivedLog struct { Base OrderId int64 Size decimal.Decimal Price decimal.Decimal Side entities.Side OrderType entities.OrderType }
func (*ReceivedLog) GetSeq ¶
func (l *ReceivedLog) GetSeq() int64
type RedisSnapshotStore ¶
type RedisSnapshotStore struct {
// contains filtered or unexported fields
}
func (*RedisSnapshotStore) GetLatest ¶
func (s *RedisSnapshotStore) GetLatest() (*Snapshot, error)
func (*RedisSnapshotStore) Store ¶
func (s *RedisSnapshotStore) Store(snapshot *Snapshot) error
type SnapshotStore ¶
func NewRedisSnapShotStore ¶
func NewRedisSnapShotStore(productId string) SnapshotStore
Click to show internal directories.
Click to hide internal directories.