Couchbase C Client  3.0.5
Asynchronous C Client for Couchbase
ixmgmt.h
1 /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3  * Copyright 2016-2020 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_IXMGMT_H
19 #define LCB_IXMGMT_H
20 
21 #include <libcouchbase/couchbase.h>
22 #include <libcouchbase/utils.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
33 typedef struct {
49  const char *rawjson;
50  size_t nrawjson;
51 
53  const char *name;
54  size_t nname;
55 
60  const char *keyspace;
61  size_t nkeyspace;
62 
64  const char *nspace;
65  size_t nnspace;
66 
68  const char *state;
69  size_t nstate;
70 
79  const char *fields;
80  size_t nfields;
81 
84  const char *cond;
85  size_t ncond;
86 
95  unsigned flags;
96 
102  unsigned ixtype;
103 } lcb_N1XSPEC;
104 
106 #define LCB_N1XSPEC_F_PRIMARY (1 << 16)
107 
113 #define LCB_N1XSPEC_F_DEFER (1 << 17)
114 
119 #define LCB_N1XSPEC_T_DEFAULT 0
120 #define LCB_N1XSPEC_T_GSI 1
121 #define LCB_N1XSPEC_T_VIEW 2
122 
123 struct lcb_RESPN1XMGMT_st;
124 
131 typedef void (*lcb_N1XMGMTCALLBACK)(lcb_INSTANCE *instance, int cbtype, const struct lcb_RESPN1XMGMT_st *resp);
132 
137 typedef struct {
145 
149  lcb_N1XMGMTCALLBACK callback;
151 
157 typedef struct lcb_RESPN1XMGMT_st {
158  lcb_STATUS rc;
159  void *cookie;
160  lcb_U16 rflags;
161 
166  const lcb_N1XSPEC *const *specs;
168  size_t nspecs;
169 
173 
180 LIBCOUCHBASE_API
181 lcb_STATUS lcb_n1x_list(lcb_INSTANCE *instance, const void *cookie, const lcb_CMDN1XMGMT *cmd);
182 
189 LIBCOUCHBASE_API
190 lcb_STATUS lcb_n1x_create(lcb_INSTANCE *instance, const void *cookie, const lcb_CMDN1XMGMT *cmd);
191 
196 LIBCOUCHBASE_API
197 lcb_STATUS lcb_n1x_drop(lcb_INSTANCE *instance, const void *cookie, const lcb_CMDN1XMGMT *cmd);
198 
208 LIBCOUCHBASE_API
209 lcb_STATUS lcb_n1x_startbuild(lcb_INSTANCE *instance, const void *cookie, const lcb_CMDN1XMGMT *cmd);
210 
216 typedef struct {
222  const lcb_N1XSPEC *const *specs;
224  size_t nspec;
225 
230  lcb_U32 timeout;
231 
236  lcb_U32 interval;
237 
244  lcb_N1XMGMTCALLBACK callback;
246 
253 LIBCOUCHBASE_API
254 lcb_STATUS lcb_n1x_watchbuild(lcb_INSTANCE *instance, const void *cookie, const lcb_CMDN1XWATCH *cmd);
255 
256 #ifdef __cplusplus
257 }
258 #endif /* __cplusplus */
259 #endif /* LCB_IXMGMT_H */
lcb_RESPN1XMGMT
Definition: ixmgmt.h:157
lcb_RESPQUERY
struct lcb_RESPQUERY_ lcb_RESPQUERY
Opaque query response structure.
Definition: couchbase.h:2707
lcb_N1XSPEC
Definition: ixmgmt.h:33
lcb_CMDN1XWATCH::specs
const lcb_N1XSPEC *const * specs
Input specs.
Definition: ixmgmt.h:222
lcb_N1XSPEC::cond
const char * cond
Indexing condition.
Definition: ixmgmt.h:84
lcb_N1XSPEC::name
const char * name
Name of the index.
Definition: ixmgmt.h:53
lcb_CMDN1XWATCH
Definition: ixmgmt.h:216
lcb_RESPN1XMGMT::inner
const lcb_RESPQUERY * inner
Inner N1QL response.
Definition: ixmgmt.h:171
lcb_N1XSPEC::fields
const char * fields
Actual index text.
Definition: ixmgmt.h:79
utils.h
Various utility functions.
lcb_N1XSPEC::state
const char * state
Output parameter only.
Definition: ixmgmt.h:68
lcb_STATUS
lcb_STATUS
Error codes returned by the library.
Definition: error.h:202
lcb_INSTANCE
struct lcb_st lcb_INSTANCE
Library handle representing a connection to a cluster and its data buckets.
Definition: couchbase.h:35
lcb_RESPN1XMGMT::nspecs
size_t nspecs
Number of specs.
Definition: ixmgmt.h:168
lcb_CMDN1XWATCH::nspec
size_t nspec
Number of specs.
Definition: ixmgmt.h:224
lcb_N1XSPEC::rawjson
const char * rawjson
Raw JSON returned from server.
Definition: ixmgmt.h:49
lcb_N1XSPEC::keyspace
const char * keyspace
Keyspace or "bucket" of the index.
Definition: ixmgmt.h:60
lcb_RESPN1XMGMT::specs
const lcb_N1XSPEC *const * specs
A list of pointers to specs.
Definition: ixmgmt.h:166
lcb_CMDN1XMGMT::spec
lcb_N1XSPEC spec
The index to operate on.
Definition: ixmgmt.h:144
lcb_CMDN1XWATCH::timeout
lcb_U32 timeout
Maximum amount of time to wait (microseconds).
Definition: ixmgmt.h:230
lcb_N1XSPEC::flags
unsigned flags
Modifiers for the index itself.
Definition: ixmgmt.h:95
couchbase.h
Main header file for Couchbase.
lcb_CMDN1XMGMT
Definition: ixmgmt.h:137
lcb_N1XSPEC::ixtype
unsigned ixtype
Type of this index, Can be LCB_N1XSPEC_T_DEFAULT for the default server type, or an explicit LCB_N1XS...
Definition: ixmgmt.h:102
lcb_CMDN1XWATCH::callback
lcb_N1XMGMTCALLBACK callback
Callback to invoke once the indexes have been built or the timeout has been reached.
Definition: ixmgmt.h:244
lcb_N1XSPEC::nspace
const char * nspace
'namespace'.
Definition: ixmgmt.h:64
lcb_CMDN1XWATCH::interval
lcb_U32 interval
How often to check status (microseconds).
Definition: ixmgmt.h:236
lcb_CMDN1XMGMT::callback
lcb_N1XMGMTCALLBACK callback
Callback to be invoked when operation is complete.
Definition: ixmgmt.h:149