Exemple #1
0
    void RemoteCache::AsyncReadBlock(const channel_id& channel_identifier, size_t block_index, size_t priority, ReadBlockCallback callback)
    {
        ReadBlockCallback wrapped_callback = bind(
            &RemoteCache::OnReadBlockCallback,
            shared_from_this(),
            callback,
            _2,
            _3, 
            _1, 
            _4);

        ChannelPointer target_channel = channel_manager_->GetChannel(channel_identifier);
        if (!target_channel)
        {
            callback(ErrorCodes::ResourceNotFound, channel_identifier, block_index, boost::shared_ptr<BlockData>());
            return;
        }

        ChannelConfiguration channel_config(target_channel->channel_config_);

        io_service_->post(
            bind(
                &RemoteCache::CreateDownloadTask, 
                shared_from_this(), 
                channel_identifier, 
                block_index,
                priority,
                channel_config,
                wrapped_callback));
    }
 void client::configure( const fc::path& dir )
 { try {
    my->_data_dir = dir;
    fc::create_directories(dir);
    for( auto itr = my->_channels.begin(); itr != my->_channels.end(); ++itr )
    {
       itr->second->configure( channel_config( dir / ("channel"+ fc::to_string( uint64_t(itr->first) ) ) ) );
    }
 } FC_RETHROW_EXCEPTIONS( warn, "", ("dir",dir) ) }
Exemple #3
0
int main(int argc, char **argv)
{
    channel_filter cf(channel_config(parse(argc, argv)));
    return cf.execute();
}