Esempio n. 1
0
void Storage::timed_scan_string(const std::string& table,
        const std::string& cf,
        const int64_t shard_id,
        const int64_t time_stamp,
        std::map<std::string, std::map<std::string, std::string>>& value) {

    value.clear();
    int64_t node_id = StorageInfo::singleton().
        _table_info[table].
        _table_property.
        shard_location[shard_id];

    if(CPUNetworks::singleton()._cpu_networks.find(std::this_thread::get_id())
            != CPUNetworks::singleton()._cpu_networks.end()) {
        auto i = CPUNetworks::singleton()._cpu_networks[std::this_thread::get_id()][node_id];
        i->open_transport();
        i->method()->timed_scan_string(value, table, shard_id, cf, time_stamp);
        i->close_transport();
    } else {
        auto i =  NodeInfo::singleton()._client_task_tracker[node_id];
        i->open_transport();
        i->method()->timed_scan_string(value, table, shard_id, cf, time_stamp);
        i->close_transport();
    }
}
Esempio n. 2
0
int64_t Storage::vector_put_string(const std::string& table,
            const std::string& cf,
            const int64_t shard_id,
            const std::vector<std::string>& row_key,
            const std::vector<std::string>& column_key,
            const std::vector<std::string>& value) {

    int64_t node_id = StorageInfo::singleton().
            _table_info[table].
            _table_property.
            shard_location[shard_id];

    if(CPUNetworks::singleton()._cpu_networks.find(std::this_thread::get_id())
            != CPUNetworks::singleton()._cpu_networks.end()) {
        auto i = CPUNetworks::singleton()._cpu_networks[std::this_thread::get_id()][node_id];
        i->open_transport();
        i->method()->vector_put_string(table,shard_id, cf, row_key, column_key, value);
        i->close_transport();
    } else {
        auto i =  NodeInfo::singleton()._client_task_tracker[node_id];
        i->open_transport();
        i->method()->vector_put_string(table,shard_id, cf, row_key, column_key, value);
        i->close_transport();
    }
    return 1;
}
Esempio n. 3
0
zmq::pgm_socket_t::~pgm_socket_t ()
{
    //  Celanup.
    if (pgm_msgv) {
        delete [] pgm_msgv;
    }

    close_transport ();
}
Esempio n. 4
0
bool connection_engine::process_nothrow(int flags) {
    if (closed()) return false;
    if (flags & WRITE) try_write();
    dispatch();
    if (flags & READ) try_read();
    dispatch();

    if (connection_.closed() && !closed()) {
        dispatch();
        while (can_write()) {
            try_write(); // Flush final data.
        }
        // no transport errors.
        close_transport(ctx_);
    }
    if (closed()) {
        pn_transport_unbind(ctx_->transport);
        dispatch();
        try { io_close(); } catch(const io_error&) {} // Tell the IO to close.
    }
    return !closed();
}
Esempio n. 5
0
zmq::pgm_socket_t::~pgm_socket_t ()
{
    close_transport ();
}