Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
llama-util.h
Go to the documentation of this file.
1 // Copyright 2012 Cloudera Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef IMPALA_UTIL_LLAMA_UTIL_H
16 #define IMPALA_UTIL_LLAMA_UTIL_H
17 
18 #include <ostream>
19 #include <string>
20 #include <boost/functional/hash.hpp>
21 
22 #include "gen-cpp/Types_types.h" // for TUniqueId
23 #include "gen-cpp/Llama_types.h" // for TUniqueId
24 #include "common/status.h"
25 
26 namespace llama {
27 
28 std::ostream& operator<<(std::ostream& os, const llama::TUniqueId& id);
29 std::ostream& operator<<(std::ostream& os, const llama::TNetworkAddress& address);
30 std::ostream& operator<<(std::ostream& os, const llama::TResource& resource);
31 std::ostream& operator<<(std::ostream& os, const llama::TAllocatedResource& resource);
32 
33 std::ostream& operator<<(std::ostream& os,
34  const llama::TLlamaAMGetNodesRequest& request);
35 std::ostream& operator<<(std::ostream& os,
36  const llama::TLlamaAMReservationRequest& request);
37 std::ostream& operator<<(std::ostream& os,
38  const llama::TLlamaAMReservationExpansionRequest& request);
39 std::ostream& operator<<(std::ostream& os,
40  const llama::TLlamaAMReleaseRequest& request);
41 
43 llama::TUniqueId& operator<<(llama::TUniqueId& dest, const impala::TUniqueId& src);
44 impala::TUniqueId& operator<<(impala::TUniqueId& dest, const llama::TUniqueId& src);
45 
46 bool operator==(const impala::TUniqueId& impala_id, const llama::TUniqueId& llama_id);
47 
48 llama::TNetworkAddress& operator<<(llama::TNetworkAddress& dest,
49  const impala::TNetworkAddress& src);
50 impala::TNetworkAddress& operator<<(impala::TNetworkAddress& dest,
51  const llama::TNetworkAddress& src);
52 
53 impala::Status LlamaStatusToImpalaStatus(const llama::TStatus& status,
54  const std::string& err_prefix = "");
55 
57 inline std::size_t hash_value(const llama::TUniqueId& id) {
58  std::size_t seed = 0;
59  boost::hash_combine(seed, id.lo);
60  boost::hash_combine(seed, id.hi);
61  return seed;
62 }
63 
66 std::string GetShortName(const std::string& user);
67 
68 }
69 
70 #endif
ostream & operator<<(ostream &os, const TUniqueId &id)
Definition: llama-util.cc:30
std::size_t hash_value(const llama::TUniqueId &id)
This function must be called 'hash_value' to be picked up by boost.
Definition: llama-util.h:57
impala::Status LlamaStatusToImpalaStatus(const TStatus &status, const string &err_prefix)
Definition: llama-util.cc:127
bool operator==(const impala::TUniqueId &impala_id, const llama::TUniqueId &llama_id)
Definition: llama-util.cc:109
string GetShortName(const string &user)
Definition: llama-util.cc:135