identt
StoreBase.hpp
Go to the documentation of this file.
1 
33 #ifndef _IDENTT_STORE_STOREBASE_HPP_
34 #define _IDENTT_STORE_STOREBASE_HPP_
35 
36 #define IDENTT_MEGABYTE 1024 * 1024LL
37 #define IDENTT_STRN_BLANK ""
38 #define IDENTT_MIN_TIME 1450000000
39 #define IDENTT_MAX_TIME 2000000000
40 
41 
42 #define IDENTT_KEYID_LEN 2
43 
44 #ifdef IDENTT_USE_BASE80_KEYS
45 #define IDENTT_NODE_LEN 10
46 #else
47 #define IDENTT_NODE_LEN 16
48 #endif
49 
50 #define IDENTT_STRING_MAXLEN 1024
51 #define IDENTT_LEN_NODE_KEY IDENTT_KEYID_LEN + IDENTT_NODE_LEN
52 
53 #include <utils/BaseUtils.hpp>
54 #include "../proto/Store.pb.h"
55 
56 namespace identt {
57 namespace store {
58 class StoreBase {
59 public:
60 
61 
71  std::string EncodeKeyType (KeyTypeE keytype);
72 
85  std::string EncodePrimaryKey (KeyTypeE keytype, ::google::protobuf::uint64 id);
86 
96  std::pair<KeyTypeE,uint64_t> DecodePrimaryKey (std::string& key);
97 
110  template<typename T>
111  std::string EncodeSecondaryKey (KeyTypeE keytype, T key);
112 
128  template<typename T, typename U>
129  std::string EncodeSecondaryKey (KeyTypeE keytype, T key1, U key2);
130 
149  template<typename T, typename U, typename V>
150  std::string EncodeSecondaryKey (KeyTypeE keytype, T key1, U key2, V key3);
151 
152 private:
153 };
154 } // namespace store
155 } // namespace identt
156 #endif /* _IDENTT_STORE_STOREBASE_HPP_ */
Definition: StoreBase.hpp:58
std::string EncodePrimaryKey(KeyTypeE keytype, ::google::protobuf::uint64 id)
EncodePrimaryKey : make primary key with id only.
Definition: StoreBase.cc:124
std::string EncodeSecondaryKey(KeyTypeE keytype, T key)
EncodeSecondaryKey : make secondary key with one variable only.
Definition: CryptoBase.hpp:49
std::string EncodeKeyType(KeyTypeE keytype)
EncodeKeyType : make prefix key with keytype.
Definition: StoreBase.cc:113
std::pair< KeyTypeE, uint64_t > DecodePrimaryKey(std::string &key)
DecodePrimaryKey : get keytype and id from primary key.
Definition: StoreBase.cc:135