client, builtin/{network,client_file}: Use portable binary archives

master
Perttu Ahola 2014-09-19 17:34:00 +03:00
parent 4e76b92196
commit a370bcb166
4 changed files with 13 additions and 14 deletions

View File

@ -6,7 +6,7 @@
#include "interface/file_watch.h"
#include "client_file/api.h"
#include "network/api.h"
#include <cereal/archives/binary.hpp>
#include <cereal/archives/portable_binary.hpp>
#include <cereal/types/string.hpp>
#include <cereal/types/vector.hpp>
#include <cereal/types/tuple.hpp>
@ -101,7 +101,7 @@ struct Module: public interface::Module, public client_file::Interface
std::ostringstream os(std::ios::binary);
{
cereal::BinaryOutputArchive ar(os);
cereal::PortableBinaryOutputArchive ar(os);
ar(file_restore_info);
}
m_server->tmp_store_data("client_file:restore_info", os.str());
@ -115,7 +115,7 @@ struct Module: public interface::Module, public client_file::Interface
sv_<std::tuple<ss_, ss_, ss_>> file_restore_info;
std::istringstream is(data, std::ios::binary);
{
cereal::BinaryInputArchive ar(is);
cereal::PortableBinaryInputArchive ar(is);
ar(file_restore_info);
}
for(auto &tuple : file_restore_info){
@ -140,7 +140,7 @@ struct Module: public interface::Module, public client_file::Interface
const FileInfo &info = *pair.second.get();
std::ostringstream os(std::ios::binary);
{
cereal::BinaryOutputArchive ar(os);
cereal::PortableBinaryOutputArchive ar(os);
ar(info.name);
ar(info.hash);
}
@ -160,7 +160,7 @@ struct Module: public interface::Module, public client_file::Interface
ss_ file_hash;
std::istringstream is(packet.data, std::ios::binary);
{
cereal::BinaryInputArchive ar(is);
cereal::PortableBinaryInputArchive ar(is);
ar(file_name);
ar(file_hash);
}
@ -181,7 +181,7 @@ struct Module: public interface::Module, public client_file::Interface
}
std::ostringstream os(std::ios::binary);
{
cereal::BinaryOutputArchive ar(os);
cereal::PortableBinaryOutputArchive ar(os);
ar(info.name);
ar(info.hash);
ar(info.content);

View File

@ -5,7 +5,7 @@
#include "interface/packet_stream.h"
#include "network/api.h"
#include "core/log.h"
#include <cereal/archives/binary.hpp>
#include <cereal/archives/portable_binary.hpp>
#include <cereal/types/vector.hpp>
#include <cereal/types/tuple.hpp>
#include <deque>
@ -117,7 +117,7 @@ struct Module: public interface::Module, public network::Interface
std::ostringstream os(std::ios::binary);
{
cereal::BinaryOutputArchive ar(os);
cereal::PortableBinaryOutputArchive ar(os);
ar(listening_fd);
ar(peer_restore_info);
}
@ -133,7 +133,7 @@ struct Module: public interface::Module, public network::Interface
sv_<std::tuple<Peer::Id, int>> peer_restore_info;
std::istringstream is(data, std::ios::binary);
{
cereal::BinaryInputArchive ar(is);
cereal::PortableBinaryInputArchive ar(is);
ar(listening_fd);
ar(peer_restore_info);
}

View File

@ -6,7 +6,7 @@
#include "interface/packet_stream.h"
#include "interface/sha1.h"
#include "interface/fs.h"
#include <cereal/archives/binary.hpp>
#include <cereal/archives/portable_binary.hpp>
#include <cereal/types/string.hpp>
#include <cstring>
#include <fstream>
@ -142,7 +142,7 @@ struct CState: public State
ss_ file_hash;
std::istringstream is(data, std::ios::binary);
{
cereal::BinaryInputArchive ar(is);
cereal::PortableBinaryInputArchive ar(is);
ar(file_name);
ar(file_hash);
}
@ -161,7 +161,7 @@ struct CState: public State
cs(file_hash_hex), cs(file_name));
std::ostringstream os(std::ios::binary);
{
cereal::BinaryOutputArchive ar(os);
cereal::PortableBinaryOutputArchive ar(os);
ar(file_name);
ar(file_hash);
}
@ -184,7 +184,7 @@ struct CState: public State
ss_ file_content;
std::istringstream is(data, std::ios::binary);
{
cereal::BinaryInputArchive ar(is);
cereal::PortableBinaryInputArchive ar(is);
ar(file_name);
ar(file_hash);
ar(file_content);

View File

@ -3,7 +3,6 @@ Buildat TODO
- Cache a hash of each compiled module in order not to rebuild them
unnecessarily
- Modules should be run in threads.
- Use portable binary archives for networked data
Buildat TODO later
==================