Sha256: 2ce557c724b8794bed152c559c6083c81e7ca1ad766dc65caa31fb3b253cfa89

Contents?: true

Size: 1.82 KB

Versions: 20

Compression:

Stored size: 1.82 KB

Contents

/**
 * Document request routines
 */
#ifndef LCB_DOCREQ_H
#define LCB_DOCREQ_H

#include <libcouchbase/couchbase.h>
#include <libcouchbase/api3.h>
#include <libcouchbase/pktfwd.h>
#include <lcbio/lcbio.h>
#include "sllist.h"

namespace lcb {
namespace docreq {

struct Queue;
struct DocRequest;

struct Queue {
    Queue(lcb_t);
    ~Queue();
    void add(DocRequest*);
    void unref();
    void ref() {refcount++;}
    void cancel();
    bool has_pending() const {
        return n_awaiting_response || n_awaiting_schedule;
    }

    lcb_t instance;
    void *parent;
    lcbio_pTIMER timer;

    /**Called when a document is ready
     * @param The queue
     * @param The document */
    void (*cb_ready)(struct Queue*,struct DocRequest*);

    /**Called when throttle state changes. This may be used by higher layers
     * for appropriate flow control
     * @param The queue
     * @param enabled Whether throttling has been enabled or disabled */
    void (*cb_throttle)(struct Queue*, int enabled);

    /**This queue holds requests which were not yet issued to the library
     * via lcb_get3(). This list is aggregated after each chunk callback and
     * sent as a batch*/
    sllist_root pending_gets;

    /**This queue holds the requests which were already passed to lcb_get3().
     * It is popped when the callback arrives (and is popped in order!) */
    sllist_root cb_queue;

    unsigned n_awaiting_schedule;
    unsigned n_awaiting_response;

    unsigned max_pending_response;
    unsigned min_batch_size;
    unsigned cancelled;
    unsigned refcount;
};

struct DocRequest {
    /* Callback. Must be first */
    lcb_RESPCALLBACK callback;
    sllist_node slnode;
    Queue *parent;
    lcb_RESPGET docresp;
    /* To be filled in by the subclass */
    lcb_IOV docid;
    unsigned ready;
};


} // namespace docreq
} // namespace lcb
#endif

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
libcouchbase-1.2.8 ext/libcouchbase/src/views/docreq.h
libcouchbase-1.2.7 ext/libcouchbase/src/views/docreq.h
libcouchbase-1.2.6 ext/libcouchbase/src/views/docreq.h
libcouchbase-1.2.5 ext/libcouchbase/src/views/docreq.h
libcouchbase-1.2.4 ext/libcouchbase/src/views/docreq.h
libcouchbase-1.2.3 ext/libcouchbase/src/views/docreq.h
libcouchbase-1.2.2 ext/libcouchbase/src/views/docreq.h
libcouchbase-1.2.1 ext/libcouchbase/src/views/docreq.h
libcouchbase-1.2.0 ext/libcouchbase/src/views/docreq.h
libcouchbase-1.1.1 ext/libcouchbase/src/views/docreq.h
libcouchbase-1.1.0 ext/libcouchbase/src/views/docreq.h
libcouchbase-1.0.4 ext/libcouchbase/src/views/docreq.h
libcouchbase-1.0.3 ext/libcouchbase/src/views/docreq.h
libcouchbase-1.0.2 ext/libcouchbase/src/views/docreq.h
libcouchbase-1.0.1 ext/libcouchbase/src/views/docreq.h
libcouchbase-1.0.0 ext/libcouchbase/src/views/docreq.h
libcouchbase-0.2.0 ext/libcouchbase/src/views/docreq.h
libcouchbase-0.1.0 ext/libcouchbase/src/views/docreq.h
libcouchbase-0.0.9 ext/libcouchbase/src/views/docreq.h
libcouchbase-0.0.8 ext/libcouchbase/src/views/docreq.h