Line data Source code
1 : #ifndef HEADER_fd_src_disco_topo_fd_topo_vinyl_h
2 : #define HEADER_fd_src_disco_topo_fd_topo_vinyl_h
3 :
4 : /* fd_topob_vinyl.h provides APIs for building topologies with vinyl
5 : servers and clients. */
6 :
7 : #include "fd_topob.h"
8 : #include "../../util/pod/fd_pod_format.h"
9 :
10 : FD_PROTOTYPES_BEGIN
11 :
12 : /* fd_topob_vinyl_client declares a new vinyl client and attaches it to
13 : a vinyl instance. Creates vinyl_rq and vinyl_req_pool objects,
14 : reserves a link_id, and maps the objects into client and vinyl tiles. */
15 :
16 : FD_FN_UNUSED static fd_topo_obj_t *
17 : fd_topob_vinyl_rq( fd_topo_t * topo,
18 : char const * tile_name,
19 : ulong tile_kind_id,
20 : char const * wksp_name,
21 : char const * link_name,
22 : ulong req_batch_max,
23 : ulong req_batch_key_max,
24 0 : ulong quota_max ) {
25 :
26 : /* Assumes there is only one vinyl tile in the topology */
27 0 : ulong vinyl_tile_id;
28 0 : FD_TEST( ( vinyl_tile_id = fd_topo_find_tile( topo, "vinyl", 0UL ) )!=ULONG_MAX );
29 0 : fd_topo_tile_t * vinyl_tile = &topo->tiles[ vinyl_tile_id ];
30 :
31 0 : ulong client_tile_id;
32 0 : FD_TEST( ( client_tile_id = fd_topo_find_tile( topo, tile_name, tile_kind_id ) )!=ULONG_MAX );
33 0 : if( FD_UNLIKELY( client_tile_id==ULONG_MAX ) ) FD_LOG_ERR(( "tile not found: %s:%lu", tile_name, tile_kind_id ));
34 0 : fd_topo_tile_t * client_tile = &topo->tiles[ client_tile_id ];
35 :
36 0 : fd_topo_obj_t * req_pool_obj = fd_topob_obj_named( topo, "vinyl_rpool", wksp_name, link_name );
37 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, req_batch_max, "obj.%lu.batch_max", req_pool_obj->id ) );
38 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, req_batch_key_max, "obj.%lu.batch_key_max", req_pool_obj->id ) );
39 :
40 0 : fd_topo_obj_t * rq_obj = fd_topob_obj_named( topo, "vinyl_rq", wksp_name, link_name );
41 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, req_batch_max, "obj.%lu.req_cnt", rq_obj->id ) );
42 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, rq_obj->id, "obj.%lu.link_id", rq_obj->id ) );
43 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, quota_max, "obj.%lu.quota_max", rq_obj->id ) );
44 :
45 : /* No database client uses the completion queue yet, but one is
46 : required to join a database client to the server. */
47 0 : fd_topo_obj_t * cq_obj = fd_topob_obj_named( topo, "vinyl_cq", wksp_name, link_name );
48 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, 4UL, "obj.%lu.comp_cnt", cq_obj->id ) );
49 :
50 : /* Associate req_pool and cq with rq */
51 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, req_pool_obj->id, "obj.%lu.req_pool_obj_id", rq_obj->id ) );
52 0 : FD_TEST( fd_pod_insertf_ulong( topo->props, cq_obj->id, "obj.%lu.cq_obj_id", rq_obj->id ) );
53 :
54 0 : fd_topob_tile_uses( topo, vinyl_tile, req_pool_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
55 0 : fd_topob_tile_uses( topo, vinyl_tile, rq_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
56 0 : fd_topob_tile_uses( topo, vinyl_tile, cq_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
57 :
58 0 : fd_topob_tile_uses( topo, client_tile, req_pool_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
59 0 : fd_topob_tile_uses( topo, client_tile, rq_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
60 0 : fd_topob_tile_uses( topo, client_tile, cq_obj, FD_SHMEM_JOIN_MODE_READ_ONLY );
61 :
62 0 : FD_TEST( rq_obj->label_idx==req_pool_obj->label_idx ); /* keep rq and req_pool in sync */
63 0 : return rq_obj;
64 0 : }
65 :
66 : FD_PROTOTYPES_END
67 :
68 : #endif /* HEADER_fd_src_disco_topo_fd_topo_vinyl_h */
|