Line data Source code
1 : /*
2 : * If not stated otherwise in this file or this component's LICENSE file the
3 : * following copyright and licenses apply:
4 : *
5 : * Copyright 2022 Sky UK
6 : *
7 : * Licensed under the Apache License, Version 2.0 (the "License");
8 : * you may not use this file except in compliance with the License.
9 : * You may obtain a copy of the License at
10 : *
11 : * http://www.apache.org/licenses/LICENSE-2.0
12 : *
13 : * Unless required by applicable law or agreed to in writing, software
14 : * distributed under the License is distributed on an "AS IS" BASIS,
15 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 : * See the License for the specific language governing permissions and
17 : * limitations under the License.
18 : *
19 : * @file IServerManagerService.h
20 : *
21 : * This file comprises the class definition of IServerManagerService.
22 : * An interface, which provides API of RialtoServerManager
23 : */
24 :
25 : #ifndef RIALTO_SERVERMANAGER_SERVICE_I_SERVER_MANAGER_SERVICE_H_
26 : #define RIALTO_SERVERMANAGER_SERVICE_I_SERVER_MANAGER_SERVICE_H_
27 :
28 : #include "ILogHandler.h"
29 : #include "LoggingLevels.h"
30 : #include "SessionServerCommon.h"
31 : #include <memory>
32 : #include <string>
33 :
34 : namespace rialto::servermanager::service
35 : {
36 : /**
37 : * @brief Represents API of RialtoServerManager
38 : *
39 : * This class represents all functionality of RialtoServerManager.
40 : */
41 : class IServerManagerService
42 : {
43 : public:
44 9 : IServerManagerService() = default;
45 9 : virtual ~IServerManagerService() = default;
46 :
47 : IServerManagerService(const IServerManagerService &) = delete;
48 : IServerManagerService &operator=(const IServerManagerService &) = delete;
49 : IServerManagerService(IServerManagerService &&) = delete;
50 : IServerManagerService &operator=(IServerManagerService &&) = delete;
51 :
52 : /**
53 : * @brief Moves an application from NOT_RUNNING to ACTIVE or INACTIVE state
54 : *
55 : * This method causes a new RialtoSessionServer instance is spawned for the application in the requested state.
56 : * This API will return error if the application is already in the ACTIVE or INACTIVE state (the
57 : * changeSessionServerState() API should be used in this scenario).
58 : *
59 : * @param[in] appId : The ID of the application
60 : * @param[in] state : Desired state, cannot be NOT_RUNNING
61 : * @param[in] appConfig : Configuration parameters for app
62 : *
63 : * @retval true on success.
64 : */
65 : virtual bool initiateApplication(const std::string &appId, const firebolt::rialto::common::SessionServerState &state,
66 : const firebolt::rialto::common::AppConfig &appConfig) = 0;
67 :
68 : /**
69 : * @brief Changes session server state
70 : *
71 : * This method requests an session server to change its state. This API will return an error if the application is
72 : * currently in the NOT_RUNNING state (in this scenario the initApplication() API should be used otherwise SetState
73 : * request is sent to RialtoSessionServer for the app.
74 : *
75 : * @param[in] appId : The ID of the application
76 : * @param[in] state : Desired state
77 : *
78 : * @retval true on success.
79 : */
80 : virtual bool changeSessionServerState(const std::string &appId,
81 : const firebolt::rialto::common::SessionServerState &state) = 0;
82 :
83 : /**
84 : * @brief Returns the name of a socket, which is used for RialtoSessionServer <-> Application communication
85 : *
86 : * This method returns the name of a socket, which is used for RialtoSessionServer <-> Application communication.
87 : * Socket name is generated by RialtoServerManager when RialtoSessionServer is spawned.
88 : *
89 : * @param[in] appId : The ID of an application
90 : *
91 : * @retval string with socket name
92 : */
93 : virtual std::string getAppConnectionInfo(const std::string &appId) const = 0;
94 :
95 : /**
96 : * @brief Sets logging level of rialto applications
97 : *
98 : * This method requests all rialto applications to set its logging level
99 : *
100 : * @param[in] logLevels : Log levels of rialto components
101 : *
102 : * @retval true on success.
103 : */
104 : virtual bool setLogLevels(const LoggingLevels &logLevels) const = 0;
105 :
106 : /**
107 : * @brief Registers new log handler for rialto server manager
108 : *
109 : * This method registers new log handler for rialto server manager. All server manager logs will be forwarded to
110 : * ILogHandler::log function
111 : *
112 : * @param[in] handler : Custom log handler.
113 : *
114 : * @retval true on success.
115 : */
116 : virtual bool registerLogHandler(const std::shared_ptr<ILogHandler> &handler) = 0;
117 : };
118 : } // namespace rialto::servermanager::service
119 :
120 : #endif // RIALTO_SERVERMANAGER_SERVICE_I_SERVER_MANAGER_SERVICE_H_
|