summaryrefslogtreecommitdiff
path: root/src/ot_clean.h
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-11-02 20:50:24 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-11-02 21:14:02 +0100
commitad541c67761b8aa6da1566802c347cac4018d0c2 (patch)
treea9166fa9d349911d69a6948e53b05344dcc348a0 /src/ot_clean.h
parentc679ff8a3b1418a5960cc49ba6458a0007df54fa (diff)
Move the build sources into src/
Diffstat (limited to 'src/ot_clean.h')
-rw-r--r--src/ot_clean.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/ot_clean.h b/src/ot_clean.h
new file mode 100644
index 0000000..0592791
--- /dev/null
+++ b/src/ot_clean.h
@@ -0,0 +1,28 @@
1/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
2 It is considered beerware. Prost. Skol. Cheers or whatever. */
3
4#ifndef OT_CLEAN_H__
5#define OT_CLEAN_H__
6
7#include "trackerlogic.h"
8
9/* The amount of time a clean cycle should take */
10#define OT_CLEAN_INTERVAL_MINUTES 2
11
12/* How often the cleaner may wake. A full sweep takes OT_CLEAN_INTERVAL_MINUTES.
13 The clean operations per wake is goverend by OT_BUCKET_COUNT_BITS,
14 set by the Makefile.
15 At the default of 1024 buckets this works out at one bucket every
16 117 ms. */
17#define OT_CLEAN_MAX_WAKES_PER_SECOND 10
18
19#define OT_CLEAN_WAKE_BUDGET ((OT_CLEAN_INTERVAL_MINUTES) * 60 * (OT_CLEAN_MAX_WAKES_PER_SECOND))
20#define OT_CLEAN_BUCKETS_PER_WAKE (((OT_BUCKET_COUNT) + (OT_CLEAN_WAKE_BUDGET) - 1) / (OT_CLEAN_WAKE_BUDGET))
21#define OT_CLEAN_WAKES ((OT_BUCKET_COUNT) / (OT_CLEAN_BUCKETS_PER_WAKE))
22#define OT_CLEAN_SLEEP (((OT_CLEAN_INTERVAL_MINUTES) * 60 * 1000000) / (OT_CLEAN_WAKES))
23
24void clean_init(void);
25void clean_deinit(void);
26int clean_single_torrent(ot_torrent *torrent);
27
28#endif