Lines Matching refs:it

140 static int proxy_storage_get(LIBEVENT_THREAD *t, item *it, mc_resp *resp,  in proxy_storage_get()  argument
144 memcpy(&hdr, ITEM_data(it), sizeof(hdr)); in proxy_storage_get()
146 item_hdr *hdr = (item_hdr *)ITEM_data(it); in proxy_storage_get()
148 size_t ntotal = ITEM_ntotal(it); in proxy_storage_get()
156 io->hdr_it = it; in proxy_storage_get()
173 resp_add_iov(resp, "", it->nbytes); in proxy_storage_get()
204 static inline int make_ascii_get_suffix(char *suffix, item *it, bool return_cas, int nbytes) { in make_ascii_get_suffix() argument
208 if (FLAGS_SIZE(it) == 0) { in make_ascii_get_suffix()
212 p = itoa_u64(*((client_flags_t *) ITEM_suffix(it)), p); in make_ascii_get_suffix()
219 p = itoa_u64(ITEM_get_cas(it), p+1); in make_ascii_get_suffix()
239 item *it = limited_get(key, nkey, t, exptime, should_touch, DO_UPDATE, &overflow); in process_get_cmd() local
240 if (it) { in process_get_cmd()
241 int nbytes = it->nbytes;; in process_get_cmd()
242 nbytes = it->nbytes; in process_get_cmd()
246 memcpy(p, ITEM_key(it), it->nkey); in process_get_cmd()
247 p += it->nkey; in process_get_cmd()
248 p += make_ascii_get_suffix(p, it, return_cas, nbytes); in process_get_cmd()
252 if (it->it_flags & ITEM_HDR) { in process_get_cmd()
253 if (proxy_storage_get(t, it, resp, PROXY_STORAGE_GET) != 0) { in process_get_cmd()
258 item_remove(it); in process_get_cmd()
262 } else if ((it->it_flags & ITEM_CHUNKED) == 0) { in process_get_cmd()
263 resp_add_iov(resp, ITEM_data(it), it->nbytes); in process_get_cmd()
265 resp_add_chunked_iov(resp, it, it->nbytes); in process_get_cmd()
268 if ((it->it_flags & ITEM_CHUNKED) == 0) { in process_get_cmd()
269 resp_add_iov(resp, ITEM_data(it), it->nbytes); in process_get_cmd()
271 resp_add_chunked_iov(resp, it, it->nbytes); in process_get_cmd()
279 t->stats.slab_stats[ITEM_clsid(it)].touch_hits++; in process_get_cmd()
281 t->stats.lru_hits[it->slabs_clsid]++; in process_get_cmd()
287 if ((it->it_flags & ITEM_HDR) == 0) { in process_get_cmd()
288 resp->item = it; in process_get_cmd()
291 resp->item = it; in process_get_cmd()
316 item *it; in process_update_cmd() local
351 it = item_alloc(key, nkey, flags, exptime, pr->vlen); in process_update_cmd()
353 if (it == 0) { in process_update_cmd()
374 it = item_get(key, nkey, t, DONT_UPDATE); in process_update_cmd()
375 if (it) { in process_update_cmd()
376 item_unlink(it); in process_update_cmd()
377 STORAGE_delete(t->storage, it); in process_update_cmd()
378 item_remove(it); in process_update_cmd()
384 ITEM_set_cas(it, req_cas_id); in process_update_cmd()
387 t->stats.slab_stats[ITEM_clsid(it)].set_cmds++; in process_update_cmd()
392 if (_store_item_copy_from_buf(it, pr->vbuf, it->nbytes) != 0) { in process_update_cmd()
394 item_remove(it); in process_update_cmd()
398 …int ret = store_item(it, comm, t, NULL, NULL, (settings.use_cas) ? get_cas_id() : 0, CAS_NO_STALE); in process_update_cmd()
417 item_remove(it); in process_update_cmd()
467 item *it; in process_delete_cmd() local
483 it = item_get_locked(key, nkey, t, DONT_UPDATE, &hv); in process_delete_cmd()
484 if (it) { in process_delete_cmd()
488 t->stats.slab_stats[ITEM_clsid(it)].delete_hits++; in process_delete_cmd()
490 LOGGER_LOG(NULL, LOG_DELETIONS, LOGGER_DELETIONS, it, LOG_TYPE_DELETE); in process_delete_cmd()
491 do_item_unlink(it, hv); in process_delete_cmd()
492 STORAGE_delete(t->storage, it); in process_delete_cmd()
493 do_item_remove(it); /* release our reference */ in process_delete_cmd()
510 item *it; in process_touch_cmd() local
525 it = item_touch(key, nkey, exptime, t); in process_touch_cmd()
526 if (it) { in process_touch_cmd()
529 t->stats.slab_stats[ITEM_clsid(it)].touch_hits++; in process_touch_cmd()
533 item_remove(it); in process_touch_cmd()
750 item *it; in process_mget_cmd() local
786 it = limited_get(key, nkey, t, 0, false, !of.no_update, &overflow); in process_mget_cmd()
789 it = limited_get_locked(key, nkey, t, DONT_UPDATE, &hv, &overflow); in process_mget_cmd()
796 assert(it == NULL); in process_mget_cmd()
801 if (it == NULL && of.vivify) { in process_mget_cmd()
803 it = item_alloc(key, nkey, 0, realtime(0), 2); in process_mget_cmd()
809 if (it != NULL) { in process_mget_cmd()
811 memcpy(ITEM_data(it), "\r\n", 2); in process_mget_cmd()
813 do_item_link(it, hv, of.has_cas_in ? of.cas_id_in : get_cas_id()); in process_mget_cmd()
820 if (it) { in process_mget_cmd()
823 p = itoa_u32(it->nbytes-2, p+3); in process_mget_cmd()
833 it->exptime = of.exptime; in process_mget_cmd()
837 it->exptime = of.autoviv_exptime; in process_mget_cmd()
844 if ((it->it_flags & ITEM_TOKEN_SENT) == 0 in process_mget_cmd()
846 && it->exptime != 0 in process_mget_cmd()
847 && it->exptime < of.recache_time) { in process_mget_cmd()
853 p = itoa_u32(it->nbytes-2, p); in process_mget_cmd()
859 if (it->exptime == 0) { in process_mget_cmd()
864 p = itoa_u32(it->exptime - current_time, p); in process_mget_cmd()
869 p = itoa_u64(ITEM_get_cas(it), p); in process_mget_cmd()
873 if (FLAGS_SIZE(it) == 0) { in process_mget_cmd()
877 p = itoa_u64(*((client_flags_t *) ITEM_suffix(it)), p); in process_mget_cmd()
882 p = itoa_u32(current_time - it->time, p); in process_mget_cmd()
886 if (it->it_flags & ITEM_FETCHED) { in process_mget_cmd()
904 META_KEY(p, ITEM_key(it), it->nkey, (it->it_flags & ITEM_KEY_BINARY)); in process_mget_cmd()
912 if (it->it_flags & ITEM_TOKEN_SENT) { in process_mget_cmd()
915 if (it->it_flags & ITEM_STALE) { in process_mget_cmd()
918 if ((it->it_flags & ITEM_TOKEN_SENT) == 0) { in process_mget_cmd()
927 it->it_flags |= ITEM_TOKEN_SENT; in process_mget_cmd()
939 if (it->it_flags & ITEM_HDR) { in process_mget_cmd()
940 if (proxy_storage_get(t, it, resp, PROXY_STORAGE_MG) != 0) { in process_mget_cmd()
947 } else if ((it->it_flags & ITEM_CHUNKED) == 0) { in process_mget_cmd()
948 resp_add_iov(resp, ITEM_data(it), it->nbytes); in process_mget_cmd()
950 resp_add_chunked_iov(resp, it, it->nbytes); in process_mget_cmd()
953 if ((it->it_flags & ITEM_CHUNKED) == 0) { in process_mget_cmd()
954 resp_add_iov(resp, ITEM_data(it), it->nbytes); in process_mget_cmd()
956 resp_add_chunked_iov(resp, it, it->nbytes); in process_mget_cmd()
964 if ((it->it_flags & ITEM_HDR) != 0 && of.value) { in process_mget_cmd()
968 resp->item = it; in process_mget_cmd()
973 do_item_remove(it); in process_mget_cmd()
975 item_remove(it); in process_mget_cmd()
979 resp->item = it; in process_mget_cmd()
987 if (!of.no_update && it != NULL) { in process_mget_cmd()
988 do_item_bump(t, it, hv); in process_mget_cmd()
999 t->stats.slab_stats[ITEM_clsid(it)].touch_hits++; in process_mget_cmd()
1001 t->stats.lru_hits[it->slabs_clsid]++; in process_mget_cmd()
1046 if (it) { in process_mget_cmd()
1047 do_item_remove(it); in process_mget_cmd()
1059 item *it; in process_mset_cmd() local
1134 it = item_alloc(key, nkey, of.client_flags, exptime, vlen); in process_mset_cmd()
1136 if (it == 0) { in process_mset_cmd()
1151 it = item_get_locked(key, nkey, t, DONT_UPDATE, &hv); in process_mset_cmd()
1152 if (it) { in process_mset_cmd()
1153 do_item_unlink(it, hv); in process_mset_cmd()
1154 STORAGE_delete(t->storage, it); in process_mset_cmd()
1155 do_item_remove(it); in process_mset_cmd()
1161 ITEM_set_cas(it, of.req_cas_id); in process_mset_cmd()
1167 it->it_flags |= ITEM_KEY_BINARY; in process_mset_cmd()
1177 t->stats.slab_stats[ITEM_clsid(it)].set_cmds++; in process_mset_cmd()
1182 if (_store_item_copy_from_buf(it, pr->vbuf, it->nbytes) != 0) { in process_mset_cmd()
1184 item_remove(it); in process_mset_cmd()
1190 …int ret = store_item(it, comm, t, &nbytes, &cas, of.has_cas_in ? of.cas_id_in : get_cas_id(), set_… in process_mset_cmd()
1228 META_KEY(p, ITEM_key(it), it->nkey, (it->it_flags & ITEM_KEY_BINARY)); in process_mset_cmd()
1241 p = itoa_u32(it->nbytes-2, p); in process_mset_cmd()
1256 item_remove(it); in process_mset_cmd()
1268 item *it = NULL; in process_mdelete_cmd() local
1318 it = item_get_locked(key, nkey, t, DONT_UPDATE, &hv); in process_mdelete_cmd()
1319 if (it) { in process_mdelete_cmd()
1321 if (of.has_cas && ITEM_get_cas(it) != of.req_cas_id) { in process_mdelete_cmd()
1336 of.has_cas_in ? of.cas_id_in : ITEM_get_cas(it), CAS_NO_STALE)) { in process_mdelete_cmd()
1337 do_item_remove(it); in process_mdelete_cmd()
1338 it = new_it; in process_mdelete_cmd()
1355 it->exptime = of.exptime; in process_mdelete_cmd()
1357 it->it_flags |= ITEM_STALE; in process_mdelete_cmd()
1359 it->it_flags &= ~ITEM_TOKEN_SENT; in process_mdelete_cmd()
1361 ITEM_set_cas(it, of.has_cas_in ? of.cas_id_in : get_cas_id()); in process_mdelete_cmd()
1368 t->stats.slab_stats[ITEM_clsid(it)].delete_hits++; in process_mdelete_cmd()
1370 LOGGER_LOG(NULL, LOG_DELETIONS, LOGGER_DELETIONS, it, LOG_TYPE_META_DELETE); in process_mdelete_cmd()
1373 do_item_unlink(it, hv); in process_mdelete_cmd()
1374 STORAGE_delete(t->storage, it); in process_mdelete_cmd()
1390 if (it) { in process_mdelete_cmd()
1391 do_item_remove(it); in process_mdelete_cmd()
1403 if (it) { in process_mdelete_cmd()
1404 do_item_remove(it); in process_mdelete_cmd()
1427 item *it = NULL; // item returned by do_add_delta. in process_marithmetic_cmd() local
1479 switch(do_add_delta(t, key, nkey, incr, of.delta, tmpbuf, &of.req_cas_id, hv, &it)) { in process_marithmetic_cmd()
1487 ITEM_set_cas(it, of.cas_id_in); in process_marithmetic_cmd()
1489 cas = ITEM_get_cas(it); in process_marithmetic_cmd()
1504 it = item_alloc(key, nkey, 0, 0, vlen+2); in process_marithmetic_cmd()
1505 if (it != NULL) { in process_marithmetic_cmd()
1506 memcpy(ITEM_data(it), tmpbuf, vlen); in process_marithmetic_cmd()
1507 memcpy(ITEM_data(it) + vlen, "\r\n", 2); in process_marithmetic_cmd()
1508 if (do_store_item(it, NREAD_ADD, t, hv, NULL, &cas, in process_marithmetic_cmd()
1542 if (it) { in process_marithmetic_cmd()
1560 if (it->exptime == 0) { in process_marithmetic_cmd()
1565 p = itoa_u32(it->exptime - current_time, p); in process_marithmetic_cmd()
1569 it->exptime = of.exptime; in process_marithmetic_cmd()
1573 it->exptime = of.autoviv_exptime; in process_marithmetic_cmd()
1600 do_item_remove(it); in process_marithmetic_cmd()
1630 if (it != NULL) in process_marithmetic_cmd()
1631 do_item_remove(it); in process_marithmetic_cmd()