summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/tier.h
blob: 6dc830dabfaa03953c0f019b1643a0f7b6150761 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
  Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
  This file is part of GlusterFS.

  This file is licensed to you under your choice of the GNU Lesser
  General Public License, version 3 or any later version (LGPLv3 or
  later), or the GNU General Public License, version 2 (GPLv2), in all
  cases as published by the Free Software Foundation.
*/

#ifndef _TIER_H_
#define _TIER_H_

#ifndef _CONFIG_H
#define _CONFIG_H
#include "config.h"
#endif


/******************************************************************************/
/* This is from dht-rebalancer.c as we dont have dht-rebalancer.h */
#include "dht-common.h"
#include "xlator.h"
#include <signal.h>
#include <fnmatch.h>
#include <signal.h>

#define DEFAULT_PROMOTE_FREQ_SEC 120
#define DEFAULT_DEMOTE_FREQ_SEC  120
#define DEFAULT_WRITE_FREQ_SEC 120
#define DEFAULT_READ_FREQ_SEC 120

/*
 * Size of timer wheel. We would not promote or demote less
 * frequently than this number.
 */
#define TIMER_SECS 3600

#include "gfdb_data_store.h"
#include <ctype.h>
#include <sys/stat.h>

#define PROMOTION_QFILE "promotequeryfile"
#define DEMOTION_QFILE "demotequeryfile"

#define GET_QFILE_PATH(is_promotion)\
        (is_promotion) ? promotion_qfile : demotion_qfile

typedef struct _query_cbk_args {
        xlator_t *this;
        gf_defrag_info_t *defrag;
        FILE *queryFILE;
} query_cbk_args_t;

int
gf_run_tier(xlator_t *this, gf_defrag_info_t *defrag);

typedef struct _gfdb_brick_dict_info {
        gfdb_time_t           *time_stamp;
        gf_boolean_t            _gfdb_promote;
        query_cbk_args_t       *_query_cbk_args;
} _gfdb_brick_dict_info_t;

typedef struct _dm_thread_args {
        xlator_t                *this;
        gf_defrag_info_t        *defrag;
        dict_t                  *brick_list;
        int                     freq_time;
        int                     return_value;
} promotion_args_t, demotion_args_t;

#endif