예제 #1
0
void Key::transform(ioremap::elliptics::session &sess)
{
        struct dnet_id id;
        memset(&id, 0, sizeof(id));

        sess.transform(filename_, id);

        id_ = ID(id);
        byId_ = true;
}
예제 #2
0
	void queue_peek(ioremap::elliptics::session client, int req_unique_id, int arg)
	{
		client.set_exceptions_policy(ioremap::elliptics::session::no_exceptions);

		std::string queue_key = std::to_string(req_unique_id) + std::to_string(rand());

		auto req = std::make_shared<request>(req_unique_id);
		client.transform(queue_key, req->id);

		client.exec(&req->id, req->src_key, "queue@peek-multi", std::to_string(arg))
			.connect(
				std::bind(&queue_pump::data_received, this, req, std::placeholders::_1),
				std::bind(&queue_pump::request_complete, this, req, std::placeholders::_1)
			);
	}
예제 #3
0
파일: server.cpp 프로젝트: kod3r/swarm
ioremap::swarm::http_response::status_type elliptics_base::process(const swarm::http_request &request, ioremap::elliptics::key &key, ioremap::elliptics::session &session) const
{
	const auto &query = request.url().query();

	if (auto name = query.item_value("name")) {
		key = *name;
	} else if (auto sid = query.item_value("id")) {
		struct dnet_id id;
		memset(&id, 0, sizeof(struct dnet_id));

		dnet_parse_numeric_id(sid->c_str(), id.id);

		key = id;
	} else {
		return ioremap::swarm::http_response::bad_request;
	}

	session.transform(key);

	(void) session;

	return ioremap::swarm::http_response::ok;
}