winss
controller.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2016-2017 Morgan Stanley
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef LIB_WINSS_SUPERVISE_CONTROLLER_HPP_
18 #define LIB_WINSS_SUPERVISE_CONTROLLER_HPP_
19 
20 #include <vector>
21 #include "../not_owning_ptr.hpp"
22 #include "../pipe_server.hpp"
23 #include "supervise.hpp"
24 
25 namespace winss {
35  private:
40  public:
41  static const char kSvcUp;
42  static const char kSvcOnce;
43  static const char kSvcOnceAtMost;
44  static const char kSvcDown;
45  static const char kSvcKill;
46  static const char kSvcTerm;
47  static const char kSvcExit;
49  static const char kSuperviseStart;
50  static const char kSuperviseRun;
51  static const char kSuperviseEnd;
52  static const char kSuperviseBroken;
53  static const char kSuperviseFinished;
54  static const char kSuperviseExit;
66  SuperviseController(const SuperviseController&) = delete;
76  bool Notify(winss::SuperviseNotification notification,
77  const winss::SuperviseState& state);
78 
85  bool Received(const std::vector<char>& data);
86 
94 
99 };
100 } // namespace winss
101 
102 #endif // LIB_WINSS_SUPERVISE_CONTROLLER_HPP_
A listener for server receiving data from pipe clients.
Definition: pipe_server.hpp:296
static const char kSvcDown
Down control char.
Definition: controller.hpp:44
static const char kSuperviseBroken
Broken event.
Definition: controller.hpp:52
bool Notify(winss::SuperviseNotification notification, const winss::SuperviseState &state)
Supervisor listener handler.
Definition: controller.cpp:48
static const char kSvcUp
Up control char.
Definition: controller.hpp:41
static const char kSvcExit
Exit control char.
Definition: controller.hpp:47
A controller for supervised processes.
Definition: controller.hpp:32
Definition: case_ignore.hpp:23
static const char kSuperviseStart
Start event.
Definition: controller.hpp:49
static const char kSuperviseEnd
End event.
Definition: controller.hpp:51
The state of the supervisor.
Definition: supervise.hpp:42
static const char kSuperviseFinished
Finished event.
Definition: controller.hpp:53
static const char kSvcKill
Kill control char.
Definition: controller.hpp:45
static const char kSuperviseExit
Exit event.
Definition: controller.hpp:54
SuperviseController & operator=(const SuperviseController &)=delete
No copy.
static const char kSvcTerm
Terminate control char.
Definition: controller.hpp:46
SuperviseController(winss::NotOwningPtr< winss::Supervise > supervise, winss::NotOwningPtr< winss::OutboundPipeServer > outbound, winss::NotOwningPtr< winss::InboundPipeServer > inbound)
Supervise controller constructor.
Definition: controller.cpp:39
The supervisor listener.
Definition: supervise.hpp:70
SuperviseNotification
The supervisor events which can occur.
Definition: supervise.hpp:57
A container for pointers where the lifetime should be owned by the caller.
Definition: not_owning_ptr.hpp:33
static const char kSvcOnceAtMost
Up once at most control char.
Definition: controller.hpp:43
bool Received(const std::vector< char > &data)
Pipe server received handler.
Definition: controller.cpp:81
static winss::SuperviseNotification GetNotification(char c)
Gets the notification for the given control char.
Definition: controller.cpp:121
static const char kSuperviseRun
Run event.
Definition: controller.hpp:50
static const char kSvcOnce
Up once code.
Definition: controller.hpp:42