]> git.ipfire.org Git - thirdparty/squid.git/blob - src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / DiskIO / DiskDaemon / DiskDaemonDiskIOModule.cc
1 /*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #include "squid.h"
10 #include "DiskDaemonDiskIOModule.h"
11 #include "DiskdIOStrategy.h"
12 #include "DiskIO/DiskDaemon/DiskdAction.h"
13 #include "mgr/Registration.h"
14 #include "Store.h"
15
16 DiskDaemonDiskIOModule::DiskDaemonDiskIOModule() : initialised(false)
17 {
18 ModuleAdd(*this);
19 }
20
21 DiskDaemonDiskIOModule &
22 DiskDaemonDiskIOModule::GetInstance()
23 {
24 return Instance;
25 }
26
27 void
28 DiskDaemonDiskIOModule::init()
29 {
30 /* We may be reused - for instance in coss - eventually.
31 * When we do, we either need per-using-module stats (
32 * no singleton pattern), or we need to refcount the
33 * initialisation level and handle multiple clients.
34 * RBC - 20030718.
35 */
36 assert(!initialised);
37 memset(&diskd_stats, '\0', sizeof(diskd_stats));
38 #if 0
39 /*
40 * DPW 2007-04-12
41 * No debugging here please because this method is called before
42 * the debug log is configured and we'll get the message on
43 * stderr when doing things like 'squid -k reconfigure'
44 */
45 debugs(47, DBG_IMPORTANT, "diskd started");
46 #endif
47 initialised = true;
48
49 registerWithCacheManager();
50 }
51
52 void
53 DiskDaemonDiskIOModule::registerWithCacheManager(void)
54 {
55 Mgr::RegisterAction("diskd", "DISKD Stats", &DiskdAction::Create, 0, 1);
56 }
57
58 void
59 DiskDaemonDiskIOModule::gracefulShutdown()
60 {
61 initialised = false;
62 }
63
64 DiskIOStrategy *
65 DiskDaemonDiskIOModule::createStrategy()
66 {
67 return new DiskdIOStrategy();
68 }
69
70 DiskDaemonDiskIOModule DiskDaemonDiskIOModule::Instance;
71
72 char const *
73 DiskDaemonDiskIOModule::type () const
74 {
75 return "DiskDaemon";
76 }
77