RAPP Platform API
 All Classes Namespaces Files Functions Variables Typedefs
service_controller.cpp
Go to the documentation of this file.
1 #include "service_controller.hpp"
2 namespace rapp {
3 namespace cloud {
4 
6 : query_(address, port), io_(), resol_(io_)
7 {}
8 
9 void service_controller::run_job(const std::shared_ptr<asio_socket> job)
10 {
11  assert(job);
12  job->schedule(query_, resol_, io_);
13  // will block until this job is complete
14  // then we reset the work queue
15  io_.run();
16  io_.reset();
17 }
18 
19 void service_controller::run_jobs(const std::vector<std::shared_ptr<asio_socket>> & jobs)
20 {
21  //boost::asio::io_service io;
22  //boost::asio::ip::tcp::resolver resol(io);
23  for (const std::shared_ptr<asio_socket> & job : jobs) {
24  assert(job);
25  job->schedule(query_, resol_, io_);
26  }
27  // will block until all jobs posted are complete
28  // then we reset the work queue
29  io_.run();
30  io_.reset();
31 }
32 
34 {
35  io_.stop();
36 }
37 
38 }
39 }
void run_jobs(const std::vector< std::shared_ptr< asio_socket >> &jobs)
Run a group of jobs in a batch.
constexpr char port[]
api.rapp.cloud - HOP server port
Definition: asio_socket.hpp:10
boost::asio::ip::tcp::resolver::query query_
resolution, query and io service
service_controller()
no empty constructor
void run_job(const std::shared_ptr< asio_socket > job)
Run one service job.
void stop()
stop the service controller
boost::asio::ip::tcp::resolver resol_
constexpr char address[]
api.rapp.cloud -
Definition: asio_socket.hpp:8