Skip to main content

couchbase_core/results/
kv.rs

1/*
2 *
3 *  * Copyright (c) 2025 Couchbase, Inc.
4 *  *
5 *  * Licensed under the Apache License, Version 2.0 (the "License");
6 *  * you may not use this file except in compliance with the License.
7 *  * You may obtain a copy of the License at
8 *  *
9 *  *    http://www.apache.org/licenses/LICENSE-2.0
10 *  *
11 *  * Unless required by applicable law or agreed to in writing, software
12 *  * distributed under the License is distributed on an "AS IS" BASIS,
13 *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *  * See the License for the specific language governing permissions and
15 *  * limitations under the License.
16 *
17 */
18
19use crate::error;
20use crate::mutationtoken::MutationToken;
21use std::time::Duration;
22
23#[derive(Clone, Debug, Eq, PartialEq, Hash)]
24pub struct GetResult {
25    pub value: Vec<u8>,
26    pub flags: u32,
27    pub datatype: u8,
28    pub cas: u64,
29}
30
31#[derive(Clone, Debug, Eq, PartialEq, Hash)]
32pub struct GetMetaResult {
33    pub cas: u64,
34    pub flags: u32,
35    pub value: Vec<u8>,
36    pub datatype: u8,
37    pub server_duration: Option<Duration>,
38    pub expiry: u32,
39    pub seq_no: u64,
40    pub deleted: bool,
41}
42
43#[derive(Clone, Debug, Eq, PartialEq, Hash)]
44pub struct UpsertResult {
45    pub cas: u64,
46    pub mutation_token: Option<MutationToken>,
47}
48
49#[derive(Clone, Debug, Eq, PartialEq, Hash)]
50pub struct DeleteResult {
51    pub cas: u64,
52    pub mutation_token: Option<MutationToken>,
53}
54
55#[derive(Clone, Debug, Eq, PartialEq, Hash)]
56pub struct GetAndLockResult {
57    pub value: Vec<u8>,
58    pub flags: u32,
59    pub datatype: u8,
60    pub cas: u64,
61}
62
63#[derive(Clone, Debug, Eq, PartialEq, Hash)]
64pub struct GetAndTouchResult {
65    pub value: Vec<u8>,
66    pub flags: u32,
67    pub datatype: u8,
68    pub cas: u64,
69}
70
71#[derive(Clone, Debug, Eq, PartialEq, Hash)]
72pub struct UnlockResult {}
73
74#[derive(Clone, Debug, Eq, PartialEq, Hash)]
75pub struct TouchResult {
76    pub cas: u64,
77}
78
79#[derive(Clone, Debug, Eq, PartialEq, Hash)]
80pub struct AddResult {
81    pub cas: u64,
82    pub mutation_token: Option<MutationToken>,
83}
84
85#[derive(Clone, Debug, Eq, PartialEq, Hash)]
86pub struct ReplaceResult {
87    pub cas: u64,
88    pub mutation_token: Option<MutationToken>,
89}
90
91#[derive(Clone, Debug, Eq, PartialEq, Hash)]
92pub struct AppendResult {
93    pub cas: u64,
94    pub mutation_token: Option<MutationToken>,
95}
96
97#[derive(Clone, Debug, Eq, PartialEq, Hash)]
98pub struct PrependResult {
99    pub cas: u64,
100    pub mutation_token: Option<MutationToken>,
101}
102
103#[derive(Clone, Debug, Eq, PartialEq, Hash)]
104pub struct IncrementResult {
105    pub cas: u64,
106    pub value: u64,
107    pub mutation_token: Option<MutationToken>,
108}
109
110#[derive(Clone, Debug, Eq, PartialEq, Hash)]
111pub struct DecrementResult {
112    pub cas: u64,
113    pub value: u64,
114    pub mutation_token: Option<MutationToken>,
115}
116
117#[derive(Debug)]
118pub struct SubDocResult {
119    pub err: Option<error::MemdxError>,
120    pub value: Option<Vec<u8>>,
121}
122
123#[derive(Debug)]
124pub struct LookupInResult {
125    pub value: Vec<SubDocResult>,
126    pub cas: u64,
127    pub doc_is_deleted: bool,
128}
129
130#[derive(Debug)]
131pub struct MutateInResult {
132    pub value: Vec<SubDocResult>,
133    pub cas: u64,
134    pub mutation_token: Option<MutationToken>,
135}
136
137#[derive(Clone, Debug, Eq, PartialEq, Hash)]
138pub struct GetCollectionIdResult {
139    pub manifest_rev: u64,
140    pub collection_id: u32,
141}