Esempio n. 1
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)
			);
	}
Esempio n. 2
0
	void queue_ack(ioremap::elliptics::session client,
			std::shared_ptr<request> req,
			ioremap::elliptics::exec_context context,
			const std::vector<ioremap::grape::entry_id> &ids)
	{
		client.set_exceptions_policy(ioremap::elliptics::session::no_exceptions);

		size_t count = ids.size();
		client.exec(context, "queue@ack-multi", ioremap::grape::serialize(ids))
			.connect(
				ioremap::elliptics::async_result<ioremap::elliptics::exec_result_entry>::result_function(),
				[req, count] (const ioremap::elliptics::error_info &error) {
					if (error) {
						fprintf(stderr, "%s %d, %ld entries not acked: %s\n", dnet_dump_id(&req->id), req->src_key, count, error.message().c_str());
					} else {
						fprintf(stderr, "%s %d, %ld entries acked\n", dnet_dump_id(&req->id), req->src_key, count);
					}
				}
			);
	}