Hermes  0.9.5-beta
Hierarchical Distributed I/O Buffering System
rpc.h
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Distributed under BSD 3-Clause license. *
3  * Copyright by The HDF Group. *
4  * Copyright by the Illinois Institute of Technology. *
5  * All rights reserved. *
6  * *
7  * This file is part of Hermes. The full Hermes copyright notice, including *
8  * terms governing use, modification, and redistribution, is contained in *
9  * the COPYING file, which can be found at the top directory. If you do not *
10  * have access to the file, you may request a copy from help@hdfgroup.org. *
11  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
12 
13 #ifndef HERMES_RPC_H_
14 #define HERMES_RPC_H_
15 
16 #include <string>
17 #include <vector>
18 
19 #include "hermes_types.h"
20 #include "metadata_management.h"
21 
22 namespace hermes {
23 
24 struct RpcContext;
25 
26 const int kMaxServerNameSize = 128;
27 const int kMaxServerSuffixSize = 16;
31  const char *, int);
36  void *state;
37  size_t state_size;
38 };
39 
43 struct RpcContext {
45  void *state;
47  size_t state_size;
53  int port;
56  // TODO(chogan): Also allow reading hostnames from a file for heterogeneous or
57  // non-contiguous hostnames (e.g., compute-node-20, compute-node-30,
58  // storage-node-16, storage-node-24)
59  // char *host_file_name;
60 
62 };
63 
64 void InitRpcContext(RpcContext *rpc, u32 num_nodes, u32 node_id,
65  Config *config);
66 void *CreateRpcState(Arena *arena);
67 void InitRpcClients(RpcContext *rpc);
69 void RunDaemon(SharedMemoryContext *context, RpcContext *rpc,
70  CommunicationContext *comm, Arena *trans_arena,
71  const char *shmem_name);
73  CommunicationContext *comm, Arena *trans_arena,
74  bool stop_daemon);
75 void FinalizeRpcContext(RpcContext *rpc, bool is_daemon);
76 std::string GetServerName(RpcContext *rpc, u32 node_id,
77  bool is_buffer_organizer = false);
78 std::string GetProtocol(RpcContext *rpc);
80  Arena *arena, const char *addr, int num_threads,
81  int port);
82 } // namespace hermes
83 
84 // TODO(chogan): I don't like that code similar to this is in buffer_pool.cc.
85 // I'd like to only have it in one place.
86 #if defined(HERMES_RPC_THALLIUM)
87 #include "rpc_thallium.h"
88 #else
89 #error "RPC implementation required (e.g., -DHERMES_RPC_THALLIUM)."
90 #endif
91 
92 #endif // HERMES_RPC_H_
Definition: adapter_utils.cc:35
void InitRpcContext(RpcContext *rpc, u32 num_nodes, u32 node_id, Config *config)
Definition: rpc_thallium.cc:643
void InitRpcClients(RpcContext *rpc)
Definition: rpc_thallium.cc:679
void StartBufferOrganizer(SharedMemoryContext *context, RpcContext *rpc, Arena *arena, const char *addr, int num_threads, int port)
Definition: rpc_thallium.cc:504
void FinalizeClient(SharedMemoryContext *context, RpcContext *rpc, CommunicationContext *comm, Arena *trans_arena, bool stop_daemon)
Definition: rpc_thallium.cc:752
void RunDaemon(SharedMemoryContext *context, RpcContext *rpc, CommunicationContext *comm, Arena *trans_arena, const char *shmem_name)
Definition: rpc_thallium.cc:720
std::string GetProtocol(RpcContext *rpc)
Definition: rpc_thallium.cc:667
uint32_t u32
Definition: hermes_types.h:42
void ShutdownRpcClients(RpcContext *rpc)
Definition: rpc_thallium.cc:691
std::string GetServerName(RpcContext *rpc, u32 node_id, bool is_buffer_organizer=false)
Definition: rpc_thallium.cc:802
void(* StartFunc)(SharedMemoryContext *, RpcContext *, Arena *, const char *, int)
Definition: rpc.h:30
const int kMaxServerSuffixSize
Definition: rpc.h:27
const int kMaxServerNameSize
Definition: rpc.h:26
void * CreateRpcState(Arena *arena)
Definition: rpc_thallium.cc:660
void FinalizeRpcContext(RpcContext *rpc, bool is_daemon)
Definition: rpc_thallium.cc:704
Definition: memory_management.h:84
Definition: rpc.h:35
size_t state_size
Definition: rpc.h:37
void * state
Definition: rpc.h:36
Definition: communication.h:35
Definition: hermes_types.h:258
Definition: rpc.h:43
StartFunc start_server
Definition: rpc.h:61
ClientRpcContext client_rpc
Definition: rpc.h:44
int port
Definition: rpc.h:53
size_t state_size
Definition: rpc.h:47
u32 node_id
Definition: rpc.h:51
u32 num_nodes
Definition: rpc.h:52
ShmemString * host_names
Definition: rpc.h:50
void * state
Definition: rpc.h:45
bool use_host_file
Definition: rpc.h:54
Definition: buffer_pool.h:273
Definition: metadata_management.h:45