1 #ifndef CRAWLER_H
2 #define CRAWLER_H
3 
4 #define LRU_CRAWLER_CAP_REMAINING -1
5 
6 typedef struct {
7     uint64_t histo[61];
8     uint64_t ttl_hourplus;
9     uint64_t noexp;
10     uint64_t reclaimed;
11     uint64_t seen;
12     rel_time_t start_time;
13     rel_time_t end_time;
14     bool run_complete;
15 } crawlerstats_t;
16 
17 struct crawler_expired_data {
18     pthread_mutex_t lock;
19     crawlerstats_t crawlerstats[POWER_LARGEST];
20     /* redundant with crawlerstats_t so we can get overall start/stop/done */
21     rel_time_t start_time;
22     rel_time_t end_time;
23     bool crawl_complete;
24     bool is_external; /* whether this was an alloc local or remote to the module. */
25 };
26 
27 enum crawler_result_type {
28     CRAWLER_OK=0, CRAWLER_RUNNING, CRAWLER_BADCLASS, CRAWLER_NOTSTARTED, CRAWLER_ERROR
29 };
30 int start_item_crawler_thread(void);
31 #define CRAWLER_WAIT true
32 #define CRAWLER_NOWAIT false
33 int stop_item_crawler_thread(bool wait);
34 int init_lru_crawler(void *arg);
35 enum crawler_result_type lru_crawler_crawl(char *slabs, enum crawler_run_type,
36         void *c, const int sfd, unsigned int remaining);
37 int lru_crawler_start(uint8_t *ids, uint32_t remaining,
38                              const enum crawler_run_type type, void *data,
39                              void *c, const int sfd);
40 void lru_crawler_pause(void);
41 void lru_crawler_resume(void);
42 
43 #endif
44