move json around and disable files for now

This commit is contained in:
Green Sky 2024-02-17 16:50:56 +01:00
parent 4ec87337c8
commit 7ac62274f4
No known key found for this signature in database
3 changed files with 39 additions and 22 deletions

View File

@ -9,6 +9,8 @@ add_library(fragment_store
./fragment_store/serializer.hpp
./fragment_store/fragment_store.hpp
./fragment_store/fragment_store.cpp
./json/message_components.hpp # TODO: move
)
target_link_libraries(fragment_store PUBLIC

View File

@ -1,5 +1,7 @@
#include "./message_fragment_store.hpp"
#include "../json/message_components.hpp"
#include <solanaceae/util/utils.hpp>
#include <solanaceae/contact/components.hpp>
@ -29,20 +31,6 @@ namespace Message::Components {
std::vector<OpenFrag> fuid_open;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Timestamp, ts)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(TimestampProcessed, ts)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(TimestampWritten, ts)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ContactFrom, c)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ContactTo, c)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Read, ts)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(MessageText, text)
namespace Transfer {
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FileInfo::FileDirEntry, file_name, file_size)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FileInfo, file_list, total_size)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FileInfoLocal, file_list)
} // Transfer
} // Message::Components
namespace Fragment::Components {
@ -314,12 +302,12 @@ MessageFragmentStore::MessageFragmentStore(
// files
//_sc.registerSerializerJson<Message::Components::Transfer::FileID>()
_sc.registerSerializerJson<Message::Components::Transfer::FileInfo>();
_sc.registerDeSerializerJson<Message::Components::Transfer::FileInfo>();
_sc.registerSerializerJson<Message::Components::Transfer::FileInfoLocal>();
_sc.registerDeSerializerJson<Message::Components::Transfer::FileInfoLocal>();
_sc.registerSerializerJson<Message::Components::Transfer::TagHaveAll>();
_sc.registerDeSerializerJson<Message::Components::Transfer::TagHaveAll>();
//_sc.registerSerializerJson<Message::Components::Transfer::FileInfo>();
//_sc.registerDeSerializerJson<Message::Components::Transfer::FileInfo>();
//_sc.registerSerializerJson<Message::Components::Transfer::FileInfoLocal>();
//_sc.registerDeSerializerJson<Message::Components::Transfer::FileInfoLocal>();
//_sc.registerSerializerJson<Message::Components::Transfer::TagHaveAll>();
//_sc.registerDeSerializerJson<Message::Components::Transfer::TagHaveAll>();
_fs.subscribe(this, FragmentStore_Event::fragment_construct);
}
@ -347,8 +335,8 @@ float MessageFragmentStore::tick(float time_delta) {
continue;
}
// require msg and file for now
if (!reg->any_of<Message::Components::MessageText, Message::Components::Transfer::FileInfo>(m)) {
// require msg for now
if (!reg->any_of<Message::Components::MessageText/*, Message::Components::Transfer::FileInfo*/>(m)) {
continue;
}

View File

@ -0,0 +1,27 @@
#pragma once
#include <solanaceae/util/utils.hpp>
#include <solanaceae/message3/components.hpp>
#include <nlohmann/json.hpp>
namespace Message::Components {
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Timestamp, ts)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(TimestampProcessed, ts)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(TimestampWritten, ts)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ContactFrom, c)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ContactTo, c)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Read, ts)
// TODO: SyncedBy
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(MessageText, text)
namespace Transfer {
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FileInfo::FileDirEntry, file_name, file_size)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FileInfo, file_list, total_size)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FileInfoLocal, file_list)
} // Transfer
} // Message::Components