new messages objcomp names
This commit is contained in:
parent
85a29372f4
commit
2597edd579
@ -48,6 +48,8 @@ target_link_libraries(test_file_zstd PUBLIC
|
||||
add_library(message_fragment_store
|
||||
./fragment_store/message_serializer.hpp
|
||||
./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.cpp
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
#include "./message_serializer.hpp"
|
||||
|
||||
#include "./messages_meta_components.hpp"
|
||||
|
||||
#include <entt/container/dense_map.hpp>
|
||||
#include <entt/container/dense_set.hpp>
|
||||
|
||||
@ -54,33 +56,6 @@ namespace 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
|
||||
// on new message: assign fuid
|
||||
// on new and update: mark as fragment dirty
|
||||
|
33
src/fragment_store/messages_meta_components.hpp
Normal file
33
src/fragment_store/messages_meta_components.hpp
Normal 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"
|
||||
|
31
src/fragment_store/messages_meta_components_id.inl
Normal file
31
src/fragment_store/messages_meta_components_id.inl
Normal 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
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "./types.hpp"
|
||||
#include "object_store.hpp"
|
||||
#include "./object_store.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
@ -26,6 +26,7 @@ namespace ObjectStore::Components {
|
||||
// meta that is not written to (meta-)file
|
||||
namespace Ephemeral {
|
||||
|
||||
// TODO: move, backend specific
|
||||
struct MetaFileType {
|
||||
::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)
|
||||
namespace ObjComp = ObjectStore::Components;
|
||||
|
||||
// old names
|
||||
// old names from frag era
|
||||
namespace Fragment::Components {
|
||||
//struct ID {};
|
||||
//struct DataEncryptionType {};
|
||||
|
Loading…
Reference in New Issue
Block a user