lez-indexer-module/src/lez_indexer_module.h

58 lines
1.8 KiB
C
Raw Normal View History

2026-04-30 15:15:43 +03:00
#pragma once
2026-04-15 17:35:49 +03:00
2026-06-16 15:42:53 +03:00
#include "i_lez_indexer_module.h"
2026-04-15 17:35:49 +03:00
#ifdef __cplusplus
extern "C" {
#endif
#include <indexer_ffi.h>
#ifdef __cplusplus
}
#endif
#include <QJsonArray>
#include <QObject>
#include <QString>
#include <QVariantList>
2026-06-16 15:42:53 +03:00
class LezIndexerModule : public QObject, public PluginInterface, public ILezIndexerModule {
2026-04-15 17:35:49 +03:00
Q_OBJECT
2026-06-16 15:42:53 +03:00
Q_PLUGIN_METADATA(IID ILezIndexerModule_iid FILE LEZ_INDEXER_MODULE_METADATA_FILE)
Q_INTERFACES(PluginInterface ILezIndexerModule)
2026-04-15 17:35:49 +03:00
private:
LogosAPI* logosApi = nullptr;
IndexerServiceFFI* indexer_service_ffi = nullptr;
public:
2026-06-16 15:42:53 +03:00
LezIndexerModule();
~LezIndexerModule() override;
2026-04-15 17:35:49 +03:00
// === Plugin Interface ===
[[nodiscard]] QString name() const override;
[[nodiscard]] QString version() const override;
// === Logos Core ===
Q_INVOKABLE void initLogos(LogosAPI* logosApiInstance) override;
// === Logos Execution Zone Indexer ===
// Indexer Lifecycle
2026-06-16 15:52:56 +03:00
Q_INVOKABLE int start_indexer(const QString& config_path, const QString& port) override;
2026-06-16 15:42:53 +03:00
// Indexer Queries (return compact JSON strings; see i_lez_indexer_module.h)
Q_INVOKABLE QString getAccount(const QString& account_id) override;
Q_INVOKABLE QString getBlockById(const QString& block_id) override;
Q_INVOKABLE QString getBlockByHash(const QString& hash) override;
Q_INVOKABLE QString getTransaction(const QString& hash) override;
Q_INVOKABLE QString getBlocks(const QString& before, const QString& limit) override;
Q_INVOKABLE QString getLastFinalizedBlockId() override;
Q_INVOKABLE QString getTransactionsByAccount(const QString& account_id,
const QString& offset,
const QString& limit) override;
2026-04-15 17:35:49 +03:00
signals:
void eventResponse(const QString& eventName, const QVariantList& data);
};