forked from iabudiab/ObjectiveRocks
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRocksDBIndexedWriteBatch.h
82 lines (63 loc) · 2.69 KB
/
RocksDBIndexedWriteBatch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//
// RocksDBIndexedWriteBatch.h
// ObjectiveRocks
//
// Created by Iska on 20/08/15.
// Copyright (c) 2015 BrainCookie. All rights reserved.
//
#import "RocksDBWriteBatch.h"
#import "RocksDBWriteBatchIterator.h"
NS_ASSUME_NONNULL_BEGIN
@class RocksDBColumnFamily;
@class RocksDBReadOptions;
/**
A `RocksDBIndexedWriteBatch` builds a binary searchable index for all the keys
inserted, which can be iterated via the `RocksDBWriteBatchIterator`.
*/
@interface RocksDBIndexedWriteBatch : RocksDBWriteBatch
/**
Returns the value for the given key in this Write Batch.
@discussion This method will only read the key from this batch.
@remark If the batch does not have enough data to resolve Merge operations,
MergeInProgress status may be returned.
@param aKey The key for object.
@param columnFamily The column family from which the data should be read.
@param error If an error occurs, upon return contains an `NSError` object that describes the problem.
@return The object for the given key.
@see RocksDBColumnFamily
*/
- (nullable NSData *)dataForKey:(NSData *)aKey
inColumnFamily:(RocksDBColumnFamily *)columnFamily
error:(NSError * _Nullable *)error;
/**
Returns the object for the given key.
@discussion This function will query both this batch and the DB and then merge
the results using the DB's merge operator (if the batch contains any
merge requests).
Setting the `RocksDBSnapshot` on the `RocksDBReadOptions` will affect what is read
from the DB but will not change which keys are read from the batch (the keys in
this batch do not yet belong to any snapshot and will be fetched
regardless).
@param aKey The key for object.
@param columnFamily The column family from which the data should be read.
@param readOptions A block with a `RocksDBReadOptions` instance for configuring this read operation.
@param error If an error occurs, upon return contains an `NSError` object that describes åthe problem.
@return The object for the given key.
@see RocksDBColumnFamily
@see RocksDBReadOptions
*/
- (nullable NSData *)dataForKeyIncludingDatabase:(NSData *)aKey
inColumnFamily:(RocksDBColumnFamily *)columnFamily
readOptions:(nullable void (^)(RocksDBReadOptions *readOptions))readOptions
error:(NSError * _Nullable *)error;
/**
Creates and returns an iterator over this indexed write batch.
@discussion Keys will be iterated in the order given by the write batch's
comparator. For multiple updates on the same key, each update will be
returned as a separate entry, in the order of update time.
@return An iterator over this indexed write batch.
@see RocksDBWriteBatchIterator
*/
- (RocksDBWriteBatchIterator *)iterator;
@end
NS_ASSUME_NONNULL_END