MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/logging/LogStorageStreamAgent.hh
2024-06-07 11:12:56 +03:00

61 lines
1.6 KiB
C++

#pragma once
#include "../communication/service/IMessageHandler.hh"
#include "Logger.hh"
#include "StorageManager.hh"
#include <memory_resource>
#include <map>
namespace logging {
class LogStorageStreamAgent {
public:
enum StreamingContex {
LOG_STORAGE_PARAMETES,
READ_RECORDS_BLOCK
};
public:
LogStorageStreamAgent( StorageReadInterface & );
communication::IMessageHandler * get_context_of( StreamingContex );
private:
StorageReadInterface & storage;
struct LogParameters : communication::IMessageHandler {
LogStorageStreamAgent & agent;
struct Responce {
Logger::Id idx; // Идентификатор журнала записей.
StorageManager::BlockId n; // Количество блоков записей.
};
LogParameters( LogStorageStreamAgent & agent_ ) : agent(agent_) {}
void handler( communication::IMessageLink * link );
} log_parameters;
//!Блок возврашает страницу целиком.
struct ReadingRecordsBlock : communication::IMessageHandler {
LogStorageStreamAgent & agent;
struct Responce {
StorageManager::prefetch_result operation_result; // Идентификатор блока записей.
uint16_t length; // Длина блока сообщений
};
ReadingRecordsBlock( LogStorageStreamAgent & agent_ ) : agent(agent_) {}
void handler( communication::IMessageLink * link );
} reading_records_block;
};
}