Permalink
Browse files

renamed tasks -> events

  • Loading branch information...
1 parent 466a4fd commit 28838f4ed7ae3fd5a70c44c92dc2efd1d14e3f5f @kobolog kobolog committed May 13, 2012
Showing with 32 additions and 41 deletions.
  1. +12 −20 README.md
  2. +2 −2 include/cocaine/engine.hpp
  3. +0 −1 include/cocaine/slave.hpp
  4. +18 −18 src/engine.cpp
View
@@ -1,42 +1,34 @@
What the hell is it?
====================
-__Your personal App Engine.__
-
-Like GAE?
-=========
-
-Sort of. Cocaine is a fast and lightweight multi-language (you can easily write your own language binding) event-driven (also, you can easily write your own event drivers) task-based distributed application engine. Actually, it's better.
+__Your personal app engine.__ Technically speaking, it's an open-source cloud platform enabling you to build your own PaaS clouds using simple yet effective dynamic components.
Notable features:
-* Apps are defined as a set of tasks, which trigger events in the app engine, which are then processed on a slave pool. Tasks can be servers, time-based jobs, filesystem monitors, etc.
-* Dynamic self-managing slave pools for each app with a rich but simple configuration to scale with the application needs.
-* Data streaming and pipelining.
-* Automatic node discovery and smart peer-to-peer balancing. Note that ZeroMQ already offers built-in fair balancing features which you can use, although they do not consider real node load.
-* Optional resource control via Linux cgroups.
-* Optional secure communications using RSA encryption.
-* Simple modular design to add new languages, task types, storages and slave backends easily.
+* You are not restricted by a language or a framework. Language support is plugin-based, and we already support several common languages, so your needs are probably covered. Of course, if you want to write your apps in Whitespace, you'll need to write the language support plugin first, but it's easier to write the actual Whitespace code, we bet.
+* Your apps are driven by events, which is fancy. In order for events to actually appear from somewhere, your app defines a set of event drivers. We got lots of predefined event drivers, so unless you need to handle clients via a PS/2 port, you're good.
+* We got dynamic self-managing slave pools for each app with a rich but simple configuration and resource usage control to scale with the application needs. Yeah, it's scales automatically, you don't need to think about it.
+* Even more, it scales automatically across your server cluser via automatic node discovery and smart peer-to-peer balancing.
+* If your startup idea is about processing terabytes of pirated video, we got data streaming and pipelining for you, enjoy.
-At the moment, Cocaine supports the following languages and specifications:
+At the moment, Cocaine Core supports the following languages and specifications:
* C++
* Python
-* [In Development] Perl
+* Perl
* [In Development] JavaScript
-The application tasks can be driven by any of the following drivers:
+Also, we have the following event drivers built-in:
* Recurring Timer (multiple jobs can be run if they are not finished in the timer intervals)
* Drifting Timer (only one job can be run, hence the drift)
* [In Development] Cron
* [In Development] Manual Scheduler
* Filesystem Monitor
* ZeroMQ Server (Request-Response)
-* [In Development] ZeroMQ Subscriber (Publishing Chain)
* Native Server (Request-Response + Smart Balancing)
-* ZeroMQ Sink (Request-Publish)
-* [Planned] Native Sink (Request-Publish)
+* ZeroMQ Sink (Push-Pull)
+* Native Sink (Push-Pull + Smart Balancing)
* [In Development] Raw Socket Server
A motivating example
@@ -75,7 +67,7 @@ A motivating example
}
```
-The JSON above is an application manifest, a description of the application you feed into Cocaine for it to be able to host it. In a distributed setup, this manifest will be sent to all the other nodes of the cluster automatically. Apart from this manifest, there is __no other configuration needed to start serving the application__.
+The JSON above is an application manifest, a description of the application you feed into Cocaine Core for it to be able to host it. In a distributed setup, this manifest will be sent to all the other nodes of the cluster automatically. Apart from this manifest, there is __no other configuration needed to start serving the application__.
Okay, I want to try it!
=======================
@@ -40,7 +40,7 @@ typedef boost::ptr_map<
#endif
const std::string,
drivers::driver_t
-> task_map_t;
+> driver_map_t;
#if BOOST_VERSION >= 104000
typedef boost::ptr_unordered_map<
@@ -193,7 +193,7 @@ class engine_t:
// The application.
const app_t m_app;
- task_map_t m_tasks;
+ driver_map_t m_drivers;
// Job queue.
job_queue_t m_queue;
@@ -108,7 +108,6 @@ struct alive:
public:
const std::auto_ptr<job_t>& job() const {
- BOOST_ASSERT(m_job.get());
return m_job;
}
View
@@ -177,43 +177,43 @@ void engine_t::start() {
m_gc_timer.set<engine_t, &engine_t::cleanup>(this);
m_gc_timer.start(5.0f, 5.0f);
- // Tasks configuration
+ // Event configuration
// -------------------
- Json::Value tasks(m_app.manifest["tasks"]);
+ Json::Value events(m_app.manifest["tasks"]);
- if(!tasks.isNull() && tasks.size()) {
- Json::Value::Members names(tasks.getMemberNames());
+ if(!events.isNull() && events.size()) {
+ Json::Value::Members names(events.getMemberNames());
m_app.log->info(
"initializing drivers for %zu %s: %s",
- tasks.size(),
- tasks.size() == 1 ? "task" : "tasks",
+ events.size(),
+ events.size() == 1 ? "events" : "events",
boost::algorithm::join(names, ", ").c_str()
);
for(Json::Value::Members::iterator it = names.begin(); it != names.end(); ++it) {
- std::string task(*it);
- std::string type(tasks[task]["type"].asString());
+ std::string event(*it);
+ std::string type(events[event]["type"].asString());
if(type == "recurring-timer") {
- m_tasks.insert(task, new drivers::recurring_timer_t(*this, task, tasks[task]));
+ m_drivers.insert(event, new drivers::recurring_timer_t(*this, event, events[event]));
} else if(type == "drifting-timer") {
- m_tasks.insert(task, new drivers::drifting_timer_t(*this, task, tasks[task]));
+ m_drivers.insert(event, new drivers::drifting_timer_t(*this, event, events[event]));
} else if(type == "filesystem-monitor") {
- m_tasks.insert(task, new drivers::filesystem_monitor_t(*this, task, tasks[task]));
+ m_drivers.insert(event, new drivers::filesystem_monitor_t(*this, event, events[event]));
} else if(type == "zeromq-server") {
- m_tasks.insert(task, new drivers::zeromq_server_t(*this, task, tasks[task]));
+ m_drivers.insert(event, new drivers::zeromq_server_t(*this, event, events[event]));
} else if(type == "zeromq-sink") {
- m_tasks.insert(task, new drivers::zeromq_sink_t(*this, task, tasks[task]));
+ m_drivers.insert(event, new drivers::zeromq_sink_t(*this, event, events[event]));
} else if(type == "server+lsd" || type == "native-server") {
- m_tasks.insert(task, new drivers::native_server_t(*this, task, tasks[task]));
+ m_drivers.insert(event, new drivers::native_server_t(*this, event, events[event]));
} else {
throw configuration_error_t("no driver for '" + type + "' is available");
}
}
} else {
- throw configuration_error_t("no tasks has been specified");
+ throw configuration_error_t("no events has been specified");
}
m_running = true;
@@ -268,7 +268,7 @@ void engine_t::stop(std::string status) {
std::for_each(m_pool.begin(), m_pool.end(), terminate());
m_pool.clear();
- m_tasks.clear();
+ m_drivers.clear();
m_watcher.stop();
m_processor.stop();
@@ -291,8 +291,8 @@ Json::Value engine_t::info() {
)
);
- for(task_map_t::iterator it = m_tasks.begin();
- it != m_tasks.end();
+ for(driver_map_t::iterator it = m_drivers.begin();
+ it != m_drivers.end();
++it)
{
results["tasks"][it->first] = it->second->info();

0 comments on commit 28838f4

Please sign in to comment.