Couchbase C Client  2.10.0
Asynchronous C Client for Couchbase
kvbuf.h
Go to the documentation of this file.
1 /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3  * Copyright 2014 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 #ifndef LCB_KVBUF_H
19 #define LCB_KVBUF_H
20 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 
33 typedef enum {
41 
47 
53 
54 #define LCB_KV_HEADER_AND_KEY LCB_KV_CONTIG
55 
59 typedef struct lcb_CONTIGBUF {
60  const void *bytes;
62  lcb_size_t nbytes;
64 
66 typedef struct lcb_KEYBUF {
77  lcb_CONTIGBUF contig;
78 } lcb_KEYBUF;
79 
81 #define LCB_KEYBUF_IS_EMPTY(k) (k)->contig.nbytes == 0
82 
90 #define LCB_KREQ_SIMPLE(req, k, nk) do { \
91  (req)->type = LCB_KV_COPY; \
92  (req)->contig.bytes = k; \
93  (req)->contig.nbytes = nk; \
94 } while (0);
95 
100 typedef struct lcb_FRAGBUF {
103 
105  unsigned int niov;
106 
111  unsigned int total_length;
112 } lcb_FRAGBUF;
113 
115 typedef struct lcb_VALBUF {
128  union {
129  lcb_CONTIGBUF contig;
130  lcb_FRAGBUF multi;
131  } u_buf;
132 } lcb_VALBUF;
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 #endif
lcb_KVBUFTYPE vtype
Value request type.
Definition: kvbuf.h:127
structure indicating a buffer and its size
Definition: iops.h:78
For use within the hashkey field, indicates that the length of the hashkey is the vBucket ID...
Definition: kvbuf.h:40
lcb_KVBUFTYPE
Flags indicating the storage policy for a buffer.
Definition: kvbuf.h:33
lcb_KVBUFTYPE type
The type of key to provide.
Definition: kvbuf.h:76
The buffer should be copied.
Definition: kvbuf.h:34
unsigned int total_length
Total length of the items.
Definition: kvbuf.h:111
The buffer is not contiguous and should not be copied.
Definition: kvbuf.h:36
lcb_size_t nbytes
Number of total bytes.
Definition: kvbuf.h:62
The buffer is contiguous and should not be copied.
Definition: kvbuf.h:35
Structure for an IOV buffer to be supplied as a buffer.
Definition: kvbuf.h:100
lcb_IOV * iov
An IOV array.
Definition: kvbuf.h:102
simple buf/length structure for a contiguous series of bytes
Definition: kvbuf.h:59
Common request header for all keys.
Definition: kvbuf.h:66
Structure representing a value to be stored.
Definition: kvbuf.h:115
The buffers are not contiguous (multi-part buffers) but should be copied.
Definition: kvbuf.h:46
unsigned int niov
Number of elements in iov array.
Definition: kvbuf.h:105
For use within the hashkey field, indicates that the pointer to bytes of the hashkey is the tracing s...
Definition: kvbuf.h:51