#pragma once #include "../communication/service/IMessageHandler.hh" #include "Logger.hh" #include "StorageManager.hh" #include #include 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; }; }