xref: /memcached-1.4.29/items.h (revision 690a9a9d)
1 /* See items.c */
2 uint64_t get_cas_id(void);
3 
4 /*@null@*/
5 item *do_item_alloc(char *key, const size_t nkey, const unsigned int flags, const rel_time_t exptime, const int nbytes);
6 void item_free(item *it);
7 bool item_size_ok(const size_t nkey, const int flags, const int nbytes);
8 
9 int  do_item_link(item *it, const uint32_t hv);     /** may fail if transgresses limits */
10 void do_item_unlink(item *it, const uint32_t hv);
11 void do_item_unlink_nolock(item *it, const uint32_t hv);
12 void do_item_remove(item *it);
13 void do_item_update(item *it);   /** update LRU time to current and reposition */
14 void do_item_update_nolock(item *it);
15 int  do_item_replace(item *it, item *new_it, const uint32_t hv);
16 
17 int item_is_flushed(item *it);
18 
19 /*@null@*/
20 char *item_cachedump(const unsigned int slabs_clsid, const unsigned int limit, unsigned int *bytes);
21 void item_stats(ADD_STAT add_stats, void *c);
22 void item_stats_totals(ADD_STAT add_stats, void *c);
23 /*@null@*/
24 void item_stats_sizes(ADD_STAT add_stats, void *c);
25 void item_stats_sizes_init(void);
26 void item_stats_sizes_enable(ADD_STAT add_stats, void *c);
27 void item_stats_sizes_disable(ADD_STAT add_stats, void *c);
28 void item_stats_sizes_add(item *it);
29 void item_stats_sizes_remove(item *it);
30 bool item_stats_sizes_status(void);
31 
32 item *do_item_get(const char *key, const size_t nkey, const uint32_t hv, conn *c);
33 item *do_item_touch(const char *key, const size_t nkey, uint32_t exptime, const uint32_t hv, conn *c);
34 void item_stats_reset(void);
35 extern pthread_mutex_t lru_locks[POWER_LARGEST];
36 
37 enum crawler_result_type {
38     CRAWLER_OK=0, CRAWLER_RUNNING, CRAWLER_BADCLASS, CRAWLER_NOTSTARTED
39 };
40 
41 int start_lru_maintainer_thread(void);
42 int stop_lru_maintainer_thread(void);
43 int init_lru_maintainer(void);
44 void lru_maintainer_pause(void);
45 void lru_maintainer_resume(void);
46 
47 int start_item_crawler_thread(void);
48 int stop_item_crawler_thread(void);
49 int init_lru_crawler(void);
50 enum crawler_result_type lru_crawler_crawl(char *slabs);
51 void lru_crawler_pause(void);
52 void lru_crawler_resume(void);
53