feat: async block writers #516
Labels
Block Node
Issues/PR related to the Block Node.
New Feature
A new feature, service, or documentation. Major changes that are not backwards compatible.
P1
High priority issue. Required to be completed in the assigned milestone.
Story:
AS A Block Node Operator
I WANT the Block Node to be as performant as possible
SO THAT I can minimize operating costs.
This task aims to improve the architecture and the performance of the local persistence handler.
DEPENDS ON: #309
Tech Notes:
Currently, the local block writer abstraction is neither async, nor stateless. To make it async, we need to detach the writer from having any other logic than simply writing a batch of files to the appropriate place. The writer must not be bothered with checking any state, making calculations or decisions "should or shouldn't I write some files to some place". The block writer must simply be supplied some data to persist and once it is flagged that it has received everything, it should then do it's work and be gone once it is done.
One important note is that we are constantly receiving the block stream, guaranteed that we have a batch of block items. Batches can start with a block header and can end with block proof. It absolutely cannot start with a block proof, nor can end with a block header! Also, it absolutely cannot have a block header or proof somewhere in the middle of the received batch. This allows us to very easily denote and distinguish where a block starts (we check that a received batch starts with a block header) and where it ends (we check that a received batch ends with a block proof), all batches of items received in between such batches (if any) are always of items for the given denoted block.
All that beings said, In order to achieve async writing of the block files, we need to do the following:
The text was updated successfully, but these errors were encountered: