3593ceebb2ec280e9d8692a141af44c24115576b
[oweals/dinit.git] / src / tests / test_service.h
1 #include "service.h"
2
3 class test_service : public service_record
4 {
5     public:
6     test_service(service_set *set, std::string name, service_type type_p,
7             const std::list<prelim_dep> &deplist_p)
8             : service_record(set, name, type_p, deplist_p)
9     {
10
11     }
12
13     // Do any post-dependency startup; return false on failure
14     virtual bool bring_up() noexcept override
15     {
16         // return service_record::bring_up();
17         return true;
18     }
19
20     // All dependents have stopped.
21     virtual void bring_down() noexcept override
22     {
23         return service_record::bring_down();
24     }
25
26     // Whether a STARTING service can immediately transition to STOPPED (as opposed to
27     // having to wait for it reach STARTED and then go through STOPPING).
28     virtual bool can_interrupt_start() noexcept override
29     {
30         return waiting_for_deps;
31     }
32
33     virtual void interrupt_start() noexcept override
34     {
35
36     }
37
38     void started() noexcept
39     {
40         service_record::started();
41     }
42
43     void failed_to_start() noexcept
44     {
45         service_record::failed_to_start();
46     }
47 };