memcache/request.h
changeset 44 03a7e064f833
parent 43 e5b714190dee
child 48 1c67f512779b
equal deleted inserted replaced
43:e5b714190dee 44:03a7e064f833
    19     // our key/obj
    19     // our key/obj
    20     struct memcache_key key;
    20     struct memcache_key key;
    21     struct memcache_obj obj;
    21     struct memcache_obj obj;
    22     struct memcache_buf buf;
    22     struct memcache_buf buf;
    23 
    23 
       
    24     // flags to indicate if we have valid obj/buf data
       
    25     char have_obj, have_buf;
       
    26 
    24     // our state
    27     // our state
    25     enum memcache_req_state state;
    28     enum memcache_req_state state;
    26 
    29 
    27     // our user callback argument
    30     // our user callback argument
    28     void *cb_arg;
    31     void *cb_arg;
    35 };
    38 };
    36 
    39 
    37 /*
    40 /*
    38  * Allocate and return a new req, or NULL if unsuccesfull.
    41  * Allocate and return a new req, or NULL if unsuccesfull.
    39  */
    42  */
    40 struct memcache_req *memcache_req_alloc (struct memcache *mc, enum memcache_command cmd_type, const struct memcache_key *key, void *cb_arg);
    43 struct memcache_req *memcache_req_alloc (struct memcache *mc, enum memcache_command cmd_type, const struct memcache_key *key, const struct memcache_obj *obj, const struct memcache_buf *buf, void *cb_arg);
    41 
    44 
    42 /*
    45 /*
    43  * The request has been queued.
    46  * The request has been queued.
    44  */
    47  */
    45 void memcache_req_queued (struct memcache_req *req);
    48 void memcache_req_queued (struct memcache_req *req);
    55  * If the response doesn't contain any data, req_done will be called after this is. Otherwise, this will be called
    58  * If the response doesn't contain any data, req_done will be called after this is. Otherwise, this will be called
    56  * first, followed by zero or more calls to req_data, followed by req_reply/RPL_END + req_done.
    59  * first, followed by zero or more calls to req_data, followed by req_reply/RPL_END + req_done.
    57  *
    60  *
    58  * Note that no req data will not be available when this is first called, only once req_data/req_done is called.
    61  * Note that no req data will not be available when this is first called, only once req_data/req_done is called.
    59  */
    62  */
    60 void memcache_req_reply (struct memcache_req *req, enum memcache_reply reply_type);
    63 void memcache_req_recv (struct memcache_req *req, enum memcache_reply reply_type);
    61 
    64 
    62 /*
    65 /*
    63  * Some amount of reply data has been received. This may be called between the req_reply/MEMCACHE_RPL_VALUE and
    66  * Some amount of reply data has been received. This may be called between the req_reply/MEMCACHE_RPL_VALUE and
    64  * req_reply/MEMCACHE_RPL_END + req_done notifications.
    67  * req_reply/MEMCACHE_RPL_END + req_done notifications.
    65  *
    68  *