new messages objcomp names

This commit is contained in:
Green Sky 2024-04-11 17:04:06 +02:00
parent 85a29372f4
commit 2597edd579
No known key found for this signature in database
5 changed files with 71 additions and 29 deletions

View File

@ -48,6 +48,8 @@ target_link_libraries(test_file_zstd PUBLIC
add_library(message_fragment_store add_library(message_fragment_store
./fragment_store/message_serializer.hpp ./fragment_store/message_serializer.hpp
./fragment_store/message_serializer.cpp ./fragment_store/message_serializer.cpp
./fragment_store/messages_meta_components.hpp
./fragment_store/messages_meta_components_id.inl
./fragment_store/message_fragment_store.hpp ./fragment_store/message_fragment_store.hpp
./fragment_store/message_fragment_store.cpp ./fragment_store/message_fragment_store.cpp

View File

@ -7,6 +7,8 @@
#include "./message_serializer.hpp" #include "./message_serializer.hpp"
#include "./messages_meta_components.hpp"
#include <entt/container/dense_map.hpp> #include <entt/container/dense_map.hpp>
#include <entt/container/dense_set.hpp> #include <entt/container/dense_set.hpp>
@ -54,33 +56,6 @@ namespace Message::Components {
} // Message::Components } // Message::Components
namespace ObjectStore::Components {
struct MessagesVersion {
// messages Object version
// 1 -> text_json
uint16_t v {1};
};
struct MessagesTSRange {
// timestamp range within the fragment
uint64_t begin {0}; // newer msg -> higher number
uint64_t end {0};
};
struct MessagesContact {
std::vector<uint8_t> id;
};
// TODO: add src contact (self id)
} // ObjectStore::Components
// old
namespace Fragment::Components {
struct MessagesTSRange : public ObjComp::MessagesTSRange {};
struct MessagesContact : public ObjComp::MessagesContact {};
} // Fragment::Components
// handles fragments for messages // handles fragments for messages
// on new message: assign fuid // on new message: assign fuid
// on new and update: mark as fragment dirty // on new and update: mark as fragment dirty

View File

@ -0,0 +1,33 @@
#pragma once
#include "./meta_components.hpp"
namespace ObjectStore::Components {
struct MessagesVersion {
// messages Object version
// 1 -> text_json
uint16_t v {1};
};
struct MessagesTSRange {
// timestamp range within the fragment
uint64_t begin {0}; // newer msg -> higher number
uint64_t end {0};
};
struct MessagesContact {
std::vector<uint8_t> id;
};
// TODO: add src contact (self id)
} // ObjectStore::Components
// old
namespace Fragment::Components {
struct MessagesTSRange : public ObjComp::MessagesTSRange {};
struct MessagesContact : public ObjComp::MessagesContact {};
} // Fragment::Components
#include "./messages_meta_components_id.inl"

View File

@ -0,0 +1,31 @@
#pragma once
#include "./messages_meta_components.hpp"
#include <entt/core/type_info.hpp>
// TODO: move more central
#define DEFINE_COMP_ID(x) \
template<> \
constexpr entt::id_type entt::type_hash<x>::value() noexcept { \
using namespace entt::literals; \
return #x##_hs; \
} \
template<> \
constexpr std::string_view entt::type_name<x>::value() noexcept { \
return #x; \
}
// cross compiler stable ids
DEFINE_COMP_ID(ObjComp::MessagesVersion)
DEFINE_COMP_ID(ObjComp::MessagesTSRange)
DEFINE_COMP_ID(ObjComp::MessagesContact)
// old stuff
//DEFINE_COMP_ID(FragComp::MessagesTSRange)
//DEFINE_COMP_ID(FragComp::MessagesContact)
#undef DEFINE_COMP_ID

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "./types.hpp" #include "./types.hpp"
#include "object_store.hpp" #include "./object_store.hpp"
#include <vector> #include <vector>
#include <string> #include <string>
@ -26,6 +26,7 @@ namespace ObjectStore::Components {
// meta that is not written to (meta-)file // meta that is not written to (meta-)file
namespace Ephemeral { namespace Ephemeral {
// TODO: move, backend specific
struct MetaFileType { struct MetaFileType {
::MetaFileType type {::MetaFileType::TEXT_JSON}; ::MetaFileType type {::MetaFileType::TEXT_JSON};
}; };
@ -61,7 +62,7 @@ namespace ObjectStore::Components {
// shortened to save bytes (until I find a way to save by ID in msgpack) // shortened to save bytes (until I find a way to save by ID in msgpack)
namespace ObjComp = ObjectStore::Components; namespace ObjComp = ObjectStore::Components;
// old names // old names from frag era
namespace Fragment::Components { namespace Fragment::Components {
//struct ID {}; //struct ID {};
//struct DataEncryptionType {}; //struct DataEncryptionType {};