• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef KV_STORE_RESULT_SET_H
17 #define KV_STORE_RESULT_SET_H
18 
19 #include "store_types.h"
20 
21 namespace DistributedDB {
22 class KvStoreResultSet {
23 public:
~KvStoreResultSet()24     DB_API virtual ~KvStoreResultSet() {};
25 
26     // Returns the count of rows in the result set.
27     DB_API virtual int GetCount() const = 0;
28 
29     // Returns the current read position of the result set.
30     DB_API virtual int GetPosition() const = 0;
31 
32     // Move the read position to the first row, return false if the result set is empty.
33     DB_API virtual bool MoveToFirst() = 0;
34 
35     // Move the read position to the last row, return false if the result set is empty.
36     DB_API virtual bool MoveToLast() = 0;
37 
38     // Move the read position to the next row, return false if the result set is empty
39     // or the read position is already past the last entry in the result set.
40     DB_API virtual bool MoveToNext() = 0;
41 
42     // Move the read position to the previous row, return false if the result set is empty
43     // or the read position is already before the first entry in the result set.
44     DB_API virtual bool MoveToPrevious() = 0;
45 
46     // Move the read position by a relative amount from the current position.
47     DB_API virtual bool Move(int offset) = 0;
48 
49     // Move the read position to an absolute position value.
50     DB_API virtual bool MoveToPosition(int position) = 0;
51 
52     // Returns whether the read position is pointing to the first row.
53     DB_API virtual bool IsFirst() const = 0;
54 
55     // Returns whether the read position is pointing to the last row.
56     DB_API virtual bool IsLast() const = 0;
57 
58     // Returns whether the read position is before the first row.
59     DB_API virtual bool IsBeforeFirst() const = 0;
60 
61     // Returns whether the read position is after the last row
62     DB_API virtual bool IsAfterLast() const = 0;
63 
64     // Get a key-value entry.
65     DB_API virtual DBStatus GetEntry(Entry &entry) const = 0;
66 };
67 } // namespace DistributedDB
68 
69 #endif // KV_STORE_RESULT_SET_H