• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

linxGnu / grocksdb / 6067355637

03 Sep 2023 11:32PM UTC coverage: 66.95% (+0.02%) from 66.93%
6067355637

push

github

web-flow
Adapt RocksDB 8.4.4 (#125)

3 of 3 new or added lines in 1 file covered. (100.0%)

3308 of 4941 relevant lines covered (66.95%)

0.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

37.5
/cuckoo_table.go
1
package grocksdb
2

3
// #include "rocksdb/c.h"
4
import "C"
5

6
// CuckooTableOptions are options for cuckoo table.
7
type CuckooTableOptions struct {
8
        c *C.rocksdb_cuckoo_table_options_t
9
}
10

11
// NewCuckooTableOptions returns new cuckoo table options.
12
func NewCuckooTableOptions() *CuckooTableOptions {
1✔
13
        return &CuckooTableOptions{
1✔
14
                c: C.rocksdb_cuckoo_options_create(),
1✔
15
        }
1✔
16
}
1✔
17

18
// Destroy options.
19
func (opts *CuckooTableOptions) Destroy() {
1✔
20
        C.rocksdb_cuckoo_options_destroy(opts.c)
1✔
21
        opts.c = nil
1✔
22
}
1✔
23

24
// SetHashRatio determines the utilization of hash tables. Smaller values
25
// result in larger hash tables with fewer collisions.
26
//
27
// Default: 0.9.
28
func (opts *CuckooTableOptions) SetHashRatio(value float64) {
×
29
        C.rocksdb_cuckoo_options_set_hash_ratio(opts.c, C.double(value))
×
30
}
×
31

32
// SetMaxSearchDepth property used by builder to determine the depth to go to
33
// to search for a path to displace elements in case of
34
// collision. See Builder.MakeSpaceForKey method. Higher
35
// values result in more efficient hash tables with fewer
36
// lookups but take more time to build.
37
//
38
// Default: 100.
39
func (opts *CuckooTableOptions) SetMaxSearchDepth(value uint32) {
×
40
        C.rocksdb_cuckoo_options_set_max_search_depth(opts.c, C.uint32_t(value))
×
41
}
×
42

43
// SetCuckooBlockSize in case of collision while inserting, the builder
44
// attempts to insert in the next cuckoo_block_size
45
// locations before skipping over to the next Cuckoo hash
46
// function. This makes lookups more cache friendly in case
47
// of collisions.
48
//
49
// Default: 5.
50
func (opts *CuckooTableOptions) SetCuckooBlockSize(value uint32) {
×
51
        C.rocksdb_cuckoo_options_set_cuckoo_block_size(opts.c, C.uint32_t(value))
×
52
}
×
53

54
// SetIdentityAsFirstHash if this option is enabled, user key is treated as uint64_t and its value
55
// is used as hash value directly. This option changes builder's behavior.
56
// Reader ignore this option and behave according to what specified in table
57
// property.
58
//
59
// Default: false.
60
func (opts *CuckooTableOptions) SetIdentityAsFirstHash(value bool) {
×
61
        C.rocksdb_cuckoo_options_set_identity_as_first_hash(opts.c, boolToChar(value))
×
62
}
×
63

64
// SetUseModuleHash if this option is set to true, module is used during hash calculation.
65
// This often yields better space efficiency at the cost of performance.
66
// If this option is set to false, # of entries in table is constrained to be
67
// power of two, and bit and is used to calculate hash, which is faster in
68
// general.
69
//
70
// Default: true
71
func (opts *CuckooTableOptions) SetUseModuleHash(value bool) {
×
72
        C.rocksdb_cuckoo_options_set_use_module_hash(opts.c, boolToChar(value))
×
73
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc