Horizon Official Technical Documentation
System.hpp
Go to the documentation of this file.
1/***************************************************
2 * _ _ _ *
3 * | | | | (_) *
4 * | |_| | ___ _ __ _ _______ _ __ *
5 * | _ |/ _ \| '__| |_ / _ \| '_ \ *
6 * | | | | (_) | | | |/ / (_) | | | | *
7 * \_| |_/\___/|_| |_/___\___/|_| |_| *
8 ***************************************************
9 * This file is part of Horizon (c).
10 *
11 * Copyright (c) 2019 Sagun K. (sagunxp@gmail.com).
12 * Copyright (c) 2019 Horizon Dev Team.
13 *
14 * Base Author - Sagun K. (sagunxp@gmail.com)
15 *
16 * This library is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation, either version 3 of the License, or
19 * (at your option) any later version.
20 *
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this library. If not, see <http://www.gnu.org/licenses/>.
28 **************************************************/
29
30#ifndef HORIZON_SYSTEM_ROUTINES_HPP
31#define HORIZON_SYSTEM_ROUTINES_HPP
32
34#include <boost/lockfree/spsc_queue.hpp>
35#include <optional>
36#include <vector>
37#include <memory>
38#include <map>
39#define BOOST_UUID_FORCE_AUTO_LINK 1
40#include <boost/uuid/uuid.hpp>
41#include <boost/uuid/uuid_io.hpp>
42#include <boost/uuid/random_generator.hpp>
43#include <iostream>
44
45class Server;
46class KernelComponent;
47namespace Horizon
48{
49namespace System
50{
52{
60};
61
63{
71};
72
74{
78};
79
81{
83 RUNTIME_COMMANDLINE = 1, //.we use main because we want the main thread to print console output.
88 RUNTIME_DATABASE = 6, // Database utilizes main thread instead of its own separate thread.
94};
95
97{
102
103class RuntimeContextChain;
104
106{
111
113{
118class SystemRoutineManager;
119
120class RuntimeContext : public std::enable_shared_from_this<RuntimeContext>
121{
122public:
124 : _hsr_manager(hsr_manager), _synchronization_t(sync_t), _uuid(boost::uuids::random_generator()()), _queue_manager(_control_agent)
125 { }
126
128 {
129 public:
130 virtual bool has_result()
131 {
132 return true;
133 }
134 };
135
137 {
138 public:
139 WorkContext() : _uuid(boost::uuids::random_generator()()) { }
140
141 virtual bool execute()
142 {
143 return true;
144 }
145
146 std::string get_uuid_string() { return boost::uuids::to_string(_uuid); }
147
148 boost::uuids::uuid _uuid;
149 };
150
152 {
153 public:
154 bool start()
155 {
157
159 return false;
160
162 return true;
163 }
164
165 bool stop()
166 {
169
170 if (status == RUNTIME_WORK_QUEUE_FAILED || status == RUNTIME_WORK_QUEUE_COMPLETED || status == stop)
171 return false;
172
173 _status.store(stop);
174
175 return true;
176 }
177
178 bool pause()
179 {
181
183 return false;
184
186 return true;
187 }
188
189 bool cancel()
190 {
192
193 if (status == RUNTIME_WORK_QUEUE_CANCELLED)
194 return false;
195
197 return true;
198 }
199
201 {
203
204 if (status == RUNTIME_WORK_QUEUE_COMPLETED)
205 return false;
206
208 return true;
209 }
210
211 bool failed()
212 {
214
215 if (status == RUNTIME_WORK_QUEUE_FAILED)
216 return false;
217
219 return true;
220 }
221
223
224 std::atomic<enum runtime_work_queue_status> _status{RUNTIME_WORK_QUEUE_NOT_STARTED};
225 };
226
228 {
229 public:
230 WorkQueueManager(WorkControlAgent &control_agent) : _control_agent(control_agent) { }
231
232 void push(std::shared_ptr<WorkContext> seg) { _queue.push(std::move(seg)); }
233 std::shared_ptr<WorkContext> pop()
234 {
235 if (_queue.empty())
236 return nullptr;
237
238 std::shared_ptr<WorkContext> ret;
239 _queue.pop(ret);
240 return ret;
241 }
242
243 bool process()
244 {
245 std::shared_ptr<WorkContext> context = nullptr;
246
247 //_control_agent.start();
248
249 bool failed = false;
250
251 while((context = pop()) != nullptr) {
253 if (!_paused)
254 _paused = true;
255 }
256
257 if (_paused == true)
258 _paused = false;
259
261 return false;
262 }
263
264 // break on execution failure.
265 if (context->execute() == false) {
266 failed = true;
267 break;
268 }
269
270 }
271
272 _queue.reset();
273
274 if (failed == true) {
276 return false;
277 }
278
280
281 return true;
282 }
283
284 bool is_paused() { return _paused; }
286 boost::lockfree::spsc_queue<std::shared_ptr<WorkContext>, boost::lockfree::capacity<100>> _queue;
287 std::atomic<bool> _paused{false};
288 };
289
290 std::shared_ptr<WorkContext> pop() { return _queue_manager.pop(); }
291 void push(std::shared_ptr<WorkContext> context) { _queue_manager.push(context); }
292
293 virtual bool run()
294 {
296
297 if (_queue_manager.process()) {
299 return true;
300 }
301
303 return false;
304 }
305
308
310
311 std::string get_uuid_string() { return boost::uuids::to_string(_uuid); }
312
314 {
315 _result = pass;
316 }
318
320 {
321 _context_state_t = state;
322 }
324
327
328 void dispatch();
329
330protected:
334 boost::uuids::uuid _uuid;
335 std::atomic<enum runtime_context_result> _result{RUNTIME_CONTEXT_NO_STATE};
337 std::atomic<enum runtime_context_state> _context_state_t{RUNTIME_CONTEXT_STATE_INACTIVE};
338};
339
340template <typename T = int>
342{
343public:
345 ContextWithResult(T result) : _result(result) { }
346 ContextWithResult(std::vector<T> result_vector) : _result_vector(result_vector) { }
347
349 {
350 _result = other._result;
352 }
353
355 {
356 if (this != &other) {
357 _result = other._result;
359 }
360 return *this;
361 }
362 virtual T get_one() { return _result; }
363 virtual void set_one(T result) { _result = result; }
364
365 virtual bool has_many() { return _result_vector.size() > 0; }
366 virtual std::vector<T> get_many() { return _result_vector; }
367 virtual void set_many(std::vector<T> result_vector) { _result_vector = result_vector; }
368
369protected:
371 std::vector<T> _result_vector;
372};
373
374// @TODO derive from base class that is used to pass result on line 425,
375// - pass it so we can withdraw the result for the use result in the next context of the chain.
376// - similar to how Work derives from WorkContext
377template <typename PayloadType>
378class Result : public RuntimeContext::ResultContext, public ContextWithResult<PayloadType>
379{
380public:
381 Result() { }
382 Result(PayloadType payload)
383 : ContextWithResult<PayloadType>(payload) { }
384 Result(std::vector<PayloadType> payload_vector)
385 : ContextWithResult<PayloadType>(payload_vector) { }
386};
387
389{
390public:
392 RuntimeRoutineContext(std::shared_ptr<KernelComponent> component, runtime_synchronization_method sync_t = RUNTIME_SYNC_NONE);
394
395 void status_message(std::string message) { HLog(info) << "{s:" << get_uuid_string() << "}" << message; }
396 void warning_message(std::string message) { HLog(warning) << "{s:" << get_uuid_string() << "}" << message; }
397 void error_message(std::string message) { HLog(error) << "{s:" << get_uuid_string() << "}" << message; }
398
399 class Work : public RuntimeContext::WorkContext, public std::enable_shared_from_this<Work>
400 {
401 public:
402 Work(std::shared_ptr<RuntimeRoutineContext> runtime_context)
403 : _runtime_context(runtime_context), _message_agent(runtime_context, this) { }
404 ~Work() { }
405
406 virtual bool execute()
407 {
408 std::cerr << "Nothing to execute." << std::endl;
409 return true;
410 }
411
412 std::shared_ptr<RuntimeRoutineContext> get_runtime_context() { return !_runtime_context.expired() ? _runtime_context.lock() : nullptr; }
413 void set_runtime_context(std::shared_ptr<RuntimeRoutineContext> runtime_context) { _runtime_context = runtime_context; }
414
415 protected:
417 {
418 public:
419 MessageAgent(std::shared_ptr<RuntimeRoutineContext> runtime_context, Work *work)
420 : _runtime_context(runtime_context), _work(work) { }
422
423 std::shared_ptr<RuntimeRoutineContext> get_runtime_context() { return !_runtime_context.expired() ? _runtime_context.lock() : nullptr; }
424
425 void set_status_message(std::string message) {
426 _status_message = message;
427 if (_status_message.size() > 0)
428 get_runtime_context()->status_message("{w:" + _work->get_uuid_string() + "}: " + _status_message);
429 }
430 std::string get_status_message() {return _status_message; }
431
432 void set_warning_message(std::string message) {
433 _warning_message = message;
434 if (_warning_message.size() > 0)
435 get_runtime_context()->warning_message("{w:" + _work->get_uuid_string() + "}: " + _warning_message);
436 }
437 std::string get_warning_message() { return _warning_message; }
438
439 void set_error_message(std::string message) {
440 _error_message = message;
441 if (_error_message.size() > 0)
442 get_runtime_context()->error_message("{w:" + _work->get_uuid_string() + "}: " + _error_message);
443 }
444 std::string get_error_message() { return _error_message; }
445
446 protected:
447 std::string _status_message{""};
448 std::string _warning_message{""};
449 std::string _error_message{""};
450 std::weak_ptr<RuntimeRoutineContext> _runtime_context;
452 };
453
454 public:
456 protected:
457 std::weak_ptr<RuntimeRoutineContext> _runtime_context;
459 };
460
462
463 std::vector<std::string> _status_messages;
464 std::vector<std::string> _warning_messages;
465 std::vector<std::string> _error_messages;
466
468};
469
470class RuntimeContextChain : public std::enable_shared_from_this<RuntimeContextChain>
471{
472public:
474 : _module_t(run_module), _uuid(boost::uuids::random_generator()()), _queue_manager(_control_agent, this)
475 { }
476
478 {
479 public:
480 bool start()
481 {
483
485 return false;
486
488 return true;
489 }
490
491 bool stop()
492 {
495
496 if (status == RUNTIME_ROUTINE_CHAIN_FAILED || status == RUNTIME_ROUTINE_CHAIN_COMPLETED || status == stop)
497 return false;
498
499 _status.store(stop);
500
501 return true;
502 }
503
504 bool pause()
505 {
507
509 return false;
510
512 return true;
513 }
514
515 bool cancel()
516 {
518
520 return false;
521
523 return true;
524 }
525
527 {
529
531 return false;
532
534 return true;
535 }
536
537 bool failed()
538 {
540
541 if (status == RUNTIME_ROUTINE_CHAIN_FAILED)
542 return false;
543
545 return true;
546 }
547
549
550 std::atomic<enum runtime_routine_chain_status> _status{RUNTIME_ROUTINE_CHAIN_NOT_STARTED};
551 };
552
554 {
555 public:
556 ContextQueueManager(ContextControlAgent &control_agent, RuntimeContextChain *chain) : _control_agent(control_agent), _chain(chain) { }
557
558 virtual void push(std::shared_ptr<RuntimeContext> seg) { _queue.push(std::move(seg)); }
559 virtual std::shared_ptr<RuntimeContext> pop()
560 {
561 if (_queue.empty())
562 return nullptr;
563
564 std::shared_ptr<RuntimeContext> ret;
565 _queue.pop(ret);
566 return ret;
567 }
568
569 virtual bool process();
570
571 virtual bool is_paused() { return _paused; }
572
575 boost::lockfree::spsc_queue<std::shared_ptr<RuntimeContext>, boost::lockfree::capacity<100>> _queue;
576 std::atomic<bool> _paused{false};
577 };
578
579 std::shared_ptr<RuntimeContext> pop() { return _queue_manager.pop(); }
580 void push(std::shared_ptr<RuntimeContext> context) { _queue_manager.push(context); }
581 bool process() { return _queue_manager.process(); }
582
585
588
590 void set_module_type(runtime_module_type module_t) { _module_t = module_t; }
591
592 std::string get_uuid_string() { return boost::uuids::to_string(_uuid); }
593
594private:
595 boost::uuids::uuid _uuid;
597};
598
600{
602 {
605 std::shared_ptr<RuntimeContext> context;
606 std::shared_ptr<RuntimeContextChain> context_chain;
607 };
608
609 typedef std::map<std::string, runtime_map_data> runtime_map;
610public:
612 : _module_type(module_type)
613 {
614 if (_module_type < RUNTIME_MAIN || _module_type >= Horizon::System::RUNTIME_MODULE_MAX) {
615 std::cerr << "SystemRoutineManager for module type (" << module_type << ") failed to start. Invalid module type." << std::endl;
616 }
617 }
618
619 virtual void register_(runtime_module_type module_t, runtime_synchronization_method sync_t, std::shared_ptr<RuntimeContext> context)
620 {
621 runtime_map_data data = { module_t, sync_t, context, nullptr };
622 _runtime_map.emplace(context->get_uuid_string(), data);
623 }
624
625 virtual void register_(runtime_module_type module_t, runtime_synchronization_method sync_t, std::shared_ptr<RuntimeContextChain> context_chain)
626 {
627 runtime_map_data data = { module_t, sync_t, nullptr, context_chain };
628 _runtime_map.emplace(context_chain->get_uuid_string(), data);
629 }
630
631 virtual std::shared_ptr<const runtime_map_data> find_runtime(std::string name)
632 {
633 auto it = _runtime_map.find(name);
634 return (it != _runtime_map.end()) ? std::make_shared<const runtime_map_data>(it->second) : nullptr;
635 }
636
638 {
639 return _runtime_map.size();
640 }
641
643
644 void push(std::shared_ptr<RuntimeContextChain> chain) {
645 register_(chain->get_module_type(), RUNTIME_SYNC_NONE, chain);
646 _system_queue_chain.push(std::move(chain));
647 }
648 void push(std::shared_ptr<RuntimeContext> seg) {
649 register_(get_module_type(), seg->get_synchronization_method(), seg);
650 _system_queue.push(std::move(seg));
651 }
652
653 std::shared_ptr<RuntimeContext> pop()
654 {
655 if (_system_queue.empty())
656 return nullptr;
657
658 std::shared_ptr<RuntimeContext> ret;
659 _system_queue.pop(ret);
660 return ret;
661 }
662
663 std::shared_ptr<RuntimeContextChain> pop_chain()
664 {
665 if (_system_queue_chain.empty())
666 return nullptr;
667
668 std::shared_ptr<RuntimeContextChain> ret;
669 _system_queue_chain.pop(ret);
670 return ret;
671 }
672
673 // Processes routine queue on every component and executes routine when available.
674 // Call will be executed when the routine is within the system queue and has been popped out.
675 // After addressing singlular system routines, it will execute the chain of routines. Both cannot happen together.
677 {
678 while(_system_queue.empty() == false) {
679 std::shared_ptr<RuntimeContext> context = pop();
680 if (context != nullptr)
681 context->run();
682 }
683
684 while(_system_queue_chain.empty() == false) {
685 std::shared_ptr<RuntimeContextChain> routine_chain = pop_chain();
686 if (routine_chain != nullptr)
687 routine_chain->get_queue_manager().process();
688 }
689 _system_queue.reset();
690 _system_queue_chain.reset();
691 }
692
693 boost::lockfree::spsc_queue<std::shared_ptr<RuntimeContext>, boost::lockfree::capacity<100>> _system_queue;
694 boost::lockfree::spsc_queue<std::shared_ptr<RuntimeContextChain>, boost::lockfree::capacity<100>> _system_queue_chain;
695
696private:
699};
700}
701}
702
703#endif /* HORIZON_SYSTEM_ROUTINES_HPP */
#define HLog(type)
Definition: Logger.hpp:122
Definition: System.hpp:342
virtual bool has_many()
Definition: System.hpp:365
T _result
Definition: System.hpp:370
virtual std::vector< T > get_many()
Definition: System.hpp:366
virtual void set_many(std::vector< T > result_vector)
Definition: System.hpp:367
ContextWithResult()
Definition: System.hpp:344
ContextWithResult & operator=(const ContextWithResult &other)
Definition: System.hpp:354
std::vector< T > _result_vector
Definition: System.hpp:371
ContextWithResult(std::vector< T > result_vector)
Definition: System.hpp:346
virtual T get_one()
Definition: System.hpp:362
virtual void set_one(T result)
Definition: System.hpp:363
ContextWithResult(T result)
Definition: System.hpp:345
ContextWithResult(const ContextWithResult &other)
Definition: System.hpp:348
Definition: System.hpp:379
Result(std::vector< PayloadType > payload_vector)
Definition: System.hpp:384
Result()
Definition: System.hpp:381
Result(PayloadType payload)
Definition: System.hpp:382
std::atomic< enum runtime_routine_chain_status > _status
Definition: System.hpp:550
runtime_routine_chain_status get_status()
Definition: System.hpp:548
RuntimeContextChain * _chain
Definition: System.hpp:574
ContextControlAgent & _control_agent
Definition: System.hpp:573
virtual std::shared_ptr< RuntimeContext > pop()
Definition: System.hpp:559
boost::lockfree::spsc_queue< std::shared_ptr< RuntimeContext >, boost::lockfree::capacity< 100 > > _queue
Definition: System.hpp:575
virtual void push(std::shared_ptr< RuntimeContext > seg)
Definition: System.hpp:558
ContextQueueManager(ContextControlAgent &control_agent, RuntimeContextChain *chain)
Definition: System.hpp:556
std::atomic< bool > _paused
Definition: System.hpp:576
virtual bool is_paused()
Definition: System.hpp:571
virtual bool process()
Definition: System.cpp:50
Definition: System.hpp:471
bool process()
Definition: System.hpp:581
runtime_module_type _module_t
Definition: System.hpp:596
ContextQueueManager & get_queue_manager()
Definition: System.hpp:583
ContextQueueManager _queue_manager
Definition: System.hpp:586
void push(std::shared_ptr< RuntimeContext > context)
Definition: System.hpp:580
ContextControlAgent & get_control_agent()
Definition: System.hpp:584
ContextControlAgent _control_agent
Definition: System.hpp:587
runtime_module_type get_module_type()
Definition: System.hpp:589
RuntimeContextChain(runtime_module_type run_module)
Definition: System.hpp:473
std::shared_ptr< RuntimeContext > pop()
Definition: System.hpp:579
std::string get_uuid_string()
Definition: System.hpp:592
boost::uuids::uuid _uuid
Definition: System.hpp:595
void set_module_type(runtime_module_type module_t)
Definition: System.hpp:590
virtual bool has_result()
Definition: System.hpp:130
WorkContext()
Definition: System.hpp:139
boost::uuids::uuid _uuid
Definition: System.hpp:148
std::string get_uuid_string()
Definition: System.hpp:146
virtual bool execute()
Definition: System.hpp:141
bool pause()
Definition: System.hpp:178
runtime_work_queue_status get_status()
Definition: System.hpp:222
bool failed()
Definition: System.hpp:211
bool cancel()
Definition: System.hpp:189
bool start()
Definition: System.hpp:154
bool stop()
Definition: System.hpp:165
bool completed()
Definition: System.hpp:200
std::atomic< enum runtime_work_queue_status > _status
Definition: System.hpp:224
std::shared_ptr< WorkContext > pop()
Definition: System.hpp:233
WorkQueueManager(WorkControlAgent &control_agent)
Definition: System.hpp:230
bool process()
Definition: System.hpp:243
WorkControlAgent & _control_agent
Definition: System.hpp:285
bool is_paused()
Definition: System.hpp:284
std::atomic< bool > _paused
Definition: System.hpp:287
void push(std::shared_ptr< WorkContext > seg)
Definition: System.hpp:232
boost::lockfree::spsc_queue< std::shared_ptr< WorkContext >, boost::lockfree::capacity< 100 > > _queue
Definition: System.hpp:286
Definition: System.hpp:121
void set_context_state(runtime_context_state state=RUNTIME_CONTEXT_STATE_INACTIVE)
Definition: System.hpp:319
WorkControlAgent & get_control_agent()
Definition: System.hpp:307
std::string get_uuid_string()
Definition: System.hpp:311
runtime_synchronization_method get_synchronization_method()
Definition: System.hpp:326
runtime_synchronization_method _synchronization_t
Definition: System.hpp:336
void dispatch()
Definition: System.cpp:48
void push(std::shared_ptr< WorkContext > context)
Definition: System.hpp:291
RuntimeContext(SystemRoutineManager &hsr_manager, runtime_synchronization_method sync_t=RUNTIME_SYNC_NONE)
Definition: System.hpp:123
SystemRoutineManager & get_routine_manager()
Definition: System.hpp:309
SystemRoutineManager & _hsr_manager
Definition: System.hpp:331
WorkControlAgent _control_agent
Definition: System.hpp:332
runtime_context_result get_context_result()
Definition: System.hpp:317
virtual bool run()
Definition: System.hpp:293
void set_context_result(runtime_context_result pass=RUNTIME_CONTEXT_NO_STATE)
Definition: System.hpp:313
WorkQueueManager _queue_manager
Definition: System.hpp:333
std::atomic< enum runtime_context_state > _context_state_t
Definition: System.hpp:337
void set_synchronization_method(runtime_synchronization_method sync)
Definition: System.hpp:325
WorkQueueManager & get_queue_manager()
Definition: System.hpp:306
runtime_context_state get_context_state()
Definition: System.hpp:323
boost::uuids::uuid _uuid
Definition: System.hpp:334
std::atomic< enum runtime_context_result > _result
Definition: System.hpp:335
std::shared_ptr< WorkContext > pop()
Definition: System.hpp:290
std::string _error_message
Definition: System.hpp:449
std::string get_status_message()
Definition: System.hpp:430
std::string _warning_message
Definition: System.hpp:448
MessageAgent(std::shared_ptr< RuntimeRoutineContext > runtime_context, Work *work)
Definition: System.hpp:419
std::shared_ptr< RuntimeRoutineContext > get_runtime_context()
Definition: System.hpp:423
void set_error_message(std::string message)
Definition: System.hpp:439
std::weak_ptr< RuntimeRoutineContext > _runtime_context
Definition: System.hpp:450
void set_status_message(std::string message)
Definition: System.hpp:425
std::string _status_message
Definition: System.hpp:447
void set_warning_message(std::string message)
Definition: System.hpp:432
std::string get_warning_message()
Definition: System.hpp:437
std::string get_error_message()
Definition: System.hpp:444
void set_runtime_context(std::shared_ptr< RuntimeRoutineContext > runtime_context)
Definition: System.hpp:413
MessageAgent & get_message_agent()
Definition: System.hpp:455
virtual bool execute()
Definition: System.hpp:406
MessageAgent _message_agent
Definition: System.hpp:458
std::shared_ptr< RuntimeRoutineContext > get_runtime_context()
Definition: System.hpp:412
std::weak_ptr< RuntimeRoutineContext > _runtime_context
Definition: System.hpp:457
Work(std::shared_ptr< RuntimeRoutineContext > runtime_context)
Definition: System.hpp:402
Definition: System.hpp:389
std::vector< std::string > _warning_messages
Definition: System.hpp:464
std::vector< std::string > _status_messages
Definition: System.hpp:463
void warning_message(std::string message)
Definition: System.hpp:396
void status_message(std::string message)
Definition: System.hpp:395
std::mutex _runtime_synchronization_mutex
Definition: System.hpp:467
std::mutex & get_runtime_synchronization_mutex()
Definition: System.hpp:461
std::vector< std::string > _error_messages
Definition: System.hpp:465
void error_message(std::string message)
Definition: System.hpp:397
RuntimeRoutineContext(Server *s, runtime_synchronization_method sync_t=RUNTIME_SYNC_NONE)
Definition: System.cpp:33
Definition: System.hpp:600
std::map< std::string, runtime_map_data > runtime_map
Definition: System.hpp:609
runtime_map _runtime_map
Definition: System.hpp:697
virtual int get_runtime_routine_count()
Definition: System.hpp:637
void push(std::shared_ptr< RuntimeContext > seg)
Definition: System.hpp:648
runtime_module_type _module_type
Definition: System.hpp:698
runtime_module_type get_module_type()
Definition: System.hpp:642
virtual std::shared_ptr< const runtime_map_data > find_runtime(std::string name)
Definition: System.hpp:631
std::shared_ptr< RuntimeContextChain > pop_chain()
Definition: System.hpp:663
void push(std::shared_ptr< RuntimeContextChain > chain)
Definition: System.hpp:644
SystemRoutineManager(runtime_module_type module_type)
Definition: System.hpp:611
virtual void register_(runtime_module_type module_t, runtime_synchronization_method sync_t, std::shared_ptr< RuntimeContext > context)
Definition: System.hpp:619
void process_queue()
Definition: System.hpp:676
std::shared_ptr< RuntimeContext > pop()
Definition: System.hpp:653
virtual void register_(runtime_module_type module_t, runtime_synchronization_method sync_t, std::shared_ptr< RuntimeContextChain > context_chain)
Definition: System.hpp:625
boost::lockfree::spsc_queue< std::shared_ptr< RuntimeContextChain >, boost::lockfree::capacity< 100 > > _system_queue_chain
Definition: System.hpp:694
boost::lockfree::spsc_queue< std::shared_ptr< RuntimeContext >, boost::lockfree::capacity< 100 > > _system_queue
Definition: System.hpp:693
Definition: Server.hpp:192
Definition: Server.hpp:554
runtime_context_result
Definition: System.hpp:106
@ RUNTIME_CONTEXT_FAIL
Definition: System.hpp:108
@ RUNTIME_CONTEXT_PASS
Definition: System.hpp:109
@ RUNTIME_CONTEXT_NO_STATE
Definition: System.hpp:107
runtime_work_run_result
Definition: System.hpp:74
@ RUNTIME_WORK_RUN_SUCCEEDED
Definition: System.hpp:76
@ RUNTIME_WORK_RUN_BYPASS
Definition: System.hpp:77
@ RUNTIME_WORK_RUN_FAILED
Definition: System.hpp:75
runtime_context_state
Definition: System.hpp:113
@ RUNTIME_CONTEXT_STATE_ACTIVE
Definition: System.hpp:115
@ RUNTIME_CONTEXT_STATE_WAITING
Definition: System.hpp:116
@ RUNTIME_CONTEXT_STATE_INACTIVE
Definition: System.hpp:114
runtime_routine_chain_status
Definition: System.hpp:52
@ RUNTIME_ROUTINE_CHAIN_COMPLETED
Definition: System.hpp:59
@ RUNTIME_ROUTINE_CHAIN_CANCELLED
Definition: System.hpp:58
@ RUNTIME_ROUTINE_CHAIN_NOT_STARTED
Definition: System.hpp:53
@ RUNTIME_ROUTINE_CHAIN_STARTED
Definition: System.hpp:57
@ RUNTIME_ROUTINE_CHAIN_FAILED
Definition: System.hpp:55
@ RUNTIME_ROUTINE_CHAIN_PAUSED
Definition: System.hpp:56
@ RUNTIME_ROUTINE_CHAIN_STOPPED
Definition: System.hpp:54
runtime_work_queue_status
Definition: System.hpp:63
@ RUNTIME_WORK_QUEUE_PAUSED
Definition: System.hpp:67
@ RUNTIME_WORK_QUEUE_STOPPED
Definition: System.hpp:65
@ RUNTIME_WORK_QUEUE_COMPLETED
Definition: System.hpp:70
@ RUNTIME_WORK_QUEUE_NOT_STARTED
Definition: System.hpp:64
@ RUNTIME_WORK_QUEUE_STARTED
Definition: System.hpp:68
@ RUNTIME_WORK_QUEUE_FAILED
Definition: System.hpp:66
@ RUNTIME_WORK_QUEUE_CANCELLED
Definition: System.hpp:69
runtime_module_type
Definition: System.hpp:81
@ RUNTIME_CLIENT_NETWORKING
Definition: System.hpp:89
@ RUNTIME_DATABASE
Definition: System.hpp:88
@ RUNTIME_NETWORKING
Definition: System.hpp:84
@ RUNTIME_WEB_SOCKET
Definition: System.hpp:91
@ RUNTIME_HTTP_SERVICE
Definition: System.hpp:90
@ RUNTIME_MAIN
Definition: System.hpp:82
@ RUNTIME_SCRIPTVM
Definition: System.hpp:87
@ RUNTIME_GAMELOGIC
Definition: System.hpp:86
@ RUNTIME_MODULE_MAX
Definition: System.hpp:93
@ RUNTIME_COMMANDLINE
Definition: System.hpp:83
@ RUNTIME_PERSISTENCE
Definition: System.hpp:85
@ RUNTIME_RUNTIME
Definition: System.hpp:92
runtime_synchronization_method
Definition: System.hpp:97
@ RUNTIME_SYNC_WAIT_CHECK_STATE
Definition: System.hpp:100
@ RUNTIME_SYNC_WAIT_NO_CHECK_STATE
Definition: System.hpp:99
@ RUNTIME_SYNC_NONE
Definition: System.hpp:98
Definition: Element.hpp:7
runtime_synchronization_method sync_t
Definition: System.hpp:604
std::shared_ptr< RuntimeContext > context
Definition: System.hpp:605
runtime_module_type module_t
Definition: System.hpp:603
std::shared_ptr< RuntimeContextChain > context_chain
Definition: System.hpp:606