GCS  0.2.3
gcs_fc.h
1 /*
2  * Copyright (C) 2010 Codership Oy <info@codership.com>
3  *
4  * $Id$
5  */
6 
10 #ifndef _gcs_fc_h_
11 #define _gcs_fc_h_
12 
13 #include <time.h>
14 #include <unistd.h>
15 #include <errno.h>
16 
17 typedef struct gcs_fc
18 {
19  ssize_t hard_limit; // hard limit for slave queue size
20  ssize_t soft_limit; // soft limit for slave queue size, after it FC kicks in
21  double max_throttle; // limit on how much we can throttle replication
22  ssize_t init_size; // initial queue size
23  ssize_t size; // current queue size
24  ssize_t last_sleep; // queue size when last sleep happened
25  ssize_t act_count; // action count
26  double max_rate; // normal replication data rate (byte/s)
27  double scale; // data rate scale factor
28  double offset; // data rate offset (rate = scale*size + offset)
29  long long start; // beginning of the time interval (nanosec, monotonic)
30  long debug; // how often to print debug messages, 0 - never
31  ssize_t sleep_count;
32  double sleeps;
33 }
34 gcs_fc_t;
35 
36 extern double const gcs_fc_hard_limit_fix;
37 
39 extern int
40 gcs_fc_init (gcs_fc_t* fc,
41  ssize_t hard_limit, // hard limit
42  double soft_limit, // soft limit as a fraction of hard limit
43  double max_throttle);
44 
46 extern void
47 gcs_fc_reset (gcs_fc_t* fc, ssize_t queue_size);
48 
52 extern long long
53 gcs_fc_process (gcs_fc_t* fc, ssize_t act_size);
54 
56 extern void
57 gcs_fc_debug (gcs_fc_t* fc, long debug_level);
58 
59 #endif /* _gcs_fc_h_ */
Definition: gcs_fc.h:17