Documentation ¶
Index ¶
- func CheckFromAddress(m *data.MemPoolTx, params ...interface{}) bool
- func CheckToAddress(m *data.MemPoolTx, params ...interface{}) bool
- func InitMemPool(pool *data.MemPool) error
- func InitParentContext(ctx context.Context)
- func InitRedisClient(client *redis.Client) error
- func LinkedTx(m *data.MemPoolTx, params ...interface{}) bool
- func ListenToMessages(ctx context.Context, pubsub *redis.PubSub, topics []string, ...)
- func NoCriteria(*data.MemPoolTx, ...interface{}) bool
- func SubscribeToMemPool(ctx context.Context) (*redis.PubSub, error)
- func SubscribeToPendingPool(ctx context.Context) (*redis.PubSub, error)
- func SubscribeToPendingTxEntry(ctx context.Context) (*redis.PubSub, error)
- func SubscribeToPendingTxExit(ctx context.Context) (*redis.PubSub, error)
- func SubscribeToQueuedPool(ctx context.Context) (*redis.PubSub, error)
- func SubscribeToQueuedTxEntry(ctx context.Context) (*redis.PubSub, error)
- func SubscribeToQueuedTxExit(ctx context.Context) (*redis.PubSub, error)
- func SubscribeToTopic(ctx context.Context, topic ...string) (*redis.PubSub, error)
- func UnmarshalPubSubMessage(message []byte) *data.MemPoolTx
- func UnsubscribeFromTopic(ctx context.Context, pubsub *redis.PubSub, topic ...string)
- type PublishingCriteria
- type Resolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckFromAddress ¶ added in v0.3.0
CheckFromAddress - Just checks `from` address of tx, so that client is only notified when tx from that address is detected to be entering/ leaving mempool
func CheckToAddress ¶ added in v0.3.0
CheckToAddress - Just checks `to` address of tx, so that client is only notified when tx `to` that address is detected to be entering/ leaving mempool
func InitMemPool ¶
InitMemPool - Initializing mempool handle, in this module so that it can be used before responding back to graphql queries
func InitParentContext ¶ added in v0.3.0
InitParentContext - Initializing parent context, to be listened by all graphQL subscribers so that graceful shutdown can be done
func InitRedisClient ¶ added in v0.3.0
func InitRedisClient(client *redis.Client) error
InitRedisClient - Initializing redis client handle, so that all subscriptions can be done using this client
func LinkedTx ¶ added in v0.4.0
LinkedTx - Given a tx in mempool, which we're tracking, will be matched against before deciding whether just received tx is somehow associated with it or not
For checking whether linked or not, we can do ¶
- First see if this tx is what we've as txHash [ LINKED ] - If tx is duplicate of it [ LINKED ]
Duplicate consideration is done by matching sender address & nonce when both of those fields same for a pair of tx(s), considered to be duplicate
func ListenToMessages ¶ added in v0.3.0
func ListenToMessages(ctx context.Context, pubsub *redis.PubSub, topics []string, comm chan<- *model.MemPoolTx, pubCriteria PublishingCriteria, params ...interface{})
ListenToMessages - Attempts to listen to messages being published on topic to which graphQL client has subscribed to over websocket transport
This can be run as a seperate go routine ¶
Before publishing any message to channel, on which graphQL client is listening, one publishing criteria check to be performed, which must return `true` for this tx to be eligible for publishing to client
You can always blindly return `true` in your `evaluationCriteria` function, so that you get to receive any tx being published on topic of your interest
func NoCriteria ¶ added in v0.3.0
NoCriteria - When you want to listen to any tx being published on your topic of interest simply pass this function to `ListenToMessages` so that all criteria check always returns `true` & graphQL client receives all tx(s)
func SubscribeToMemPool ¶ added in v0.3.0
SubscribeToMemPool - Subscribes to any changes happening in mempool
As mempool has two segments i.e. 1. Pending Pool 2. Queued Pool
It'll subscribe to all 4 topics for listening to tx(s) entering/ leaving any portion of mempool
func SubscribeToPendingPool ¶ added in v0.3.0
SubscribeToPendingPool - Subscribes to both topics, associated with changes happening in pending tx pool
When tx joins/ leaves pending pool, subscribers will receive notification
func SubscribeToPendingTxEntry ¶ added in v0.3.0
SubscribeToPendingTxEntry - Subscribe to topic where new pending tx(s) are published
func SubscribeToPendingTxExit ¶ added in v0.3.0
SubscribeToPendingTxExit - Subscribe to topic where pending tx(s), getting confirmed are published
func SubscribeToQueuedPool ¶ added in v0.3.0
SubscribeToQueuedPool - Subscribes to both topics, associated with changes happening in queued tx pool
When tx joins/ leaves queued pool, subscribers will receive notification
@note Tx(s) generally join queued pool, when there's nonce gap & this tx can't be processed until some lower nonce tx(s) get(s) processed
func SubscribeToQueuedTxEntry ¶ added in v0.3.0
SubscribeToQueuedTxEntry - Subscribe to topic where new queued tx(s) are published
func SubscribeToQueuedTxExit ¶ added in v0.3.0
SubscribeToQueuedTxExit - Subscribe to topic where queued tx(s), getting unstuck are published
func SubscribeToTopic ¶ added in v0.3.0
SubscribeToTopic - Subscribes to Redis topic(s), with context of caller while waiting for subscription confirmation
func UnmarshalPubSubMessage ¶ added in v0.3.0
UnmarshalPubSubMessage - Attempts to unmarshal message pack serialized pubsub message as structured tx data, which is to be sent to subscriber
func UnsubscribeFromTopic ¶ added in v0.3.0
UnsubscribeFromTopic - Given topic name to which client is already subscribed to, attempts to unsubscribe from
Types ¶
type PublishingCriteria ¶ added in v0.3.0
PublishingCriteria - Message publishing criteria is expected in this form, which is to be invoked, everytime new message is received in any topic client is subscribed to
type Resolver ¶
type Resolver struct{}
func (*Resolver) Query ¶
func (r *Resolver) Query() generated.QueryResolver
Query returns generated.QueryResolver implementation.
func (*Resolver) Subscription ¶ added in v0.3.0
func (r *Resolver) Subscription() generated.SubscriptionResolver
Subscription returns generated.SubscriptionResolver implementation.