예제 #1
0
TransferRequest
MessageUtils::create_transfer_request(const vfs::Object& obj,
                                      const vfs::NodeId& target_node_id,
                                      const boost::chrono::milliseconds& sync_timeout_ms)
{
    TransferRequest msg;
    msg.set_object_id(obj.id.str());
    msg.set_object_type(static_cast<uint32_t>(obj.type));
    msg.set_target_node_id(target_node_id.str());
    msg.set_sync_timeout_ms(sync_timeout_ms.count());

    msg.CheckInitialized();

    return msg;
}
ScheduledReporter::ScheduledReporter(MetricRegistryPtr registry,
        boost::chrono::milliseconds rate_unit) :
                running_(false),
                metric_registry_(registry),
                scheduled_executor_(1),
                rate_factor_(
                        boost::chrono::milliseconds(1000).count()
                                / rate_unit.count()),
                duration_factor_(
                        static_cast<double>(1.0)
                                / boost::chrono::duration_cast<
                                        boost::chrono::nanoseconds>(
                                        boost::chrono::milliseconds(1)).count()) {

}
예제 #3
0
        int ZMQTransport::dispatch(boost::chrono::milliseconds timeout)
        {
            zmq::pollitem_t items[] =
            {
                { _socket, 0, ZMQ_POLLIN, 0 }
            };

            BOOST_LOG_TRIVIAL(debug) << "Polling zmq";
            int result = zmq::poll(items, 1, timeout.count());
            if (result > 0)
            {
                BOOST_LOG_TRIVIAL(debug) << "... Received";

                zmq::message_t msg;
                _socket.recv(&msg);

                Packet p(msg.size());
                ::memcpy(p.data(), msg.data(), msg.size());

                onPacket(p);
            }

            return result;
        }