10 // the memcache context that we belong to |
10 // the memcache context that we belong to |
11 struct memcache *mc; |
11 struct memcache *mc; |
12 |
12 |
13 // the command to execute |
13 // the command to execute |
14 enum memcache_command cmd_type; |
14 enum memcache_command cmd_type; |
|
15 |
|
16 // the reply we have received, or MEMCACHE_REPLY_INVALID |
|
17 enum memcache_reply reply_type; |
15 |
18 |
16 // our key/obj |
19 // our key/obj |
17 struct memcache_key key; |
20 struct memcache_key key; |
18 struct memcache_obj obj; |
21 struct memcache_obj obj; |
19 struct memcache_buf buf; |
22 struct memcache_buf buf; |
34 /* |
37 /* |
35 * Allocate and return a new req, or NULL if unsuccesfull. |
38 * Allocate and return a new req, or NULL if unsuccesfull. |
36 */ |
39 */ |
37 struct memcache_req *memcache_req_alloc (struct memcache *mc, enum memcache_command cmd_type, const struct memcache_key *key, void *cb_arg); |
40 struct memcache_req *memcache_req_alloc (struct memcache *mc, enum memcache_command cmd_type, const struct memcache_key *key, void *cb_arg); |
38 |
41 |
39 |
|
40 /* |
42 /* |
41 * An error occurred, and the request must be abandoned. This will assume that the req is not active or enqueued |
43 * An error occurred, and the request must be abandoned. This will assume that the req is not active or enqueued |
42 * anymore, and the req should not be accessed by memcache_* code after this. |
44 * anymore, and the req should not be accessed by memcache_* code after this. |
43 */ |
45 */ |
44 void memcache_req_error (struct memcache_req *req); |
46 void memcache_req_error (struct memcache_req *req); |
45 |
47 |
46 /* |
48 /* |
|
49 * The request has been queued. |
|
50 */ |
|
51 void memcache_req_queued (struct memcache_req *req); |
|
52 |
|
53 /* |
|
54 * The request is being sent. |
|
55 */ |
|
56 void memcache_req_send (struct memcache_req *req); |
|
57 |
|
58 /* |
|
59 * The response has been received, although if the respones also contains data, that will be notified separately |
|
60 */ |
|
61 void memcache_req_reply (struct memcache_req *req, enum memcache_reply reply_type); |
|
62 |
|
63 /* |
|
64 * The request was sent and is now done, and is not associated with the connection anymore. |
|
65 * |
|
66 * This will be called before req_reply/req_data, but not before/after req_error. |
|
67 */ |
|
68 void memcache_req_done (struct memcache_req *req); |
|
69 |
|
70 /* |
47 * Free an unused req. Should always be called by the user, not via internal means. |
71 * Free an unused req. Should always be called by the user, not via internal means. |
48 */ |
72 */ |
49 void memcache_req_free (struct memcache_req *req); |
73 void memcache_req_free (struct memcache_req *req); |
50 |
74 |
51 #endif /* MEMCACHE_REQ_H */ |
75 #endif /* MEMCACHE_REQ_H */ |