memcache/request.h
changeset 39 0e21a65074a6
parent 38 9894df13b779
child 41 540737bf6bac
equal deleted inserted replaced
38:9894df13b779 39:0e21a65074a6
     5 
     5 
     6 #include "../memcache.h"
     6 #include "../memcache.h"
     7 #include "connection.h"
     7 #include "connection.h"
     8 
     8 
     9 struct memcache_req {
     9 struct memcache_req {
    10     struct memcached_connection *conn;
    10     // the memcache context that we belong to
       
    11     struct memcache *mc;
       
    12 
       
    13     // our key/obj
       
    14     struct memcache_key key;
       
    15     struct memcache_obj *obj;
       
    16 
       
    17     // our state
       
    18     enum memcache_req_state state;
       
    19 
       
    20     // our user callback argument
       
    21     void *cb_arg;
       
    22 
       
    23     // the conn 
       
    24     struct memcache_connection *conn;
    11     
    25     
    12     // we are a member of struct memcache_server.req_queue
    26     // we are a member of struct memcache_server.req_queue
    13     TAILQ_ENTRY(memcache_req) reqqueue_node;
    27     TAILQ_ENTRY(memcache_req) reqqueue_node;
    14     
       
    15     // our key/obj
       
    16     struct memcached_key *key;
       
    17     struct memcached_obj *obj;
       
    18 };
    28 };
    19 
    29 
       
    30 /*
       
    31  * Allocate and return a new req, or NULL if unsuccesfull.
       
    32  */
       
    33 struct memcache_req *memcache_req_alloc (struct memcache *mc, struct memcache_key *key, void *cb_arg);
       
    34 
       
    35 
       
    36 /*
       
    37  * An error occurred, and the request must be abandoned. This will assume that the req is not active or enqueued
       
    38  * anymore, and the req should not be accessed by memcache_* code after this.
       
    39  */
       
    40 void memcache_req_error (struct memcache_req *req);
       
    41 
       
    42 /*
       
    43  * Free an unused req. Should always be called by the user, not via internal means.
       
    44  */
       
    45 void memcache_req_free (struct memcache_req *req);
       
    46 
    20 #endif /* MEMCACHE_REQ_H */
    47 #endif /* MEMCACHE_REQ_H */