14
14
This crate uses Tower to define an asynchronous ABCI interface. It has two parts:
15
15
16
16
1 . An ABCI server, which listens for connections and forwards ABCI requests
17
- to one of four user-provided [ ` Service ` ] [ svc ] s, each responsible for processing
18
- one category of requests (consensus, mempool, info, or snapshot).
17
+ to one of four user-provided [ ` Service ` ] [ svc ] s, each responsible for processing
18
+ one category of requests (consensus, mempool, info, or snapshot).
19
19
20
20
2 . Middleware that splits a single [ ` Service ` ] [ svc ] implementing all of ABCI
21
- into four cloneable component services, each implementing one category of
22
- requests. The component services use message-passing to share access to the
23
- main service, which processes requests with the following category-based
24
- prioritization:
25
- 1. ` ConsensusRequest ` s sent to the ` Consensus ` service;
26
- 2. ` MempoolRequest ` s sent to the ` Mempool ` service;
27
- 3. ` SnapshotRequest ` s sent to the ` Snapshot ` service;
28
- 4. ` InfoRequest ` s sent to the ` Info ` service.
21
+ into four cloneable component services, each implementing one category of
22
+ requests. The component services use message-passing to share access to the
23
+ main service, which processes requests with the following category-based
24
+ prioritization:
25
+ 1. ` ConsensusRequest ` s sent to the ` Consensus ` service;
26
+ 2. ` MempoolRequest ` s sent to the ` Mempool ` service;
27
+ 3. ` SnapshotRequest ` s sent to the ` Snapshot ` service;
28
+ 4. ` InfoRequest ` s sent to the ` Info ` service.
29
29
30
30
Because the ABCI server takes one service per category, users can apply Tower
31
31
layers to the services they pass to the ABCI ` Server ` to add
@@ -35,33 +35,33 @@ These parts can be combined in different ways to provide different points on
35
35
the tradeoff curve between implementation complexity and performance:
36
36
37
37
1 . At the lowest level of complexity, application developers can implement an
38
- ABCI application entirely synchronously. To do this, they implement
39
- ` Service<Request> ` so that ` Service::call ` performs request processing and
40
- returns a ready future. Then they use ` split::service ` to create four
41
- component services that share access to their application, and use those to
42
- construct the ABCI ` Server ` . The application developer does not need to
43
- manage synchronization of shared state between different clones of their
44
- application, because there is only one copy of their application.
38
+ ABCI application entirely synchronously. To do this, they implement
39
+ ` Service<Request> ` so that ` Service::call ` performs request processing and
40
+ returns a ready future. Then they use ` split::service ` to create four
41
+ component services that share access to their application, and use those to
42
+ construct the ABCI ` Server ` . The application developer does not need to
43
+ manage synchronization of shared state between different clones of their
44
+ application, because there is only one copy of their application.
45
45
46
46
2 . At the next level of complexity, application developers can implement an
47
- ABCI application partially synchronously. As before, they implement
48
- ` Service<Request> ` to create a single ABCI application, but instead of
49
- processing all requests in the body of ` Service::call ` , they can defer
50
- processing of some requests by immediately returning a future that will be
51
- executed on the caller's task. Although all requests are still received by
52
- the application task, not all request processing needs to happen on the
53
- application task.
54
- At this level the developer must pay closer attention to utilising Tower
55
- layers to control the concurrency of the individual services mentioned above.
56
- In particular the ` Consensus ` service should be wrapped with
57
- ` ServiceBuilder::concurrency_limit ` of 1 to avoid a potential reordering of
58
- consensus message effects caused by concurrent execution, as well as
59
- ` ServiceBuilder::buffer ` to avoid any deadlocks in message handling in ` Connection `
60
- due to the limited concurrency.
47
+ ABCI application partially synchronously. As before, they implement
48
+ ` Service<Request> ` to create a single ABCI application, but instead of
49
+ processing all requests in the body of ` Service::call ` , they can defer
50
+ processing of some requests by immediately returning a future that will be
51
+ executed on the caller's task. Although all requests are still received by
52
+ the application task, not all request processing needs to happen on the
53
+ application task.
54
+ At this level the developer must pay closer attention to utilising Tower
55
+ layers to control the concurrency of the individual services mentioned above.
56
+ In particular the ` Consensus ` service should be wrapped with
57
+ ` ServiceBuilder::concurrency_limit ` of 1 to avoid a potential reordering of
58
+ consensus message effects caused by concurrent execution, as well as
59
+ ` ServiceBuilder::buffer ` to avoid any deadlocks in message handling in ` Connection `
60
+ due to the limited concurrency.
61
61
62
62
3 . At the highest level of complexity, application developers can implement
63
- multiple distinct ` Service ` s and manually control synchronization of shared
64
- state between them, then use these to construct the ABCI ` Server ` .
63
+ multiple distinct ` Service ` s and manually control synchronization of shared
64
+ state between them, then use these to construct the ABCI ` Server ` .
65
65
66
66
Because these use the same interfaces in different ways, application
67
67
developers can move gradually along this curve according to their performance
0 commit comments