forked from iabudiab/ObjectiveRocks
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRocksDBWriteBatchIterator.h
99 lines (74 loc) · 2.42 KB
/
RocksDBWriteBatchIterator.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//
// RocksDBWriteBatchIterator.h
// ObjectiveRocks
//
// Created by Iska on 20/08/15.
// Copyright (c) 2015 BrainCookie. All rights reserved.
//
#import "RocksDBIterator.h"
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, RocksDBWriteBatchEntryType)
{
RocksDBWriteBatchEntryTypePutRecord,
RocksDBWriteBatchEntryTypeMergeRecord,
RocksDBWriteBatchEntryTypeDeleteRecord,
RocksDBWriteBatchEntryTypeLogDataRecord
};
@interface RocksDBWriteBatchEntry : NSObject
@property (nonatomic, readonly) RocksDBWriteBatchEntryType type;
@property (nonatomic, readonly) NSData *key;
@property (nonatomic, readonly) NSData *value;
@end
@interface RocksDBWriteBatchIterator : NSObject
/** @brief Closes this Iterator */
- (void)close;
/**
An iterator is either positioned at a key/value pair, or not valid.
@return `YES` if the iterator is valid, `NO` otherwise.
*/
- (BOOL)isValid;
/**
Positions the iterator at the first key in the source.
The iterator `isValid` after this call if the source is not empty.
*/
- (void)seekToFirst;
/**
Positions the iterator at the last key in the source.
The iterator `isValid` after this call if the source is not empty.
*/
- (void)seekToLast;
/**
Positions the iterator at the first key in the source that at or past the given key.
The iterator `isValid` after this call if the source contains an entry that comes at
or past the given key.
@param aKey The key to position the tartaritartor at.
*/
- (void)seekToKey:(NSData *)aKey;
/**
Moves to the next entry in the source. After this call, `isValid` is
true if the iterator was not positioned at the last entry in the source.
*/
- (void)next;
/**
Moves to the previous entry in the source. After this call, `isValid` is
true iff the iterator was not positioned at the first entry in source.
*/
- (void)previous;
/**
Returns the `RocksDBWriteBatchEntry` at the current position.
@return The entry at the current position.
@see RocksDBWriteBatchEntry`
*/
- (RocksDBWriteBatchEntry *)entry;
/**
Executes a given block for each entry in the iterator.
@param block The block to apply to entries.
*/
- (void)enumerateEntriesUsingBlock:(void (^)(RocksDBWriteBatchEntry *entry, BOOL *stop))block;
/**
Executes a given block for each entry in the iterator in reverse order.
@param block The block to apply to entries.
*/
- (void)reverseEnumerateEntriesUsingBlock:(void (^)(RocksDBWriteBatchEntry *entry, BOOL *stop))block;
@end
NS_ASSUME_NONNULL_END