Loading src/io/transferors/local-path-to-remote-resource.cpp +15 −20 Original line number Diff line number Diff line Loading @@ -213,32 +213,27 @@ local_path_to_remote_resource_transferor::transfer( hermes::mutable_buffer{input_buffer.data(), input_buffer.size()} }; auto buffers = auto local_buffers = m_network_endpoint->expose(bufvec, hermes::access_mode::read_only); rpc::remote_transfer::input args( m_network_endpoint->self_address(), d_src.parent()->nsid(), d_dst.parent()->nsid(), static_cast<uint32_t>(backend_type::posix_filesystem), static_cast<uint32_t>(data::resource_type::local_posix_path), d_src.is_collection(), d_dst.name(), buffers); auto resp = m_network_endpoint->post<rpc::remote_transfer>( m_network_endpoint->post<rpc::push_resource>( endp, rpc::remote_transfer::input{ rpc::push_resource::input{ m_network_endpoint->self_address(), d_src.parent()->nsid(), d_dst.parent()->nsid(), static_cast<uint32_t>(backend_type::posix_filesystem), // XXX this resource_type should not be needed, but we // XXX cannot (easily) find it out right now in the server, // XXX for now we propagate it, but we should implement // XXX a lookup()/stat() function in backends to retrieve // XXX this information locally from the resource id static_cast<uint32_t>( data::resource_type::local_posix_path), d_src.is_collection(), d_src.name(), d_dst.name(), buffers local_buffers }).get(); if(static_cast<task_status>(resp.at(0).status()) == Loading Loading @@ -285,7 +280,7 @@ local_path_to_remote_resource_transferor::accept_transfer( // retrieve task context const auto ctx = boost::any_cast< std::shared_ptr< hermes::request<rpc::remote_transfer>>>(task_info->context()); hermes::request<rpc::push_resource>>>(task_info->context()); auto req = std::move(*ctx); LOGGER_DEBUG("[{}] accept_push: {} -> {}", task_info->id(), Loading Loading @@ -351,7 +346,7 @@ local_path_to_remote_resource_transferor::accept_transfer( // is called. const auto completion_callback = [this, is_collection, tempfile, d_dst, output_buffer, start]( hermes::request<rpc::remote_transfer>&& req) { hermes::request<rpc::push_resource>&& req) { uint32_t usecs = std::chrono::duration_cast<std::chrono::microseconds>( Loading @@ -361,7 +356,7 @@ local_path_to_remote_resource_transferor::accept_transfer( LOGGER_DEBUG("Pull completed ({} usecs)", usecs); // default response (success) rpc::remote_transfer::output out = { rpc::push_resource::output out = { static_cast<uint32_t>(task_status::finished), static_cast<uint32_t>(urd_error::success), 0, Loading @@ -372,7 +367,7 @@ local_path_to_remote_resource_transferor::accept_transfer( ::unpack_archive(tempfile->path(), d_dst.parent()->mount()); if(ec) { out = rpc::remote_transfer::output{ out = rpc::push_resource::output{ static_cast<uint32_t>( task_status::finished_with_error), static_cast<uint32_t>(urd_error::system_error), Loading @@ -393,7 +388,7 @@ local_path_to_remote_resource_transferor::accept_transfer( respond: if(req.requires_response()) { m_network_endpoint->respond<rpc::remote_transfer>( m_network_endpoint->respond<rpc::push_resource>( std::move(req), out); } }; Loading src/io/transferors/local-path-to-remote-resource.hpp +0 −8 Original line number Diff line number Diff line Loading @@ -51,10 +51,6 @@ struct resource_info; struct resource; } namespace rpc { struct remote_transfer; } namespace io { struct local_path_to_remote_resource_transferor : public transferor { Loading Loading @@ -85,10 +81,6 @@ struct local_path_to_remote_resource_transferor : public transferor { to_string() const override final; private: void do_accept(hermes::request<norns::rpc::remote_transfer>&& req); std::shared_ptr<hermes::async_engine> m_network_endpoint; }; Loading src/io/transferors/remote-resource-to-local-path.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -158,9 +158,9 @@ remote_resource_to_local_path_transferor::transfer( hermes::endpoint endp = m_network_endpoint->lookup(d_src.address()); auto resp = m_network_endpoint->post<rpc::resource_stat>( m_network_endpoint->post<rpc::stat_resource>( endp, rpc::resource_stat::input{ rpc::stat_resource::input{ m_network_endpoint->self_address(), d_src.parent()->nsid(), static_cast<uint32_t>(data::resource_type::local_posix_path), Loading Loading @@ -228,7 +228,7 @@ remote_resource_to_local_path_transferor::transfer( // XXX cannot (easily) find it out right now in the server, // XXX for now we propagate it, but we should implement // XXX a lookup()/stat() function in backends to retrieve // XXX this information from the resource id // XXX this information locally from the resource id static_cast<uint32_t>( data::resource_type::local_posix_path), m_network_endpoint->self_address(), Loading src/io/transferors/remote-resource-to-local-path.hpp +0 −8 Original line number Diff line number Diff line Loading @@ -51,10 +51,6 @@ struct resource_info; struct resource; } namespace rpc { struct remote_transfer; } namespace io { struct remote_resource_to_local_path_transferor : public transferor { Loading Loading @@ -85,10 +81,6 @@ struct remote_resource_to_local_path_transferor : public transferor { to_string() const override final; private: void do_accept(hermes::request<norns::rpc::remote_transfer>&& req); std::shared_ptr<hermes::async_engine> m_network_endpoint; }; Loading src/rpcs.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -9,9 +9,9 @@ namespace hermes { namespace detail { // void register_user_request_types() { (void) registered_requests().add<norns::rpc::remote_transfer>(); (void) registered_requests().add<norns::rpc::push_resource>(); (void) registered_requests().add<norns::rpc::pull_resource>(); (void) registered_requests().add<norns::rpc::resource_stat>(); (void) registered_requests().add<norns::rpc::stat_resource>(); } }} // namespace hermes::detail Loading
src/io/transferors/local-path-to-remote-resource.cpp +15 −20 Original line number Diff line number Diff line Loading @@ -213,32 +213,27 @@ local_path_to_remote_resource_transferor::transfer( hermes::mutable_buffer{input_buffer.data(), input_buffer.size()} }; auto buffers = auto local_buffers = m_network_endpoint->expose(bufvec, hermes::access_mode::read_only); rpc::remote_transfer::input args( m_network_endpoint->self_address(), d_src.parent()->nsid(), d_dst.parent()->nsid(), static_cast<uint32_t>(backend_type::posix_filesystem), static_cast<uint32_t>(data::resource_type::local_posix_path), d_src.is_collection(), d_dst.name(), buffers); auto resp = m_network_endpoint->post<rpc::remote_transfer>( m_network_endpoint->post<rpc::push_resource>( endp, rpc::remote_transfer::input{ rpc::push_resource::input{ m_network_endpoint->self_address(), d_src.parent()->nsid(), d_dst.parent()->nsid(), static_cast<uint32_t>(backend_type::posix_filesystem), // XXX this resource_type should not be needed, but we // XXX cannot (easily) find it out right now in the server, // XXX for now we propagate it, but we should implement // XXX a lookup()/stat() function in backends to retrieve // XXX this information locally from the resource id static_cast<uint32_t>( data::resource_type::local_posix_path), d_src.is_collection(), d_src.name(), d_dst.name(), buffers local_buffers }).get(); if(static_cast<task_status>(resp.at(0).status()) == Loading Loading @@ -285,7 +280,7 @@ local_path_to_remote_resource_transferor::accept_transfer( // retrieve task context const auto ctx = boost::any_cast< std::shared_ptr< hermes::request<rpc::remote_transfer>>>(task_info->context()); hermes::request<rpc::push_resource>>>(task_info->context()); auto req = std::move(*ctx); LOGGER_DEBUG("[{}] accept_push: {} -> {}", task_info->id(), Loading Loading @@ -351,7 +346,7 @@ local_path_to_remote_resource_transferor::accept_transfer( // is called. const auto completion_callback = [this, is_collection, tempfile, d_dst, output_buffer, start]( hermes::request<rpc::remote_transfer>&& req) { hermes::request<rpc::push_resource>&& req) { uint32_t usecs = std::chrono::duration_cast<std::chrono::microseconds>( Loading @@ -361,7 +356,7 @@ local_path_to_remote_resource_transferor::accept_transfer( LOGGER_DEBUG("Pull completed ({} usecs)", usecs); // default response (success) rpc::remote_transfer::output out = { rpc::push_resource::output out = { static_cast<uint32_t>(task_status::finished), static_cast<uint32_t>(urd_error::success), 0, Loading @@ -372,7 +367,7 @@ local_path_to_remote_resource_transferor::accept_transfer( ::unpack_archive(tempfile->path(), d_dst.parent()->mount()); if(ec) { out = rpc::remote_transfer::output{ out = rpc::push_resource::output{ static_cast<uint32_t>( task_status::finished_with_error), static_cast<uint32_t>(urd_error::system_error), Loading @@ -393,7 +388,7 @@ local_path_to_remote_resource_transferor::accept_transfer( respond: if(req.requires_response()) { m_network_endpoint->respond<rpc::remote_transfer>( m_network_endpoint->respond<rpc::push_resource>( std::move(req), out); } }; Loading
src/io/transferors/local-path-to-remote-resource.hpp +0 −8 Original line number Diff line number Diff line Loading @@ -51,10 +51,6 @@ struct resource_info; struct resource; } namespace rpc { struct remote_transfer; } namespace io { struct local_path_to_remote_resource_transferor : public transferor { Loading Loading @@ -85,10 +81,6 @@ struct local_path_to_remote_resource_transferor : public transferor { to_string() const override final; private: void do_accept(hermes::request<norns::rpc::remote_transfer>&& req); std::shared_ptr<hermes::async_engine> m_network_endpoint; }; Loading
src/io/transferors/remote-resource-to-local-path.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -158,9 +158,9 @@ remote_resource_to_local_path_transferor::transfer( hermes::endpoint endp = m_network_endpoint->lookup(d_src.address()); auto resp = m_network_endpoint->post<rpc::resource_stat>( m_network_endpoint->post<rpc::stat_resource>( endp, rpc::resource_stat::input{ rpc::stat_resource::input{ m_network_endpoint->self_address(), d_src.parent()->nsid(), static_cast<uint32_t>(data::resource_type::local_posix_path), Loading Loading @@ -228,7 +228,7 @@ remote_resource_to_local_path_transferor::transfer( // XXX cannot (easily) find it out right now in the server, // XXX for now we propagate it, but we should implement // XXX a lookup()/stat() function in backends to retrieve // XXX this information from the resource id // XXX this information locally from the resource id static_cast<uint32_t>( data::resource_type::local_posix_path), m_network_endpoint->self_address(), Loading
src/io/transferors/remote-resource-to-local-path.hpp +0 −8 Original line number Diff line number Diff line Loading @@ -51,10 +51,6 @@ struct resource_info; struct resource; } namespace rpc { struct remote_transfer; } namespace io { struct remote_resource_to_local_path_transferor : public transferor { Loading Loading @@ -85,10 +81,6 @@ struct remote_resource_to_local_path_transferor : public transferor { to_string() const override final; private: void do_accept(hermes::request<norns::rpc::remote_transfer>&& req); std::shared_ptr<hermes::async_engine> m_network_endpoint; }; Loading
src/rpcs.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -9,9 +9,9 @@ namespace hermes { namespace detail { // void register_user_request_types() { (void) registered_requests().add<norns::rpc::remote_transfer>(); (void) registered_requests().add<norns::rpc::push_resource>(); (void) registered_requests().add<norns::rpc::pull_resource>(); (void) registered_requests().add<norns::rpc::resource_stat>(); (void) registered_requests().add<norns::rpc::stat_resource>(); } }} // namespace hermes::detail