Lines Matching refs:it

54     item *it = c->item;  in _finalize_mset()  local
98 META_KEY(p, ITEM_key(it), it->nkey, (it->it_flags & ITEM_KEY_BINARY)); in _finalize_mset()
113 p = itoa_u32(it->nbytes-2, p); in _finalize_mset()
135 item *it = c->item; in complete_nread_ascii() local
142 c->thread->stats.slab_stats[ITEM_clsid(it)].set_cmds++; in complete_nread_ascii()
145 if ((it->it_flags & ITEM_CHUNKED) == 0) { in complete_nread_ascii()
146 if (strncmp(ITEM_data(it) + it->nbytes - 2, "\r\n", 2) == 0) { in complete_nread_ascii()
182 …ret = store_item(it, comm, c->thread, &nbytes, &cas, c->cas ? c->cas : get_cas_id(), c->set_stale); in complete_nread_ascii()
188 MEMCACHED_COMMAND_ADD(c->sfd, ITEM_key(it), it->nkey, in complete_nread_ascii()
189 (ret == 1) ? it->nbytes : -1, cas); in complete_nread_ascii()
192 MEMCACHED_COMMAND_REPLACE(c->sfd, ITEM_key(it), it->nkey, in complete_nread_ascii()
193 (ret == 1) ? it->nbytes : -1, cas); in complete_nread_ascii()
196 MEMCACHED_COMMAND_APPEND(c->sfd, ITEM_key(it), it->nkey, in complete_nread_ascii()
197 (ret == 1) ? it->nbytes : -1, cas); in complete_nread_ascii()
200 MEMCACHED_COMMAND_PREPEND(c->sfd, ITEM_key(it), it->nkey, in complete_nread_ascii()
201 (ret == 1) ? it->nbytes : -1, cas); in complete_nread_ascii()
204 MEMCACHED_COMMAND_SET(c->sfd, ITEM_key(it), it->nkey, in complete_nread_ascii()
205 (ret == 1) ? it->nbytes : -1, cas); in complete_nread_ascii()
208 MEMCACHED_COMMAND_CAS(c->sfd, ITEM_key(it), it->nkey, it->nbytes, in complete_nread_ascii()
522 static inline int make_ascii_get_suffix(char *suffix, item *it, bool return_cas, int nbytes) { in make_ascii_get_suffix() argument
526 if (FLAGS_SIZE(it) == 0) { in make_ascii_get_suffix()
530 p = itoa_u64(*((client_flags_t *) ITEM_suffix(it)), p); in make_ascii_get_suffix()
537 p = itoa_u64(ITEM_get_cas(it), p+1); in make_ascii_get_suffix()
550 item *it; in process_get_command() local
579 it = limited_get(key, nkey, c->thread, exptime, should_touch, DO_UPDATE, &overflow); in process_get_command()
581 stats_prefix_record_get(key, nkey, NULL != it); in process_get_command()
583 if (it) { in process_get_command()
593 MEMCACHED_COMMAND_GET(c->sfd, ITEM_key(it), it->nkey, in process_get_command()
594 it->nbytes, ITEM_get_cas(it)); in process_get_command()
595 int nbytes = it->nbytes; in process_get_command()
599 memcpy(p, ITEM_key(it), it->nkey); in process_get_command()
600 p += it->nkey; in process_get_command()
601 p += make_ascii_get_suffix(p, it, return_cas, nbytes); in process_get_command()
605 if (it->it_flags & ITEM_HDR) { in process_get_command()
606 if (storage_get_item(c, it, resp) != 0) { in process_get_command()
611 item_remove(it); in process_get_command()
614 } else if ((it->it_flags & ITEM_CHUNKED) == 0) { in process_get_command()
615 resp_add_iov(resp, ITEM_data(it), it->nbytes); in process_get_command()
617 resp_add_chunked_iov(resp, it, it->nbytes); in process_get_command()
620 if ((it->it_flags & ITEM_CHUNKED) == 0) { in process_get_command()
621 resp_add_iov(resp, ITEM_data(it), it->nbytes); in process_get_command()
623 resp_add_chunked_iov(resp, it, it->nbytes); in process_get_command()
631 for (ii = 0; ii < it->nkey; ++ii) { in process_get_command()
641 c->thread->stats.slab_stats[ITEM_clsid(it)].touch_hits++; in process_get_command()
643 c->thread->stats.lru_hits[it->slabs_clsid]++; in process_get_command()
649 if ((it->it_flags & ITEM_HDR) == 0) { in process_get_command()
650 resp->item = it; in process_get_command()
653 resp->item = it; in process_get_command()
861 item *it = limited_get(key, nkey, c->thread, 0, false, DONT_UPDATE, &overflow); in process_meta_command() local
862 if (it) { in process_meta_command()
869 if (it->it_flags & ITEM_KEY_BINARY) { in process_meta_command()
873 …total += base64_encode((unsigned char *) ITEM_key(it), it->nkey, (unsigned char *)resp->wbuf + tot… in process_meta_command()
875 memcpy(resp->wbuf + total, ITEM_key(it), it->nkey); in process_meta_command()
876 total += it->nkey; in process_meta_command()
881 ret = snprintf(resp->wbuf + total, WRITE_BUFFER_SIZE - (it->nkey + 12), in process_meta_command()
883 (it->exptime == 0) ? -1 : (it->exptime - current_time), in process_meta_command()
884 (unsigned long long)(current_time - it->time), in process_meta_command()
885 (unsigned long long)ITEM_get_cas(it), in process_meta_command()
886 (it->it_flags & ITEM_FETCHED) ? "yes" : "no", in process_meta_command()
887 ITEM_clsid(it), in process_meta_command()
888 (unsigned long) ITEM_ntotal(it)); in process_meta_command()
890 item_remove(it); in process_meta_command()
1078 item *it; in process_mget_command() local
1124 it = limited_get(key, nkey, c->thread, 0, false, !of.no_update, &overflow); in process_mget_command()
1127 it = limited_get_locked(key, nkey, c->thread, DONT_UPDATE, &hv, &overflow); in process_mget_command()
1134 assert(it == NULL); in process_mget_command()
1139 if (it == NULL && of.vivify) { in process_mget_command()
1141 it = item_alloc(key, nkey, 0, realtime(0), 2); in process_mget_command()
1147 if (it != NULL) { in process_mget_command()
1149 memcpy(ITEM_data(it), "\r\n", 2); in process_mget_command()
1151 do_item_link(it, hv, of.has_cas_in ? of.cas_id_in : get_cas_id()); in process_mget_command()
1158 if (it) { in process_mget_command()
1161 p = itoa_u32(it->nbytes-2, p+3); in process_mget_command()
1171 it->exptime = of.exptime; in process_mget_command()
1175 it->exptime = of.autoviv_exptime; in process_mget_command()
1182 if ((it->it_flags & ITEM_TOKEN_SENT) == 0 in process_mget_command()
1184 && it->exptime != 0 in process_mget_command()
1185 && it->exptime < of.recache_time) { in process_mget_command()
1191 p = itoa_u32(it->nbytes-2, p); in process_mget_command()
1197 if (it->exptime == 0) { in process_mget_command()
1202 p = itoa_u32(it->exptime - current_time, p); in process_mget_command()
1207 p = itoa_u64(ITEM_get_cas(it), p); in process_mget_command()
1211 if (FLAGS_SIZE(it) == 0) { in process_mget_command()
1215 p = itoa_u64(*((client_flags_t *) ITEM_suffix(it)), p); in process_mget_command()
1220 p = itoa_u32(current_time - it->time, p); in process_mget_command()
1224 if (it->it_flags & ITEM_FETCHED) { in process_mget_command()
1241 META_KEY(p, ITEM_key(it), it->nkey, (it->it_flags & ITEM_KEY_BINARY)); in process_mget_command()
1249 if (it->it_flags & ITEM_TOKEN_SENT) { in process_mget_command()
1252 if (it->it_flags & ITEM_STALE) { in process_mget_command()
1255 if ((it->it_flags & ITEM_TOKEN_SENT) == 0) { in process_mget_command()
1264 it->it_flags |= ITEM_TOKEN_SENT; in process_mget_command()
1276 if (it->it_flags & ITEM_HDR) { in process_mget_command()
1277 if (storage_get_item(c, it, resp) != 0) { in process_mget_command()
1284 } else if ((it->it_flags & ITEM_CHUNKED) == 0) { in process_mget_command()
1285 resp_add_iov(resp, ITEM_data(it), it->nbytes); in process_mget_command()
1287 resp_add_chunked_iov(resp, it, it->nbytes); in process_mget_command()
1290 if ((it->it_flags & ITEM_CHUNKED) == 0) { in process_mget_command()
1291 resp_add_iov(resp, ITEM_data(it), it->nbytes); in process_mget_command()
1293 resp_add_chunked_iov(resp, it, it->nbytes); in process_mget_command()
1301 if ((it->it_flags & ITEM_HDR) != 0 && of.value) { in process_mget_command()
1305 resp->item = it; in process_mget_command()
1310 do_item_remove(it); in process_mget_command()
1312 item_remove(it); in process_mget_command()
1316 resp->item = it; in process_mget_command()
1324 if (!of.no_update && it != NULL) { in process_mget_command()
1325 do_item_bump(c->thread, it, hv); in process_mget_command()
1336 c->thread->stats.slab_stats[ITEM_clsid(it)].touch_hits++; in process_mget_command()
1338 c->thread->stats.lru_hits[it->slabs_clsid]++; in process_mget_command()
1386 if (it) { in process_mget_command()
1387 do_item_remove(it); in process_mget_command()
1398 item *it; in process_mset_command() local
1535 it = item_alloc(key, nkey, of.client_flags, exptime, vlen); in process_mset_command()
1537 if (it == 0) { in process_mset_command()
1560 it = item_get_locked(key, nkey, c->thread, DONT_UPDATE, &hv); in process_mset_command()
1561 if (it) { in process_mset_command()
1562 do_item_unlink(it, hv); in process_mset_command()
1563 STORAGE_delete(c->thread->storage, it); in process_mset_command()
1564 do_item_remove(it); in process_mset_command()
1570 ITEM_set_cas(it, of.req_cas_id); in process_mset_command()
1572 c->item = it; in process_mset_command()
1574 if (it->it_flags & ITEM_CHUNKED) { in process_mset_command()
1575 c->ritem = ITEM_schunk(it); in process_mset_command()
1577 c->ritem = ITEM_data(it); in process_mset_command()
1580 c->ritem = ITEM_data(it); in process_mset_command()
1582 c->rlbytes = it->nbytes; in process_mset_command()
1587 it->it_flags |= ITEM_KEY_BINARY; in process_mset_command()
1613 item *it = NULL; in process_mdelete_command() local
1667 it = item_get_locked(key, nkey, c->thread, DONT_UPDATE, &hv); in process_mdelete_command()
1668 if (it) { in process_mdelete_command()
1669 MEMCACHED_COMMAND_DELETE(c->sfd, ITEM_key(it), it->nkey); in process_mdelete_command()
1672 if (of.has_cas && ITEM_get_cas(it) != of.req_cas_id) { in process_mdelete_command()
1687 of.has_cas_in ? of.cas_id_in : ITEM_get_cas(it), CAS_NO_STALE)) { in process_mdelete_command()
1688 do_item_remove(it); in process_mdelete_command()
1689 it = new_it; in process_mdelete_command()
1706 it->exptime = of.exptime; in process_mdelete_command()
1708 it->it_flags |= ITEM_STALE; in process_mdelete_command()
1710 it->it_flags &= ~ITEM_TOKEN_SENT; in process_mdelete_command()
1712 ITEM_set_cas(it, of.has_cas_in ? of.cas_id_in : get_cas_id()); in process_mdelete_command()
1720 c->thread->stats.slab_stats[ITEM_clsid(it)].delete_hits++; in process_mdelete_command()
1723 LOGGER_LOG(NULL, LOG_DELETIONS, LOGGER_DELETIONS, it, LOG_TYPE_META_DELETE); in process_mdelete_command()
1725 do_item_unlink(it, hv); in process_mdelete_command()
1726 STORAGE_delete(c->thread->storage, it); in process_mdelete_command()
1742 if (it) { in process_mdelete_command()
1743 do_item_remove(it); in process_mdelete_command()
1755 if (it) { in process_mdelete_command()
1756 do_item_remove(it); in process_mdelete_command()
1779 item *it = NULL; // item returned by do_add_delta. in process_marithmetic_command() local
1834 switch(do_add_delta(c->thread, key, nkey, incr, of.delta, tmpbuf, &of.req_cas_id, hv, &it)) { in process_marithmetic_command()
1842 ITEM_set_cas(it, of.cas_id_in); in process_marithmetic_command()
1858 it = item_alloc(key, nkey, 0, 0, vlen+2); in process_marithmetic_command()
1859 if (it != NULL) { in process_marithmetic_command()
1860 memcpy(ITEM_data(it), tmpbuf, vlen); in process_marithmetic_command()
1861 memcpy(ITEM_data(it) + vlen, "\r\n", 2); in process_marithmetic_command()
1862 if (do_store_item(it, NREAD_ADD, c->thread, hv, NULL, NULL, in process_marithmetic_command()
1896 if (it) { in process_marithmetic_command()
1910 p = itoa_u64(ITEM_get_cas(it), p); in process_marithmetic_command()
1914 if (it->exptime == 0) { in process_marithmetic_command()
1919 p = itoa_u32(it->exptime - current_time, p); in process_marithmetic_command()
1923 it->exptime = of.exptime; in process_marithmetic_command()
1927 it->exptime = of.autoviv_exptime; in process_marithmetic_command()
1954 do_item_remove(it); in process_marithmetic_command()
1985 if (it != NULL) in process_marithmetic_command()
1986 do_item_remove(it); in process_marithmetic_command()
2001 item *it; in process_update_command() local
2042 it = item_alloc(key, nkey, flags, exptime, vlen); in process_update_command()
2044 if (it == 0) { in process_update_command()
2068 it = item_get(key, nkey, c->thread, DONT_UPDATE); in process_update_command()
2069 if (it) { in process_update_command()
2070 item_unlink(it); in process_update_command()
2071 STORAGE_delete(c->thread->storage, it); in process_update_command()
2072 item_remove(it); in process_update_command()
2078 ITEM_set_cas(it, req_cas_id); in process_update_command()
2080 c->item = it; in process_update_command()
2082 if (it->it_flags & ITEM_CHUNKED) { in process_update_command()
2083 c->ritem = ITEM_schunk(it); in process_update_command()
2085 c->ritem = ITEM_data(it); in process_update_command()
2088 c->ritem = ITEM_data(it); in process_update_command()
2090 c->rlbytes = it->nbytes; in process_update_command()
2100 item *it; in process_touch_command() local
2120 it = item_touch(key, nkey, exptime, c->thread); in process_touch_command()
2121 if (it) { in process_touch_command()
2124 c->thread->stats.slab_stats[ITEM_clsid(it)].touch_hits++; in process_touch_command()
2128 item_remove(it); in process_touch_command()
2192 item *it; in process_delete_command() local
2222 it = item_get_locked(key, nkey, c->thread, DONT_UPDATE, &hv); in process_delete_command()
2223 if (it) { in process_delete_command()
2224 MEMCACHED_COMMAND_DELETE(c->sfd, ITEM_key(it), it->nkey); in process_delete_command()
2227 c->thread->stats.slab_stats[ITEM_clsid(it)].delete_hits++; in process_delete_command()
2229 LOGGER_LOG(NULL, LOG_DELETIONS, LOGGER_DELETIONS, it, LOG_TYPE_DELETE); in process_delete_command()
2230 do_item_unlink(it, hv); in process_delete_command()
2231 STORAGE_delete(c->thread->storage, it); in process_delete_command()
2232 do_item_remove(it); /* release our reference */ in process_delete_command()