ReCodEx - Task Broker
ReCodEx is complex programmer testing solution, primary targeted to technical universities. It's highly customizable and based on modern technologies.
|
#include <worker_registry.h>
Public Types | |
typedef std::shared_ptr< worker > | worker_ptr |
Public Member Functions | |
worker_registry () | |
virtual void | add_worker (worker_ptr worker) |
virtual void | remove_worker (worker_ptr worker) |
virtual worker_ptr | find_worker (const request::headers_t &headers) |
virtual worker_ptr | find_worker_by_identity (const std::string &identity) |
virtual void | deprioritize_worker (worker_ptr worker) |
virtual const std::vector< worker_ptr > & | get_workers () const |
Service that stores information about worker machines and routes tasks to them.
Definition at line 14 of file worker_registry.h.
typedef std::shared_ptr<worker> worker_registry::worker_ptr |
Pointer to worker instance type.
Definition at line 18 of file worker_registry.h.
worker_registry::worker_registry | ( | ) |
Default constructor, initializes empty list of workers.
Definition at line 6 of file worker_registry.cpp.
|
virtual |
Adds new worker to the registry.
worker | Worker instance to be added. |
Definition at line 10 of file worker_registry.cpp.
|
virtual |
Reduce the priority of a worker so that it's less likely to be found by subsequent finds. Now it means change order in worker queue to the last position, so most of the finds will succeed earlier.
worker | Instance of worker whose priority will be lowered. |
Definition at line 55 of file worker_registry.cpp.
|
virtual |
Find suitable worker on the basis of request headers.
headers | Reqeust headers which we want to be fulfiled by any worker. |
Definition at line 24 of file worker_registry.cpp.
|
virtual |
Find worker by it's unique identifier.
identity | ID of worker we want to get instance. |
Definition at line 44 of file worker_registry.cpp.
|
virtual |
Get all workers known to this service.
Definition at line 65 of file worker_registry.cpp.
|
virtual |
Remove worker from registry, for example when connection is lost.
worker | Worker instance to be removed. |
Definition at line 15 of file worker_registry.cpp.