Example #1
0
LIBCOUCHBASE_API
lcb_error_t lcb_get(lcb_t instance,
                    const void *command_cookie,
                    lcb_size_t num,
                    const lcb_get_cmd_t *const *items)
{
    unsigned ii;
    mcreq_sched_enter(&instance->cmdq);

    for (ii = 0; ii < num; ii++) {
        const lcb_get_cmd_t *src = items[ii];
        lcb_CMDGET dst;
        lcb_error_t err;

        memset(&dst, 0, sizeof(dst));
        dst.key.contig.bytes = src->v.v0.key;
        dst.key.contig.nbytes = src->v.v0.nkey;
        dst.hashkey.contig.bytes = src->v.v0.hashkey;
        dst.hashkey.contig.nbytes = src->v.v0.nhashkey;
        dst.lock = src->v.v0.lock;
        dst.exptime = src->v.v0.exptime;

        err = lcb_get3(instance, command_cookie, &dst);
        if (err != LCB_SUCCESS) {
            mcreq_sched_fail(&instance->cmdq);
            return err;
        }
    }
    mcreq_sched_leave(&instance->cmdq, 1);
    SYNCMODE_INTERCEPT(instance)
}
static void get_encrypted(lcb_t instance, const char *key)
{
    lcb_CMDGET cmd = {};
    lcb_error_t err;
    LCB_CMD_SET_KEY(&cmd, key, strlen(key));
    printf("KEY:    %s\n", key);
    err = lcb_get3(instance, NULL, &cmd);
    if (err != LCB_SUCCESS) {
        die(instance, "Couldn't schedule get operation", err);
    }
    lcb_wait(instance);
}
Example #3
0
SV *
PLCB_op_get(PLCB_t *object, plcb_SINGLEOP *opinfo)
{
    lcb_error_t err = LCB_SUCCESS;
    lcb_CMDGET gcmd = { 0 };

    PLCB_args_get(object, opinfo, &gcmd);
    key_from_so(opinfo, (lcb_CMDBASE*)&gcmd);
    if (opinfo->cmdbase == PLCB_CMD_TOUCH) {
        err = lcb_touch3(object->instance, opinfo->cookie, (lcb_CMDTOUCH*)&gcmd);
    } else {
        err = lcb_get3(object->instance, opinfo->cookie, &gcmd);
    }
    return plcb_opctx_return(opinfo, err);
}