Couchbase

 view release on metacpan or  search on metacpan

xs/perl-couchbase.h  view on Meta::CPAN

} while (0);

#define plcb_views_wait(obj) do { \
    (obj)->wait_for_views = 1; \
    lcb_wait3((obj)->instance, LCB_WAIT_NOCHECK); \
} while (0);

#define plcb_kv_waitdone(obj) do { \
    (obj)->wait_for_kv = 0; \
    plcb_evloop_wait_unref(obj); \
} while (0);

#define plcb_views_waitdone(obj) do { \
    (obj)->wait_for_views = 0; \
    plcb_evloop_wait_unref(obj); \
} while (0);

typedef struct {
    unsigned nremaining;
    unsigned flags;
    int waiting;
    HV *docs;
    SV *parent; /* PLCB_T */
    lcb_MULTICMD_CTX *multi;
    union {
        SV *callback; /* For async only */
        AV *ctxqueue; /* For queued operations */
    } u;
} plcb_OPCTX;

typedef struct {
    int cmdbase; /* Effective command passed, without flags or modifiers */
    PLCB_t *parent;
    AV *docav; /* The document */
    SV *opctx; /* The context */
    SV *cmdopts; /* Command options */
    SV *docrv; /* Reference for the document */
    void *cookie;
    plcb_OPCTX *ctxptr;
} plcb_SINGLEOP;

/* Temporary structure used for encoding/storing values */
typedef struct {
    SV *value;
    uint32_t flags;
    uint32_t spec;
    short need_free;
    const char *encoded;
    size_t len;
} plcb_DOCVAL;

#define PLCB_OPCTXf_IMPLICIT 0x01
#define PLCB_OPCTXf_CALLEACH 0x02
#define PLCB_OPCTXf_CALLDONE 0x04
#define PLCB_OPCTXf_WAITONE 0x08

/*need to include this after defining PLCB_t*/
#include "plcb-return.h"
#include "plcb-args.h"

void plcb_callbacks_setup(PLCB_t *object);

/*options for common constructor settings*/
void plcb_ctor_cbc_opts(AV *options, struct lcb_create_st *cropts);
void plcb_ctor_conversion_opts(PLCB_t *object, AV *options);
void plcb_ctor_init_common(PLCB_t *object, lcb_t instance, AV *options);

/*cleanup functions*/
void plcb_cleanup(PLCB_t *object);

/*conversion functions*/
void
plcb_convert_storage(PLCB_t* object, AV *doc, plcb_DOCVAL *vspec);

void plcb_convert_storage_free(PLCB_t *object, plcb_DOCVAL *vspec);

/* Do not fall back to "Custom" encoders */
#define PLCB_CONVERT_NOCUSTOM 1
SV*
plcb_convert_retrieval_ex(PLCB_t *object,
    AV *doc, const char *data, size_t data_len, uint32_t flags, int options);

#define plcb_convert_retrieval(obj, doc, data, len, flags) \
    plcb_convert_retrieval_ex(obj, doc, data, len, flags, 0)
#define plcb_convert_getresp(obj, doc, resp) \
    plcb_convert_retrieval(\
        obj, doc, (resp)->value, (resp)->nvalue, (resp)->itmflags)

/**
 * This function decrements the wait count by one, and possibly calls stop_event_loop
 * if the reference count has hit 0.
 */
void plcb_evloop_wait_unref(PLCB_t *obj);

/**
 * Returns a new blessed operation context, also makes it the current
 * context
 */
SV *plcb_opctx_new(PLCB_t *, int);
void plcb_opctx_clear(PLCB_t *parent);
void plcb_opctx_initop(plcb_SINGLEOP *so, PLCB_t *parent, SV *doc, SV *ctx, SV *options);
SV * plcb_opctx_return(plcb_SINGLEOP *so, lcb_error_t err);
void plcb_opctx_submit(PLCB_t *parent, plcb_OPCTX *ctx);

#define plcb_opctx_is_cmd_multi(cmd) \
    ((cmd) == PLCB_CMD_OBSERVE || (cmd) == PLCB_CMD_STATS)

/** Operation functions */
SV *PLCB_op_get(PLCB_t*,plcb_SINGLEOP*);
SV *PLCB_op_set(PLCB_t*,plcb_SINGLEOP*);
SV* PLCB_op_counter(PLCB_t *object, plcb_SINGLEOP *opinfo);
SV *PLCB_op_remove(PLCB_t*,plcb_SINGLEOP*);
SV *PLCB_op_observe(PLCB_t *object, plcb_SINGLEOP *args);
SV *PLCB_op_endure(PLCB_t *object, plcb_SINGLEOP *args);
SV *PLCB_op_unlock(PLCB_t *object, plcb_SINGLEOP *args);
SV *PLCB_op_stats(PLCB_t *object, plcb_SINGLEOP *args);
SV *PLCB_op_observe(PLCB_t *object, plcb_SINGLEOP *args);
SV *PLCB_op_endure(PLCB_t *object, plcb_SINGLEOP *opinfo);
SV* PLCB_op_http(PLCB_t *object, plcb_SINGLEOP *opinfo);

SV *



( run in 0.520 second using v1.01-cache-2.11-cpan-f56aa216473 )