subscriptions

package
v0.0.0-...-b400eb5 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExchangeLookup

type ExchangeLookup interface {
	GetExchangesByNetwork(network int64) ([]*types.Address, error)
}

type OrderFilter

type OrderFilter struct {
	NetworkID           int64  `json:"networkId"`
	MakerAssetProxyID   string `json:"makerAssetProxyId"`
	TakerAssetProxyID   string `json:"takerAssetProxyId"`
	MakerAssetAddress   string `json:"makerAssetAddress"`
	TakerAssetAddress   string `json:"takerAssetAddress"`
	AssetAddress        string `json:"assetAddress"`
	ExchangeAddress     string `json:"exchangeContractAddress"`
	SenderAddress       string `json:"senderAddress"`
	MakerAddress        string `json:"makerAddress"`
	TakerAddress        string `json:"takerAddress"`
	TraderAddress       string `json:"traderAddress"`
	FeeRecipientAddress string `json:"feeRecipient"`
	MakerAssetData      string `json:"makerAssetData"`
	TakerAssetData      string `json:"takerAssetData"`
	TraderAssetData     string `json:"traderAssetData"`
	PoolID              string `json:"_poolId"`
	PoolName            string `json:"_poolName"`
	TakerFee            string `json:"_takerFee"`
}

func FilterFromQueryString

func FilterFromQueryString(queryString string) (*OrderFilter, error)

func (*OrderFilter) GetFilter

func (ofilter *OrderFilter) GetFilter(lookup ExchangeLookup) (func(*db.Order) bool, error)

GetFilter returns a function that can be quickly used to evaluate whether a given order matches the criteria of this filter. This is sort of a just-in-time compiler, in that it produces an efficient fuction for testing an order. While this function is fairly complicated, the function it returns will test only the attributes that the filter is interested in, and does not re-evaluate filter parameters when checking each order.

type Subscription

type Subscription struct {
	// contains filtered or unexported fields
}

func (*Subscription) Publish

func (subscription *Subscription) Publish(order *db.Order) bool

type SubscriptionConsumer

type SubscriptionConsumer struct {
	// contains filtered or unexported fields
}

func NewSubscriptionConsumer

func NewSubscriptionConsumer(manager *SubscriptionManager, publisher channels.Publisher, filter *OrderFilter, lookup ExchangeLookup) *SubscriptionConsumer

func (*SubscriptionConsumer) Consume

func (consumer *SubscriptionConsumer) Consume(delivery channels.Delivery)

type SubscriptionManager

type SubscriptionManager struct {
	// contains filtered or unexported fields
}

func (*SubscriptionManager) Add

func (manager *SubscriptionManager) Add(subscription Subscription)

func (*SubscriptionManager) PruneByPublisher

func (manager *SubscriptionManager) PruneByPublisher(channel channels.Publisher)

func (*SubscriptionManager) Publish

func (manager *SubscriptionManager) Publish(order *db.Order)

func (*SubscriptionManager) Remove

func (manager *SubscriptionManager) Remove(index int)

type SubscriptionMessage

type SubscriptionMessage struct {
	Type      string `json:"type"`
	Channel   string `json:"channel"`
	RequestID string `json:"requestId"`
	Payload   *OrderFilter
}

type SubscriptionUpdate

type SubscriptionUpdate struct {
	Type      string        `json:"type"`
	Channel   string        `json:"channel"`
	RequestID string        `json:"requestId"`
	Payload   []interface{} `json:"payload"`
}

type WebsocketSubscriptionManager

type WebsocketSubscriptionManager struct {
	// contains filtered or unexported fields
}

func NewWebsocketSubscriptionManager

func NewWebsocketSubscriptionManager() *WebsocketSubscriptionManager

func (*WebsocketSubscriptionManager) Consume

func (subs *WebsocketSubscriptionManager) Consume(delivery channels.Delivery)

func (*WebsocketSubscriptionManager) ListenForSubscriptions

func (subs *WebsocketSubscriptionManager) ListenForSubscriptions(port uint, db *gorm.DB) (func() error, error)

Jump to

Keyboard shortcuts

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