blob: 72ab00de8029516363f50e3687439187896bca5d [file] [log] [blame]
Marc Kupietz4b799e92018-01-02 11:04:56 +01001#include <typeinfo>
2#include <stdint.h>
3#include "rocksdb/cache.h"
4#include "rocksdb/comparator.h"
5#include "rocksdb/db.h"
6#include "rocksdb/env.h"
7#include <rocksdb/merge_operator.h>
8#include "rocksdb/utilities/db_ttl.h"
9#include "merge_operators.h"
10
11#define IS_BIG_ENDIAN (*(uint16_t *)"\0\xff" < 0x100)
12#define encodeCollocation(w1, w2, dist) (((uint64_t)dist << 56) | ((uint64_t)w2 << 24) | w1)
13#define W1(key) (uint64_t)(key & 0xffffff)
14#define W2(key) (uint64_t)((key >> 24) & 0xffffff)
15#define DIST(key) (int8_t)((uint64_t)((key >> 56) & 0xff))
16
17namespace rocksdb {
18 class CollocatorIterator : public Iterator {
19 public:
20 CollocatorIterator(const Iterator& it);
21 void SeekToFirst();
22 void SeekToLast();
23 void Seek(const rocksdb::Slice&);
24 void Prev();
25 bool isValid();
26 uint64_t intValue();
27 uint64_t intKey();
28 };
29
30 class Collocators {
31 public:
32 Collocators(const char *db_name);
33 ~Collocators();
34 void inc(const uint32_t w1, const uint32_t w2, const uint8_t dist);
35 CollocatorIterator* SeekIterator(uint64_t w1, uint64_t w2, int8_t dist);
36 };
37
38}