MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
items.h
1 #ifndef ITEMS_H
2 #define ITEMS_H
3 
4 /*
5  * You should not try to aquire any of the item locks before calling these
6  * functions.
7  */
8 typedef struct _hash_item {
9  struct _hash_item *next;
10  struct _hash_item *prev;
11  struct _hash_item *h_next; /* hash chain next */
12  rel_time_t time; /* least recent access */
13  rel_time_t exptime;
15  uint32_t nbytes;
16  uint32_t flags;
17  uint16_t nkey;
18  uint16_t iflag;
21  unsigned short refcount;
22  uint8_t slabs_clsid;/* which slab class we're in */
23 } hash_item;
24 
25 typedef struct {
26  unsigned int evicted;
27  unsigned int evicted_nonzero;
28  rel_time_t evicted_time;
29  unsigned int outofmemory;
30  unsigned int tailrepairs;
31  unsigned int reclaimed;
32 } itemstats_t;
33 
34 struct items {
35  hash_item *heads[POWER_LARGEST];
36  hash_item *tails[POWER_LARGEST];
37  itemstats_t itemstats[POWER_LARGEST];
38  unsigned int sizes[POWER_LARGEST];
39 };
40 
41 
52 hash_item *item_alloc(struct default_engine *engine,
53  const void *key, size_t nkey, int flags,
54  rel_time_t exptime, int nbytes, const void *cookie);
55 
64 hash_item *item_get(struct default_engine *engine,
65  const void *key, const size_t nkey);
66 
71 void item_stats_reset(struct default_engine *engine);
72 
80 void item_stats(struct default_engine *engine,
81  ADD_STAT add_stat,
82  const void *cookie);
83 
91 void item_stats_sizes(struct default_engine *engine,
92  ADD_STAT add_stat, const void *cookie);
93 
104 char *item_cachedump(struct default_engine *engine,
105  const unsigned int slabs_clsid,
106  const unsigned int limit,
107  unsigned int *bytes);
108 
114 void item_flush_expired(struct default_engine *engine, time_t when);
115 
121 void item_release(struct default_engine *engine, hash_item *it);
122 
128 void item_unlink(struct default_engine *engine, hash_item *it);
129 
138 hash_item *touch_item(struct default_engine *engine,
139  const void *key,
140  uint16_t nkey,
141  uint32_t exptime);
142 
154 ENGINE_ERROR_CODE store_item(struct default_engine *engine,
155  hash_item *item,
156  uint64_t *cas,
157  ENGINE_STORE_OPERATION operation,
158  const void *cookie);
159 
160 ENGINE_ERROR_CODE arithmetic(struct default_engine *engine,
161  const void* cookie,
162  const void* key,
163  const int nkey,
164  const bool increment,
165  const bool create,
166  const uint64_t delta,
167  const uint64_t initial,
168  const rel_time_t exptime,
169  uint64_t *cas,
170  uint64_t *result);
171 
172 
177 bool item_start_scrub(struct default_engine *engine);
178 
182 tap_event_t item_tap_walker(ENGINE_HANDLE* handle,
183  const void *cookie, item **itm,
184  void **es, uint16_t *nes, uint8_t *ttl,
185  uint16_t *flags, uint32_t *seqno,
186  uint16_t *vbucket);
187 
188 bool initialize_item_tap_walker(struct default_engine *engine,
189  const void* cookie);
190 
191 
192 #endif