• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2021 Huawei Technologies Co., Ltd
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 MINDSPORE_CORE_MINDRT_INCLUDE_MINDRT_HPP_H_
18 #define MINDSPORE_CORE_MINDRT_INCLUDE_MINDRT_HPP_H_
19 
20 #include <string>
21 #include "mindrt/include/actor/actor.h"
22 
23 // brief provide an asynchronous programming framework as Actor model
24 namespace mindspore {
25 struct MindrtAddress {
26   std::string scheme;
27   std::string ip;
28   uint16_t port;
29 };
30 
31 // brief initialize the library
32 int Initialize(const std::string &tcpUrl, const std::string &tcpUrlAdv = "", const std::string &udpUrl = "",
33                const std::string &udpUrlAdv = "", int threadCount = 0);
34 
35 // brief spawn a process to run an actor
36 AID Spawn(const ActorReference actor, bool sharedThread = true);
37 
38 // brief wait for the actor process to exit . It will be discarded
39 void Await(const ActorReference &actor);
40 
41 // brief get actor with aid
42 ActorReference GetActor(const AID &actor);
43 
44 // brief wait for the actor process to exit
45 void Await(const AID &actor);
46 
47 // brief  Terminate the actor  to exit
48 void Terminate(const AID &actor);
49 
50 // brief  Terminate all actors
51 void TerminateAll();
52 
53 // brief terminate the process. It will be discarded
54 void Finalize();
55 
56 // brief set the delegate of restful
57 void SetDelegate(const std::string &delegate);
58 
59 // set log pid of the process use mindrt
60 void SetLogPID(int pid);
61 
62 // get global mindrt address
63 const MindrtAddress &GetMindrtAddress();
64 
65 // get flag of http message format
66 int GetHttpKmsgFlag();
67 
68 // brief set flag of http message format
69 void SetHttpKmsgFlag(int flag);
70 }  // namespace mindspore
71 #endif
72