Hermes  0.9.5-beta
Hierarchical Distributed I/O Buffering System
hermes.h
Go to the documentation of this file.
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 
22 #ifndef HERMES_H_
23 #define HERMES_H_
24 
25 #include <glog/logging.h>
26 
27 #include <cstdint>
28 #include <string>
29 
30 #include "buffer_pool.h"
31 #include "hermes_types.h"
32 #include "metadata_management.h"
33 #include "rpc.h"
34 
37 namespace hermes {
38 namespace api {
39 
44 std::string GetVersion();
45 
47 class Hermes {
48  public:
51 
52  // TODO(chogan): Temporarily public to facilitate iterative development.
60  std::string shmem_name_;
62  std::string rpc_server_name_;
63 
64  Hermes() {}
65 
69  explicit Hermes(SharedMemoryContext context) : context_(context) {}
70 
78  bool IsApplicationCore();
79 
87  bool IsFirstRankOnNode();
88 
93  void AppBarrier();
94 
101  int GetProcessRank();
102 
109  int GetNodeId();
110 
117  int GetNumProcesses();
118 
128  void *GetAppCommunicator();
129 
138  void Finalize(bool force_rpc_shutdown = false);
139 
148  void FinalizeClient(bool stop_daemon = true);
149 
153  void RemoteFinalize();
154 
161  void RunDaemon();
162 
170  bool BucketContainsBlob(const std::string &bucket_name,
171  const std::string &blob_name);
172 
179  bool BucketExists(const std::string &bucket_name);
180 };
181 
182 class Bucket;
183 
185 Status RenameBucket(const std::string &old_name, const std::string &new_name,
186  Context &ctx);
187 
189 Status TransferBlob(const Bucket &src_bkt, const std::string &src_blob_name,
190  Bucket &dst_bkt, const std::string &dst_blob_name,
191  Context &ctx);
192 
205 std::shared_ptr<api::Hermes> InitHermes(const char *config_file = NULL,
206  bool is_daemon = false,
207  bool is_adapter = false);
208 
209 } // namespace api
210 
221 std::shared_ptr<api::Hermes> InitHermes(Config *config, bool is_daemon = false,
222  bool is_adapter = false);
223 
238 std::shared_ptr<api::Hermes> InitHermesDaemon(char *config_file = NULL);
239 
244 std::shared_ptr<api::Hermes> InitHermesDaemon(Config *config);
245 
255 std::shared_ptr<api::Hermes> InitHermesClient(const char *config_file = NULL);
256 
257 } // namespace hermes
258 
259 #endif // HERMES_H_
Definition: hermes_status.h:80
Definition: hermes.h:47
hermes::CommunicationContext comm_
Definition: hermes.h:54
hermes::Arena trans_arena_
Definition: hermes.h:56
bool BucketExists(const std::string &bucket_name)
Returns true if bucket_name exists in this Hermes instance.
Definition: hermes.cc:96
void Finalize(bool force_rpc_shutdown=false)
Shutdown Hermes.
Definition: hermes.cc:127
bool is_initialized
Definition: hermes.h:50
void AppBarrier()
A barrier across all application processes.
Definition: hermes.cc:84
hermes::SharedMemoryContext context_
Definition: hermes.h:53
void * GetAppCommunicator()
Get an application communicator handle.
Definition: hermes.cc:121
void RunDaemon()
Starts a Hermes daemon.
Definition: hermes.cc:141
std::string rpc_server_name_
Definition: hermes.h:62
bool IsFirstRankOnNode()
Returns true if this is the first MPI rank on this node, otherwise false.
Definition: hermes.cc:78
int GetNumProcesses()
Returns the total number of application processes.
Definition: hermes.cc:115
bool BucketContainsBlob(const std::string &bucket_name, const std::string &blob_name)
Check if a given Bucket contains a Blob.
Definition: hermes.cc:88
void RemoteFinalize()
Definition: hermes.cc:137
void FinalizeClient(bool stop_daemon=true)
Shutdown application cores.
Definition: hermes.cc:133
Hermes(SharedMemoryContext context)
Definition: hermes.h:69
bool IsApplicationCore()
Return true if this rank is an application core, otherwise false.
Definition: hermes.cc:72
hermes::RpcContext rpc_
Definition: hermes.h:55
std::string shmem_name_
Definition: hermes.h:60
int GetNodeId()
Return ID of the node this process is running on.
Definition: hermes.cc:109
int GetProcessRank()
Returns the rank of this process.
Definition: hermes.cc:103
Definition: adapter_utils.cc:35
std::shared_ptr< api::Hermes > InitHermesClient(const char *config_file)
Initialize a Hermes instance as a client or adapter.
Definition: hermes.cc:436
std::shared_ptr< api::Hermes > InitHermes(Config *config, bool is_daemon, bool is_adapter)
Definition: hermes.cc:318
void RenameBucket(SharedMemoryContext *context, RpcContext *rpc, BucketID id, const std::string &old_name, const std::string &new_name)
Definition: metadata_management.cc:972
std::shared_ptr< api::Hermes > InitHermesDaemon(char *config_file)
Initialize a Hermes instance as a daemon.
Definition: hermes.cc:443
Definition: memory_management.h:84
Definition: communication.h:35
Definition: rpc.h:43
Definition: buffer_pool.h:273