cocaine / cocaine-framework-native Goto Github PK
View Code? Open in Web Editor NEWCocaine Native Framework
License: GNU Lesser General Public License v3.0
Cocaine Native Framework
License: GNU Lesser General Public License v3.0
Following error happens during build of v0.11 brunch.
In file included from /home/art/Development/cocaine-framework-native/include/cocaine/framework/service_client/connection.hpp:9:0,
from /home/art/Development/cocaine-framework-native/include/cocaine/framework/service_client/service.hpp:4,
from /home/art/Development/cocaine-framework-native/include/cocaine/framework/service_client/manager.hpp:4,
from /home/art/Development/cocaine-framework-native/include/cocaine/framework/service.hpp:4,
from /home/art/Development/cocaine-framework-native/src/service_client/connection.cpp:1:
/home/art/builds/include/cocaine/rpc/channel.hpp: In instantiation of ‘cocaine::io::channel< <template-parameter-1-1> >& cocaine::io::channel< <template-parameter-1-1> >::operator=(cocaine::io::channel< <template-parameter-1-1> >&&) [with Socket = cocaine::io::socket<cocaine::io::tcp>; cocaine::io::channel< <template-parameter-1-1> > = cocaine::io::channel<cocaine::io::socket<cocaine::io::tcp> >]’:
/home/art/Development/cocaine-framework-native/src/service_client/connection.cpp:84:33: required from here
/home/art/builds/include/cocaine/rpc/channel.hpp:57:9: error: no match for ‘operator=’ in ‘((cocaine::io::channel<cocaine::io::socket<cocaine::io::tcp> >*)this)->cocaine::io::channel<cocaine::io::socket<cocaine::io::tcp> >::rd = std::move<const std::unique_ptr<cocaine::io::decoder<cocaine::io::readable_stream<cocaine::io::socket<cocaine::io::tcp> > >, std::default_delete<cocaine::io::decoder<cocaine::io::readable_stream<cocaine::io::socket<cocaine::io::tcp> > > > >&>((* & other.cocaine::io::channel<cocaine::io::socket<cocaine::io::tcp> >::rd))’
...
(and so on and on for several pages)
This error is triggered by an assignment in 'connection.cpp' line 84. It seams that something wrong with copy assignment in 'iochannel_t' class.
I've built a worker based on examples/main.cpp and a client based on examples/service_client.cpp. When sent, messages are packed automatically, but I have to unpack them manually.
Worker:
#include<cocaine/framework/dispatch.hpp>
class App1
{
std::shared_ptr<cocaine::framework::logger_t>m_log;
public:
App1(cocaine::framework::dispatch_t&d)
{
m_log=d.service_manager()->get_system_logger();
d.on("event2",this,&App1::on_event2);
COCAINE_LOG_WARNING(m_log,"test log");
}
void on_event2(const std::string&event,const std::vector<std::string>&request,cocaine::framework::response_ptr response)
{
for(auto it=request.begin();it!=request.end();++it)
{
COCAINE_LOG_WARNING(m_log,"PACKED REQUEST: "+*it);
msgpack::sbuffer sbuf(it->size());
sbuf.write(it->c_str(),it->size());
msgpack::unpacked msg;
msgpack::unpack(&msg,sbuf.data(),sbuf.size());
msgpack::object obj=msg.get();
std::string reqSTRING;
obj.convert(&reqSTRING);
response->write(reqSTRING);
}
}
};
int main(int argc,char*argv[])
{
return cocaine::framework::run<App1>(argc,argv);
}
Client:
#include<cocaine/framework/services/app.hpp>
#include<iostream>
int main(int argc,char*argv[])
{
auto manager=cocaine::framework::service_manager_t::create(cocaine::framework::service_manager_t::endpoint_t("127.0.0.1",10053));
auto app=manager->get_service<cocaine::framework::app_service_t>("cocproj");
auto g=app->enqueue("event2","REQUEST");//get generator
std::string resSTR=g.next();//or synchronously get next chunk
std::cout<<"----PACKED RESPONSE: "<<resSTR<<std::endl;
std::cout<<"char\thex"<<std::endl<<std::hex;
for(int i=0;i<resSTR.size();++i)
std::cout<<resSTR[i]<<"\t0x"<<std::hex<<((int)resSTR[i]&0xff)<<std::endl;
std::cout<<std::endl;
msgpack::sbuffer sbuf(resSTR.size());
sbuf.write(resSTR.c_str(),resSTR.size());
//Deserialize the serialized data.
msgpack::unpacked msg;//includes memory pool and deserialized object
msgpack::unpack(&msg,sbuf.data(),sbuf.size());
msgpack::object obj=msg.get();
//Print the deserialized object to stdout.
std::cout<<"OBJECT: "<<obj<<std::endl;
//Convert the deserialized object to staticaly typed object.
std::string result;
obj.convert(&result);
std::cout<<"CONVERTED STRING: "<<result<<std::endl;
return 0;
}
Execution result:
----PACKED RESPONSE: ?REQUEST char hex ? 0xa7 R 0x52 E 0x45 Q 0x51 U 0x55 E 0x45 S 0x53 T 0x54 OBJECT: "REQUEST" CONVERTED STRING: REQUEST
Here 0xa7 is msgpack starter byte for 7 byte string (according to https://github.com/msgpack/msgpack/blob/master/spec.md).
I want to receive several chunks synchronously. I wrote this code (simplified):
auto g=stor_app->enqueue("process_request",ol_rq);
while(!g.closed())
{
COCAINE_LOG_INFO(m_log,"---------------------Entered loop-------");
std::string packed=g.next();
COCAINE_LOG_INFO(m_log,"---------------------Got packed-------");
}
According to the log, I successfully receive all 3 chunks sent to me, then enter the loop again (the 4th time) and an exception with text "The stream is closed" pops up at g.next().
Here the sample https://github.com/cocaine/cocaine-framework-native/blob/master/example/echo/main.cpp
I have a postgresql connection (libpq) created in lamda expression, so i can use it without problem, but when i try to create connetion out of lambda and pass it through lambda won't start at all.
So, will this lamda expression called in the same thread in which created? May it be the problem?
Hi!
I've got cocaine-core successfully installed, but native framework doesn't compile.
Here is the log:
➜ build git:(v0.11) cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
-- The C compiler identification is Clang 5.1.0
-- The CXX compiler identification is Clang 5.1.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.55.0
-- Found the following Boost libraries:
-- program_options
-- Found libev: /usr/local/lib/libev.dylib
-- Found libmsgpack: /usr/local/lib/libmsgpack.dylib
-- Found libcocaine: /usr/local/lib/libcocaine-core.dylib
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/ikorolev/repos/cocaine-framework-native/build
➜ build git:(v0.11) make
Scanning dependencies of target cocaine-framework
[ 14%] Building CXX object CMakeFiles/cocaine-framework.dir/src/service_client/service.cpp.o
In file included from /Users/ikorolev/repos/cocaine-framework-native/src/service_client/service.cpp:21:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service_client/manager.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service_client/service.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service_client/connection.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service_client/session.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service_client/handler.hpp:24:
/Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service_client/error.hpp:56:31: error: implicit instantiation of undefined template
'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
std::runtime_error(ec.message()),
^
/Library/Developer/CommandLineTools/usr/bin/../lib/c++/v1/iosfwd:188:33: note: template is declared here
class _LIBCPP_TYPE_VIS_ONLY basic_string;
^
In file included from /Users/ikorolev/repos/cocaine-framework-native/src/service_client/service.cpp:21:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service_client/manager.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service_client/service.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service_client/connection.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service_client/session.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service_client/handler.hpp:25:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/generator.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/generator/generator.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/generator/generator_detail.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/generator/shared_state.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/generator/traits.hpp:25:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/future.hpp:28:
/Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/future/utility.hpp:112:24: error: unused parameter 'f' [-Werror,-Wunused-parameter]
make_ready(Future& f) {
^
/Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/future/utility.hpp:163:19: error: unused parameter 'f' [-Werror,-Wunused-parameter]
make_ready(T& f) {
^
/Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/future/utility.hpp:248:24: error: unused parameter 'f' [-Werror,-Wunused-parameter]
make_ready(Future& f) {
^
/Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/future/utility.hpp:291:24: error: unused parameter 'f' [-Werror,-Wunused-parameter]
make_ready(Future& f) {
^
In file included from /Users/ikorolev/repos/cocaine-framework-native/src/service_client/service.cpp:21:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service_client/manager.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service_client/service.hpp:24:
In file included from /Users/ikorolev/repos/cocaine-framework-native/include/cocaine/framework/service_client/connection.hpp:29:
In file included from /usr/local/include/cocaine/rpc/channel.hpp:24:
In file included from /usr/local/include/cocaine/asio/readable_stream.hpp:24:
In file included from /usr/local/include/cocaine/asio/reactor.hpp:39:
In file included from /usr/local/include/ev++.h:46:
/usr/local/include/ev.h:234:3: error: expected '}'
EV_ERROR = (int)0x80000000 /* sent when an error occurs */
^
/usr/include/sys/event.h:144:18: note: expanded from macro 'EV_ERROR'
#define EV_ERROR 0x4000 /* error, data contains errno */
^
/usr/local/include/ev.h:211:6: note: to match this '{'
enum {
^
/Users/ikorolev/repos/cocaine-framework-native/src/service_client/service.cpp:153:11: error: unused variable 'reactor' [-Werror,-Wunused-variable]
auto& reactor = m_connection->reactor();
^
7 errors generated.
make[2]: *** [CMakeFiles/cocaine-framework.dir/src/service_client/service.cpp.o] Error 1
make[1]: *** [CMakeFiles/cocaine-framework.dir/all] Error 2
make: *** [all] Error 2
User found a problem and reported it to reverbrain maillist.
More details at: https://groups.google.com/forum/#!topic/reverbrain/-LRZJ_IxJzA
it seems that major changes in cocaine-core were not reflected in framework native
Please take a look at https://groups.google.com/forum/#!topic/reverbrain/jgxKjxIk-wY
and answer into the maillist
can you explain me please how to properly write own realisation of a cocaine::framework::service_t like that? https://github.com/cocaine/cocaine-framework-native/blob/v0.11/include/cocaine/framework/services/storage.hpp
my goal is writing yet another service for cocaine_runtime and now the question arises how to calling my service from client side. what is a best way in v11?
Продублирую на великом и могучем вопрос, а то англицкий корявый. :)
Есть собственный сервис(плагин), который устанавливается и отлично работает в cocaine_runtime. Теперь хочется подёргать его из плюсового клиента, но непонятно как это сделать лучше в реалиях v11. Пытаюсь осознать можно ли сделать в таком виде: https://github.com/cocaine/cocaine-framework-native/blob/v0.11/include/cocaine/framework/services/storage.hpp
,но непонятно что делать в месте вызова call, ведь надо как-то указать что именно дёргать(какой метод, какой сервис):
Hi. You are have a bad example, but maybe I do something wrong. When I try use code from examples
g.then([](cocaine::framework::generator<std::string>& g){std::string result = g.next(); g.map(&handler);});
I get exception when calling g.next()
with text "There is no connection to service". But if I try to get data in sync mode - all is ok. I need get data from service in async mode. Can you help me?
I'm using Cocaine v0.11
I am trying to compile, but getting this error
[ 2%] Building CXX object src/CMakeFiles/cocaine-framework-native.dir/basic_session.cpp.o
In file included from /home/mikhail/cocaine-yandex/cocaine-framework-natve-bleeding-edge/include/cocaine/framework/detail/basic_session.hpp:32:0,
from /home/mikhail/cocaine-yandex/cocaine-framework-natve-bleeding-edge/src/basic_session.cpp:17:
/home/mikhail/cocaine-yandex/cocaine-framework-natve-bleeding-edge/include/cocaine/framework/receiver.hpp:28:35: fatal error: cocaine/trace/trace.hpp: Нет такого файла или каталога
#include <cocaine/trace/trace.hpp>
^
compilation terminated.
make[2]: *** [src/CMakeFiles/cocaine-framework-native.dir/basic_session.cpp.o] Ошибка 1
make[1]: *** [src/CMakeFiles/cocaine-framework-native.dir/all] Ошибка 2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.