Couchbase C Client  3.3.11
Asynchronous C Client for Couchbase
pktfwd.h
1 /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3  * Copyright 2014-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_PKTFWD_H
19 #define LCB_PKTFWD_H
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
34 typedef struct rdb_ROPESEG *lcb_BACKBUF;
35 
39 typedef struct {
40  int version;
61 
70  char nomap;
71 
75  lcb_U16 server_index;
77 
79 typedef struct {
81  int version;
82 
89  const lcb_U8 *header;
90 
103 
106  lcb_BACKBUF *bufs;
107 
110  unsigned nitems;
112 
165 LIBCOUCHBASE_API
166 lcb_STATUS lcb_pktfwd3(lcb_INSTANCE *instance, const void *cookie, const lcb_CMDPKTFWD *cmd);
167 
182 typedef void (*lcb_pktfwd_callback)(lcb_INSTANCE *instance, const void *cookie, lcb_STATUS err, lcb_PKTFWDRESP *resp);
183 
189 typedef void (*lcb_pktflushed_callback)(lcb_INSTANCE *instance, const void *cookie);
190 
201 LIBCOUCHBASE_API
203 
215 LIBCOUCHBASE_API
217 
245 LIBCOUCHBASE_API
246 void lcb_backbuf_ref(lcb_BACKBUF buf);
247 
254 LIBCOUCHBASE_API
255 void lcb_backbuf_unref(lcb_BACKBUF buf);
259 #ifdef __cplusplus
260 }
261 #endif
262 #endif
lcb_STATUS
Error codes returned by the library.
Definition: error.h:212
struct lcb_st lcb_INSTANCE
Library handle representing a connection to a cluster and its data buckets.
Definition: couchbase.h:35
structure indicating a buffer and its size
Definition: iops.h:78
const lcb_U8 * header
Pointer to the memcached header.
Definition: pktfwd.h:89
lcb_BACKBUF * bufs
Contains the backing lcb_BACKBUF objects which control the allocation lifespan of their associated el...
Definition: pktfwd.h:106
lcb_IOV * iovs
Array of lcb_IOV structures containing the response packet.
Definition: pktfwd.h:102
char nomap
Whether to direct this command to a specific server.
Definition: pktfwd.h:70
lcb_VALBUF vb
This structure should be initialized to a packet.
Definition: pktfwd.h:60
lcb_U16 server_index
Specify server index for the command.
Definition: pktfwd.h:75
int version
Version of the response structure.
Definition: pktfwd.h:81
unsigned nitems
The number of items in the iovs and bufs array.
Definition: pktfwd.h:110
lcb_STATUS lcb_pktfwd3(lcb_INSTANCE *instance, const void *cookie, const lcb_CMDPKTFWD *cmd)
Forward a raw memcached packet to the cluster.
void(* lcb_pktfwd_callback)(lcb_INSTANCE *instance, const void *cookie, lcb_STATUS err, lcb_PKTFWDRESP *resp)
Callback invoked when a response packet has arrived for a request.
Definition: pktfwd.h:182
void lcb_backbuf_ref(lcb_BACKBUF buf)
Indicate that the lcb_BACKBUF object which provides storage for an IOV's data pointer will need to re...
lcb_pktfwd_callback lcb_set_pktfwd_callback(lcb_INSTANCE *instance, lcb_pktfwd_callback callback)
Set the callback to be invoked when a response to a forwarded packet has been received.
lcb_pktflushed_callback lcb_set_pktflushed_callback(lcb_INSTANCE *instance, lcb_pktflushed_callback callback)
Set the callback to be invoked when the buffer data supplied to the packet forwarding function is no ...
void(* lcb_pktflushed_callback)(lcb_INSTANCE *instance, const void *cookie)
Callback invoked when the request buffer for a packet is no longer required.
Definition: pktfwd.h:189
void lcb_backbuf_unref(lcb_BACKBUF buf)
Indicate that the IOV backed by the specified buf is no longer required.
Request for forwarding a packet This structure is passed to the lcb_pktfwd3() function.
Definition: pktfwd.h:39
Response structure containing the response for a packet.
Definition: pktfwd.h:79
Structure representing a value to be stored.
Definition: kvbuf.h:109