m2etis  0.4
ChimeraWrapper.h
Go to the documentation of this file.
1 /*
2  Copyright (2016) Michael Baer, Daniel Bonrath, All rights reserved.
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15  */
16 
17 #ifndef __M2ETIS_WRAPPER_CHIMERA_CHIMERAWRAPPER_H__
18 #define __M2ETIS_WRAPPER_CHIMERA_CHIMERAWRAPPER_H__
19 
20 #include <string>
21 
25 #include "m2etis/net/NodeHandle.h"
26 
27 namespace m2etis {
28 namespace wrapper {
29 namespace chimera {
30 
31  class ChimeraWrapperImpl;
32 
36  class ChimeraWrapper : public net::NetworkInterface<net::NetworkType<net::CHIMERA>> {
37  private:
38  ChimeraWrapperImpl * _impl;
39  ChimeraWrapper(const ChimeraWrapper & rhs);
40 
41  ChimeraWrapper & operator=(const ChimeraWrapper & rhs);
42 
43  public:
44  enum { keysize = 40 };
47 
48  void init(const int port);
49 
50  void init(const int port, const std::string & known_hostname, const int know_hostport);
51 
53 
54  std::list<net::NodeHandle<net::NetworkType<net::CHIMERA> >::Ptr> local_lookup(const net::NetworkType<net::CHIMERA>::Key & key, const int num, const bool safe) const;
55 
56  std::list<net::NodeHandle<net::NetworkType<net::CHIMERA> >::Ptr> neighborSet(const int num) const;
57 
58  std::list<net::NodeHandle<net::NetworkType<net::CHIMERA> >::Ptr> replicaSet(const net::NetworkType<net::CHIMERA>::Key & key, const int maxRank) const;
59 
61 
63 
64  void registerMessageType(const message::MessageType type, const bool ack) const;
65 
66  void send(const typename message::NetworkMessage<net::NetworkType<net::CHIMERA>>::Ptr msg, typename net::NodeHandle<net::NetworkType<net::CHIMERA>>::Ptr_const hint);
67 
68  void send(const typename message::NetworkMessage<net::NetworkType<net::CHIMERA>>::Ptr msg);
69  };
70 
71 } /* namespace chimera */
72 } /* namespace wrapper */
73 } /* namespace m2etis */
74 
75 #endif /* __M2ETIS_WRAPPER_CHIMERA_CHIMERAWRAPPER_H__ */
bool range(const net::NodeHandle< net::NetworkType< net::CHIMERA >>::Ptr node, int rank, const net::NetworkType< net::CHIMERA >::Key &lkey, const net::NetworkType< net::CHIMERA >::Key &rkey) const
NodeHandle in different structured p2p-systems.
Definition: NodeHandle.h:44
net::NodeHandle< net::NetworkType< net::CHIMERA > >::Ptr getSelfNodeHandle() const
query your NodeHandle. You may query that for it's key.
std::list< net::NodeHandle< net::NetworkType< net::CHIMERA > >::Ptr > neighborSet(const int num) const
std::list< net::NodeHandle< net::NetworkType< net::CHIMERA > >::Ptr > replicaSet(const net::NetworkType< net::CHIMERA >::Key &key, const int maxRank) const
void registerMessageType(const message::MessageType type, const bool ack) const
The C++-wrapper around chimera.
std::list< net::NodeHandle< net::NetworkType< net::CHIMERA > >::Ptr > local_lookup(const net::NetworkType< net::CHIMERA >::Key &key, const int num, const bool safe) const
void send(const typename message::NetworkMessage< net::NetworkType< net::CHIMERA >>::Ptr msg, typename net::NodeHandle< net::NetworkType< net::CHIMERA >>::Ptr_const hint)
uint32_t MessageType
Definition: MessageType.h:35
bool isResponsibleFor(const net::NetworkType< net::CHIMERA >::Key &key, const net::NetworkType< net::CHIMERA >::Key &node) const