Couchbase C Client  2.4.4
pktfwd.h
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_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
167 lcb_pktfwd3(lcb_t instance, const void *cookie, const lcb_CMDPKTFWD *cmd);
168 
183 typedef void (*lcb_pktfwd_callback)
184  (lcb_t instance, const void *cookie, lcb_error_t err, lcb_PKTFWDRESP *resp);
185 
191 typedef void (*lcb_pktflushed_callback) (lcb_t instance, const void *cookie);
192 
203 LIBCOUCHBASE_API
205 lcb_set_pktfwd_callback(lcb_t instance, lcb_pktfwd_callback callback);
206 
218 LIBCOUCHBASE_API
220 lcb_set_pktflushed_callback(lcb_t instance, lcb_pktflushed_callback callback);
221 
222 
250 LIBCOUCHBASE_API
251 void
252 lcb_backbuf_ref(lcb_BACKBUF buf);
253 
260 LIBCOUCHBASE_API
261 void
262 lcb_backbuf_unref(lcb_BACKBUF buf);
267 #ifdef __cplusplus
268 }
269 #endif
270 #endif
lcb_IOV * iovs
Array of lcb_IOV structures containing the response packet.
Definition: pktfwd.h:102
lcb_U16 server_index
Specify server index for the command.
Definition: pktfwd.h:75
lcb_BACKBUF * bufs
Contains the backing lcb_BACKBUF objects which control the allocation lifespan of their associated el...
Definition: pktfwd.h:106
void(* lcb_pktfwd_callback)(lcb_t instance, const void *cookie, lcb_error_t err, lcb_PKTFWDRESP *resp)
Callback invoked when a response packet has arrived for a request.
Definition: pktfwd.h:184
unsigned nitems
The number of items in the iovs and bufs array.
Definition: pktfwd.h:110
structure indicating a buffer and its size
Definition: iops.h:84
lcb_VALBUF vb
This structure should be initialized to a packet.
Definition: pktfwd.h:60
lcb_pktflushed_callback lcb_set_pktflushed_callback(lcb_t instance, lcb_pktflushed_callback callback)
Set the callback to be invoked when the buffer data supplied to the packet forwarding function is no ...
lcb_error_t lcb_pktfwd3(lcb_t instance, const void *cookie, const lcb_CMDPKTFWD *cmd)
Forward a raw memcached packet to the cluster.
lcb_pktfwd_callback lcb_set_pktfwd_callback(lcb_t instance, lcb_pktfwd_callback callback)
Set the callback to be invoked when a response to a forwarded packet has been received.
Request for forwarding a packet This structure is passed to the lcb_pktfwd3() function.
Definition: pktfwd.h:39
char nomap
Whether to direct this command to a specific server.
Definition: pktfwd.h:70
Response structure containing the response for a packet.
Definition: pktfwd.h:79
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...
void lcb_backbuf_unref(lcb_BACKBUF buf)
Indicate that the IOV backed by the specified buf is no longer required.
int version
Version of the response structure.
Definition: pktfwd.h:81
lcb_error_t
Error codes returned by the library.
Definition: error.h:425
const lcb_U8 * header
Pointer to the memcached header.
Definition: pktfwd.h:89
void(* lcb_pktflushed_callback)(lcb_t instance, const void *cookie)
Callback invoked when the request buffer for a packet is no longer required.
Definition: pktfwd.h:191
Structure representing a value to be stored.
Definition: kvbuf.h:100