Documentation ¶
Index ¶
- Constants
- func ParseBlocksArguments(arguments models.Arguments) (blocksArguments, error)
- func ParseStartBlock(arguments models.Arguments) (flow.Identifier, uint64, error)
- type AccountStatusesDataProvider
- type BlockDigestsDataProvider
- type BlockHeadersDataProvider
- type BlocksDataProvider
- type DataProvider
- type DataProviderFactory
- type DataProviderFactoryImpl
- type EventsDataProvider
- type SendAndGetTransactionStatusesDataProvider
- func (b SendAndGetTransactionStatusesDataProvider) Arguments() models.Arguments
- func (b SendAndGetTransactionStatusesDataProvider) Close()
- func (b SendAndGetTransactionStatusesDataProvider) ID() string
- func (p *SendAndGetTransactionStatusesDataProvider) Run() error
- func (b SendAndGetTransactionStatusesDataProvider) Topic() string
- type TransactionStatusesDataProvider
Constants ¶
const ( EventsTopic = "events" AccountStatusesTopic = "account_statuses" BlocksTopic = "blocks" BlockHeadersTopic = "block_headers" BlockDigestsTopic = "block_digests" TransactionStatusesTopic = "transaction_statuses" SendAndGetTransactionStatusesTopic = "send_and_get_transaction_statuses" )
Constants defining various topic names used to specify different types of data providers.
Variables ¶
This section is empty.
Functions ¶
func ParseBlocksArguments ¶
ParseBlocksArguments validates and initializes the blocks arguments.
func ParseStartBlock ¶
Types ¶
type AccountStatusesDataProvider ¶
type AccountStatusesDataProvider struct {
// contains filtered or unexported fields
}
func NewAccountStatusesDataProvider ¶
func NewAccountStatusesDataProvider( ctx context.Context, logger zerolog.Logger, stateStreamApi state_stream.API, subscriptionID string, topic string, arguments models.Arguments, send chan<- interface{}, chain flow.Chain, eventFilterConfig state_stream.EventFilterConfig, heartbeatInterval uint64, ) (*AccountStatusesDataProvider, error)
NewAccountStatusesDataProvider creates a new instance of AccountStatusesDataProvider.
func (AccountStatusesDataProvider) Arguments ¶
Arguments returns the arguments associated with the data provider.
func (AccountStatusesDataProvider) Close ¶
func (b AccountStatusesDataProvider) Close()
Close terminates the data provider.
No errors are expected during normal operations.
func (AccountStatusesDataProvider) ID ¶
func (b AccountStatusesDataProvider) ID() string
ID returns the subscription ID associated with current data provider
func (*AccountStatusesDataProvider) Run ¶
func (p *AccountStatusesDataProvider) Run() error
Run starts processing the subscription for events and handles responses.
No errors are expected during normal operations.
type BlockDigestsDataProvider ¶
type BlockDigestsDataProvider struct {
// contains filtered or unexported fields
}
BlockDigestsDataProvider is responsible for providing block digests
func NewBlockDigestsDataProvider ¶
func NewBlockDigestsDataProvider( ctx context.Context, logger zerolog.Logger, api access.API, subscriptionID string, topic string, arguments models.Arguments, send chan<- interface{}, ) (*BlockDigestsDataProvider, error)
NewBlockDigestsDataProvider creates a new instance of BlockDigestsDataProvider.
func (BlockDigestsDataProvider) Arguments ¶
Arguments returns the arguments associated with the data provider.
func (BlockDigestsDataProvider) Close ¶
func (b BlockDigestsDataProvider) Close()
Close terminates the data provider.
No errors are expected during normal operations.
func (BlockDigestsDataProvider) ID ¶
func (b BlockDigestsDataProvider) ID() string
ID returns the subscription ID associated with current data provider
func (*BlockDigestsDataProvider) Run ¶
func (p *BlockDigestsDataProvider) Run() error
Run starts processing the subscription for block digests and handles responses.
No errors are expected during normal operations.
type BlockHeadersDataProvider ¶
type BlockHeadersDataProvider struct {
// contains filtered or unexported fields
}
BlockHeadersDataProvider is responsible for providing block headers
func NewBlockHeadersDataProvider ¶
func NewBlockHeadersDataProvider( ctx context.Context, logger zerolog.Logger, api access.API, subscriptionID string, topic string, arguments models.Arguments, send chan<- interface{}, ) (*BlockHeadersDataProvider, error)
NewBlockHeadersDataProvider creates a new instance of BlockHeadersDataProvider.
func (BlockHeadersDataProvider) Arguments ¶
Arguments returns the arguments associated with the data provider.
func (BlockHeadersDataProvider) Close ¶
func (b BlockHeadersDataProvider) Close()
Close terminates the data provider.
No errors are expected during normal operations.
func (BlockHeadersDataProvider) ID ¶
func (b BlockHeadersDataProvider) ID() string
ID returns the subscription ID associated with current data provider
func (*BlockHeadersDataProvider) Run ¶
func (p *BlockHeadersDataProvider) Run() error
Run starts processing the subscription for block headers and handles responses.
No errors are expected during normal operations.
type BlocksDataProvider ¶
type BlocksDataProvider struct {
// contains filtered or unexported fields
}
BlocksDataProvider is responsible for providing blocks
func NewBlocksDataProvider ¶
func NewBlocksDataProvider( ctx context.Context, logger zerolog.Logger, api access.API, subscriptionID string, linkGenerator commonmodels.LinkGenerator, topic string, arguments models.Arguments, send chan<- interface{}, ) (*BlocksDataProvider, error)
NewBlocksDataProvider creates a new instance of BlocksDataProvider.
func (BlocksDataProvider) Arguments ¶
Arguments returns the arguments associated with the data provider.
func (BlocksDataProvider) Close ¶
func (b BlocksDataProvider) Close()
Close terminates the data provider.
No errors are expected during normal operations.
func (BlocksDataProvider) ID ¶
func (b BlocksDataProvider) ID() string
ID returns the subscription ID associated with current data provider
func (*BlocksDataProvider) Run ¶
func (p *BlocksDataProvider) Run() error
Run starts processing the subscription for blocks and handles responses.
No errors are expected during normal operations.
type DataProvider ¶
type DataProvider interface { // ID returns the unique identifier of the data provider. ID() string // Topic returns the topic associated with the data provider. Topic() string // Arguments returns the arguments associated with the data provider. Arguments() models.Arguments // Close terminates the data provider. // // No errors are expected during normal operations. Close() // Run starts processing the subscription and handles responses. // // The separation of the data provider's creation and its Run() method // allows for better control over the subscription lifecycle. By doing so, // a confirmation message can be sent to the client immediately upon // successful subscription creation or failure. This ensures any required // setup or preparation steps can be handled prior to initiating the // subscription and data streaming process. // // Run() begins the actual processing of the subscription. At this point, // the context used for provider creation is no longer needed, as all // necessary preparation steps should have been completed. // // No errors are expected during normal operations. Run() error }
The DataProvider is the interface abstracts of the actual data provider used by the WebSocketCollector. It provides methods for retrieving the provider's unique SubscriptionID, topic, and a methods to close and run the provider.
type DataProviderFactory ¶
type DataProviderFactory interface { // NewDataProvider creates a new data provider based on the specified topic // and configuration parameters. // // No errors are expected during normal operations. NewDataProvider( ctx context.Context, subscriptionID string, topic string, args models.Arguments, ch chan<- interface{}, ) (DataProvider, error) }
DataProviderFactory defines an interface for creating data providers based on specified topics. The factory abstracts the creation process and ensures consistent access to required APIs.
type DataProviderFactoryImpl ¶
type DataProviderFactoryImpl struct {
// contains filtered or unexported fields
}
DataProviderFactoryImpl is an implementation of the DataProviderFactory interface. It is responsible for creating data providers based on the requested topic. It manages access to logging and relevant APIs needed to retrieve data.
func NewDataProviderFactory ¶
func NewDataProviderFactory( logger zerolog.Logger, stateStreamApi state_stream.API, accessApi access.API, chain flow.Chain, eventFilterConfig state_stream.EventFilterConfig, heartbeatInterval uint64, linkGenerator commonmodels.LinkGenerator, ) *DataProviderFactoryImpl
NewDataProviderFactory creates a new DataProviderFactory
Parameters: - logger: Used for logging within the data providers. - eventFilterConfig: Configuration for filtering events from state streams. - stateStreamApi: API for accessing data from the Flow state stream API. - accessApi: API for accessing data from the Flow Access API.
func (*DataProviderFactoryImpl) NewDataProvider ¶
func (s *DataProviderFactoryImpl) NewDataProvider(ctx context.Context, subscriptionID string, topic string, arguments models.Arguments, ch chan<- interface{}) (DataProvider, error)
NewDataProvider creates a new data provider based on the specified topic and configuration parameters.
Parameters: - ctx: Context for managing request lifetime and cancellation. - topic: The topic for which a data provider is to be created. - arguments: Configuration arguments for the data provider. - ch: Channel to which the data provider sends data.
No errors are expected during normal operations.
type EventsDataProvider ¶
type EventsDataProvider struct {
// contains filtered or unexported fields
}
EventsDataProvider is responsible for providing events
func NewEventsDataProvider ¶
func NewEventsDataProvider( ctx context.Context, logger zerolog.Logger, stateStreamApi state_stream.API, subscriptionID string, topic string, arguments models.Arguments, send chan<- interface{}, chain flow.Chain, eventFilterConfig state_stream.EventFilterConfig, heartbeatInterval uint64, ) (*EventsDataProvider, error)
NewEventsDataProvider creates a new instance of EventsDataProvider.
func (EventsDataProvider) Arguments ¶
Arguments returns the arguments associated with the data provider.
func (EventsDataProvider) Close ¶
func (b EventsDataProvider) Close()
Close terminates the data provider.
No errors are expected during normal operations.
func (EventsDataProvider) ID ¶
func (b EventsDataProvider) ID() string
ID returns the subscription ID associated with current data provider
func (*EventsDataProvider) Run ¶
func (p *EventsDataProvider) Run() error
Run starts processing the subscription for events and handles responses.
No errors are expected during normal operations.
type SendAndGetTransactionStatusesDataProvider ¶
type SendAndGetTransactionStatusesDataProvider struct {
// contains filtered or unexported fields
}
func NewSendAndGetTransactionStatusesDataProvider ¶
func NewSendAndGetTransactionStatusesDataProvider( ctx context.Context, logger zerolog.Logger, api access.API, subscriptionID string, linkGenerator commonmodels.LinkGenerator, topic string, arguments models.Arguments, send chan<- interface{}, ) (*SendAndGetTransactionStatusesDataProvider, error)
func (SendAndGetTransactionStatusesDataProvider) Arguments ¶
Arguments returns the arguments associated with the data provider.
func (SendAndGetTransactionStatusesDataProvider) Close ¶
func (b SendAndGetTransactionStatusesDataProvider) Close()
Close terminates the data provider.
No errors are expected during normal operations.
func (SendAndGetTransactionStatusesDataProvider) ID ¶
func (b SendAndGetTransactionStatusesDataProvider) ID() string
ID returns the subscription ID associated with current data provider
func (*SendAndGetTransactionStatusesDataProvider) Run ¶
func (p *SendAndGetTransactionStatusesDataProvider) Run() error
Run starts processing the subscription for events and handles responses.
No errors are expected during normal operations.
type TransactionStatusesDataProvider ¶
type TransactionStatusesDataProvider struct {
// contains filtered or unexported fields
}
TransactionStatusesDataProvider is responsible for providing tx statuses
func NewTransactionStatusesDataProvider ¶
func NewTransactionStatusesDataProvider( ctx context.Context, logger zerolog.Logger, api access.API, subscriptionID string, linkGenerator commonmodels.LinkGenerator, topic string, arguments models.Arguments, send chan<- interface{}, ) (*TransactionStatusesDataProvider, error)
func (TransactionStatusesDataProvider) Arguments ¶
Arguments returns the arguments associated with the data provider.
func (TransactionStatusesDataProvider) Close ¶
func (b TransactionStatusesDataProvider) Close()
Close terminates the data provider.
No errors are expected during normal operations.
func (TransactionStatusesDataProvider) ID ¶
func (b TransactionStatusesDataProvider) ID() string
ID returns the subscription ID associated with current data provider
func (*TransactionStatusesDataProvider) Run ¶
func (p *TransactionStatusesDataProvider) Run() error
Run starts processing the subscription for events and handles responses.
No errors are expected during normal operations.