• 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

13.64
/options_transaction.go
1
package grocksdb
2

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

6
// TransactionOptions represent all of the available options options for
7
// a transaction on the database.
8
type TransactionOptions struct {
9
        c *C.rocksdb_transaction_options_t
10
}
11

12
// NewDefaultTransactionOptions creates a default TransactionOptions object.
13
func NewDefaultTransactionOptions() *TransactionOptions {
1✔
14
        return newNativeTransactionOptions(C.rocksdb_transaction_options_create())
1✔
15
}
1✔
16

17
// NewNativeTransactionOptions creates a TransactionOptions object.
18
func newNativeTransactionOptions(c *C.rocksdb_transaction_options_t) *TransactionOptions {
1✔
19
        return &TransactionOptions{c: c}
1✔
20
}
1✔
21

22
// SetSetSnapshot to true is the same as calling
23
// Transaction::SetSnapshot().
24
func (opts *TransactionOptions) SetSetSnapshot(value bool) {
×
25
        C.rocksdb_transaction_options_set_set_snapshot(opts.c, boolToChar(value))
×
26
}
×
27

28
// SetDeadlockDetect to true means that before acquiring locks, this transaction will
29
// check if doing so will cause a deadlock. If so, it will return with
30
// Status::Busy.  The user should retry their transaction.
31
func (opts *TransactionOptions) SetDeadlockDetect(value bool) {
×
32
        C.rocksdb_transaction_options_set_deadlock_detect(opts.c, boolToChar(value))
×
33
}
×
34

35
// SetLockTimeout positive, specifies the wait timeout in milliseconds when
36
// a transaction attempts to lock a key.
37
// If 0, no waiting is done if a lock cannot instantly be acquired.
38
// If negative, TransactionDBOptions::transaction_lock_timeout will be used
39
func (opts *TransactionOptions) SetLockTimeout(lockTimeout int64) {
×
40
        C.rocksdb_transaction_options_set_lock_timeout(opts.c, C.int64_t(lockTimeout))
×
41
}
×
42

43
// SetExpiration sets the Expiration duration in milliseconds.
44
// If non-negative, transactions that last longer than this many milliseconds will fail to commit.
45
// If not set, a forgotten transaction that is never committed, rolled back, or deleted
46
// will never relinquish any locks it holds.  This could prevent keys from
47
// being written by other writers.
48
func (opts *TransactionOptions) SetExpiration(expiration int64) {
×
49
        C.rocksdb_transaction_options_set_expiration(opts.c, C.int64_t(expiration))
×
50
}
×
51

52
// SetDeadlockDetectDepth sets the number of traversals to make during deadlock detection.
53
func (opts *TransactionOptions) SetDeadlockDetectDepth(depth int64) {
×
54
        C.rocksdb_transaction_options_set_deadlock_detect_depth(opts.c, C.int64_t(depth))
×
55
}
×
56

57
// SetMaxWriteBatchSize sets the maximum number of bytes used for the write batch. 0 means no limit.
58
func (opts *TransactionOptions) SetMaxWriteBatchSize(size uint64) {
×
59
        C.rocksdb_transaction_options_set_max_write_batch_size(opts.c, C.size_t(size))
×
60
}
×
61

62
// SetSkipPrepare skips prepare phase.
63
func (opts *TransactionOptions) SetSkipPrepare(skip bool) {
×
64
        C.rocksdb_transaction_options_set_skip_prepare(opts.c, boolToChar(skip))
×
65
}
×
66

67
// Destroy deallocates the TransactionOptions object.
68
func (opts *TransactionOptions) Destroy() {
×
69
        C.rocksdb_transaction_options_destroy(opts.c)
×
70
        opts.c = nil
×
71
}
×
72

73
// OptimisticTransactionOptions represent all of the available options options for
74
// a optimistic transaction on the database.
75
type OptimisticTransactionOptions struct {
76
        c *C.rocksdb_optimistictransaction_options_t
77
}
78

79
// NewDefaultOptimisticTransactionOptions creates a default TransactionOptions object.
80
func NewDefaultOptimisticTransactionOptions() *OptimisticTransactionOptions {
×
81
        return newNativeOptimisticTransactionOptions(C.rocksdb_optimistictransaction_options_create())
×
82
}
×
83

84
// NewNativeOptimisticTransactionOptions creates a OptimisticTransactionOptions object.
85
func newNativeOptimisticTransactionOptions(c *C.rocksdb_optimistictransaction_options_t) *OptimisticTransactionOptions {
×
86
        return &OptimisticTransactionOptions{c: c}
×
87
}
×
88

89
// SetSetSnapshot to true is the same as calling
90
// Transaction::SetSnapshot().
91
func (opts *OptimisticTransactionOptions) SetSetSnapshot(value bool) {
×
92
        C.rocksdb_optimistictransaction_options_set_set_snapshot(opts.c, boolToChar(value))
×
93
}
×
94

95
// Destroy deallocates the TransactionOptions object.
96
func (opts *OptimisticTransactionOptions) Destroy() {
×
97
        C.rocksdb_optimistictransaction_options_destroy(opts.c)
×
98
        opts.c = nil
×
99
}
×
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