Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Access] Add implementation for blocks, block headers and block digests data providers #6585

Closed
3 tasks done
Tracked by #6163
Guitarheroua opened this issue Oct 22, 2024 · 1 comment
Closed
3 tasks done
Tracked by #6163
Assignees
Labels

Comments

@Guitarheroua
Copy link
Contributor

Guitarheroua commented Oct 22, 2024

blocks, block headers and block digest data providers

Based on the Draft design of new WebSockets, blocks, block headers and block digests data providers should be implemented as part of the new WebSocket pub/sub system. The draft design document describes all requirements and relationships between components.

Requirements:

  1. Blocks, block headers and block digests data providers constructors should be implemented. Each constructor should create a corresponding subscription.Subscription based on input arguments, and store topic, subscription and other necessary parameters in a newly created instance. These constructors should be called in a DataProviderFactory::NewDataProvider method.

  2. messagesHandler should be implemented for each handler type. This method will be triggered by the constructor in the separate goroutine and will run in a forever loop until the subscription is closed. This method collects streaming data from the subscription, similar to how we do it, for example in SubscribeBlockHeadersFromStartBlockID:

flow-go/access/handler.go

Lines 1181 to 1182 in 3496c0f

sub := h.api.SubscribeBlockHeadersFromStartBlockID(stream.Context(), startBlockID, blockStatus)
return subscription.HandleSubscription(sub, h.handleBlockHeadersResponse(stream.Send))

Then the data is formatted in response messages for the client and written to the broadcastMessage callback. The data response message structure is next:

{
    id: 'sub123',
    topic: 'blocks',
    data: [...],
}
  1. The Close method should be implemented to gracefully shut down the subscription and close messagesHandler processing.

  2. ID and Topic getters should return subscription.Subscription ID and topic that stores in the handler.

Tasks

Preview Give feedback
@Guitarheroua Guitarheroua changed the title [Access] Add implementation BlockSubscriptionHandler for blocks subscription [Access] Add implementation BlockSubscriptionHandler for blocks subscriptions Oct 22, 2024
@Guitarheroua Guitarheroua changed the title [Access] Add implementation BlockSubscriptionHandler for blocks subscriptions [Access] Add implementation BlockSubscriptionHandler, BlockHeaderSubscriptionHandler and BlockDigestsSubscriptionHandler for blocks and block headers subscriptions Oct 22, 2024
@Guitarheroua Guitarheroua changed the title [Access] Add implementation BlockSubscriptionHandler, BlockHeaderSubscriptionHandler and BlockDigestsSubscriptionHandler for blocks and block headers subscriptions [Access] Add implementation for blocks, block headers and block digests data providers Nov 12, 2024
@peterargue
Copy link
Contributor

closed by #6636

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants