diff --git a/CMakeLists.txt b/CMakeLists.txt index b878dfe..4b609f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.20) -project(logos_execution_zone_indexer_module LANGUAGES CXX) +project(LEZIndexerModule LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -151,7 +151,7 @@ if(WIN32) endif() add_library(logos_core STATIC IMPORTED - src/i_logos_execution_zone_indexer_module.h) + src/i_lez_indexer_module.h) set_target_properties(logos_core PROPERTIES IMPORTED_LOCATION "${SDK_LIB}" ) @@ -160,17 +160,28 @@ add_library(logos_cpp_sdk INTERFACE) target_include_directories(logos_cpp_sdk INTERFACE "${SDK_INC}") # ---- Plugin ---- -set(PLUGIN_TARGET logos_execution_zone_indexer_module) +set(PLUGIN_TARGET lez_indexer_module) -qt_add_plugin(${PLUGIN_TARGET} CLASS_NAME LogosExecutionZoneIndexerModule) +qt_add_plugin(${PLUGIN_TARGET} CLASS_NAME LezIndexerModule) + +# A consumer (module-viewer / basecamp) derives the QtRO object name it INVOKES +# from the produced library's FILENAME, whereas logos_host REGISTERS the plugin +# under metadata.json `name`. They must be identical, and short — macOS caps the +# QtRO `local:` socket path (sun_path) at 104 bytes, so a long name makes the host +# fail to listen. `PREFIX ""` drops the `lib` prefix so the file is exactly +# `lez_indexer_module.` == metadata `name` == `main` == name(). +set_target_properties(${PLUGIN_TARGET} PROPERTIES + OUTPUT_NAME lez_indexer_module + PREFIX "" +) target_sources(${PLUGIN_TARGET} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/src/logos_execution_zone_indexer_module.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/lez_indexer_module.cpp ) set_property(TARGET ${PLUGIN_TARGET} PROPERTY PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/src/i_logos_execution_zone_indexer_module.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/logos_execution_zone_indexer_module.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/i_lez_indexer_module.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/lez_indexer_module.h ) target_include_directories(${PLUGIN_TARGET} PRIVATE @@ -188,7 +199,7 @@ target_link_libraries(${PLUGIN_TARGET} PRIVATE ) target_compile_definitions(${PLUGIN_TARGET} PRIVATE - LOGOS_EXECUTION_ZONE_INDEXER_MODULE_METADATA_FILE="${CMAKE_CURRENT_SOURCE_DIR}/metadata.json" + LEZ_INDEXER_MODULE_METADATA_FILE="${CMAKE_CURRENT_SOURCE_DIR}/metadata.json" ) add_dependencies(${PLUGIN_TARGET} logos_execution_zone_libs) diff --git a/flake.nix b/flake.nix index 7888a70..8554cba 100644 --- a/flake.nix +++ b/flake.nix @@ -45,8 +45,8 @@ logosCore = logos-core.packages.${system}.default; logosExecutionZoneIndexerPackage = logos-execution-zone.packages.${system}.indexer; - logosExecutionZoneIndexerModulePackage = pkgs.stdenv.mkDerivation { - pname = "logos-execution-zone-module"; + lezIndexerModulePackage = pkgs.stdenv.mkDerivation { + pname = "lez-indexer-module"; version = "dev"; src = ./.; @@ -83,8 +83,8 @@ }; in { - lib = logosExecutionZoneIndexerModulePackage; - default = logosExecutionZoneIndexerModulePackage; + lib = lezIndexerModulePackage; + default = lezIndexerModulePackage; } ); @@ -92,7 +92,7 @@ system: let pkgs = mkPkgs system; - logosExecutionZoneIndexerModuleLib = self.packages.${system}.lib; + lezIndexerModuleLib = self.packages.${system}.lib; logosModuleViewerPackage = logos-module-viewer.packages.${system}.default; extension = if pkgs.stdenv.isDarwin then "dylib" else if pkgs.stdenv.hostPlatform.isWindows then "dll" @@ -102,7 +102,7 @@ program = "${pkgs.writeShellScriptBin "inspect-module" '' exec ${logosModuleViewerPackage}/bin/logos-module-viewer \ - --module ${logosExecutionZoneIndexerModuleLib}/lib/liblogos_execution_zone_indexer_module.${extension} + --module ${lezIndexerModuleLib}/lib/lez_indexer_module.${extension} ''}/bin/inspect-module"; }; in diff --git a/justfile b/justfile index 07c1165..536d3dc 100644 --- a/justfile +++ b/justfile @@ -7,7 +7,7 @@ configure: ${LOGOS_EXECUTION_ZONE_INDEXER_INCLUDE:+-DLOGOS_EXECUTION_ZONE_INDEXER_INCLUDE="$LOGOS_EXECUTION_ZONE_INDEXER_INCLUDE"} build: configure - cmake --build build --parallel --target logos_execution_zone_indexer_module + cmake --build build --parallel --target lez_indexer_module clean: rm -rf build result diff --git a/metadata.json b/metadata.json index a63b7c6..239530f 100644 --- a/metadata.json +++ b/metadata.json @@ -5,7 +5,7 @@ "author": "Logos Blockchain Team", "type": "core", "category": "blockchain", - "main": "liblogos_execution_zone_indexer_module", + "main": "lez_indexer_module", "dependencies": [], "capabilities": [], "include": ["libnomos.dylib"] diff --git a/src/i_logos_execution_zone_indexer_module.h b/src/i_lez_indexer_module.h similarity index 52% rename from src/i_logos_execution_zone_indexer_module.h rename to src/i_lez_indexer_module.h index a75ea59..da8a1b7 100644 --- a/src/i_logos_execution_zone_indexer_module.h +++ b/src/i_lez_indexer_module.h @@ -2,9 +2,9 @@ #include -class ILogosExecutionZoneIndexerModule { +class ILezIndexerModule { public: - virtual ~ILogosExecutionZoneIndexerModule() = default; + virtual ~ILezIndexerModule() = default; // === Logos Core === @@ -19,5 +19,5 @@ public: ) = 0; }; -#define ILogosExecutionZoneIndexerModule_iid "org.logos.ilogosexecutionzoneindexermodule" -Q_DECLARE_INTERFACE(ILogosExecutionZoneIndexerModule, ILogosExecutionZoneIndexerModule_iid) +#define ILezIndexerModule_iid "org.logos.ilezindexermodule" +Q_DECLARE_INTERFACE(ILezIndexerModule, ILezIndexerModule_iid) diff --git a/src/logos_execution_zone_indexer_module.cpp b/src/lez_indexer_module.cpp similarity index 71% rename from src/logos_execution_zone_indexer_module.cpp rename to src/lez_indexer_module.cpp index 8fa6ae3..6dce226 100644 --- a/src/logos_execution_zone_indexer_module.cpp +++ b/src/lez_indexer_module.cpp @@ -1,4 +1,4 @@ -#include "logos_execution_zone_indexer_module.h" +#include "lez_indexer_module.h" #include #include @@ -7,9 +7,9 @@ #include #include -LogosExecutionZoneIndexerModule::LogosExecutionZoneIndexerModule() = default; +LezIndexerModule::LezIndexerModule() = default; -LogosExecutionZoneIndexerModule::~LogosExecutionZoneIndexerModule() { +LezIndexerModule::~LezIndexerModule() { if (indexer_service_ffi) { OperationStatus operation_result = stop_indexer(indexer_service_ffi); @@ -24,23 +24,23 @@ LogosExecutionZoneIndexerModule::~LogosExecutionZoneIndexerModule() { // === Plugin Interface === -QString LogosExecutionZoneIndexerModule::name() const { +QString LezIndexerModule::name() const { return "lez_indexer_module"; } -QString LogosExecutionZoneIndexerModule::version() const { +QString LezIndexerModule::version() const { return "1.0.0"; } // === Logos Core === -void LogosExecutionZoneIndexerModule::initLogos(LogosAPI* logosApiInstance) { +void LezIndexerModule::initLogos(LogosAPI* logosApiInstance) { logosAPI = logosApiInstance; } // === Indexer Lifecycle === -int LogosExecutionZoneIndexerModule::start_indexer(const QString& config_path, uint16_t port) { +int LezIndexerModule::start_indexer(const QString& config_path, uint16_t port) { if (!indexer_service_ffi) { QByteArray utf8 = config_path.toUtf8(); const char* c_path = utf8.constData(); diff --git a/src/logos_execution_zone_indexer_module.h b/src/lez_indexer_module.h similarity index 63% rename from src/logos_execution_zone_indexer_module.h rename to src/lez_indexer_module.h index 44f252f..f34ec88 100644 --- a/src/logos_execution_zone_indexer_module.h +++ b/src/lez_indexer_module.h @@ -1,6 +1,6 @@ #pragma once -#include "i_logos_execution_zone_indexer_module.h" +#include "i_lez_indexer_module.h" #ifdef __cplusplus extern "C" { @@ -15,18 +15,18 @@ extern "C" { #include #include -class LogosExecutionZoneIndexerModule : public QObject, public PluginInterface, public ILogosExecutionZoneIndexerModule { +class LezIndexerModule : public QObject, public PluginInterface, public ILezIndexerModule { Q_OBJECT - Q_PLUGIN_METADATA(IID ILogosExecutionZoneIndexerModule_iid FILE LOGOS_EXECUTION_ZONE_INDEXER_MODULE_METADATA_FILE) - Q_INTERFACES(PluginInterface ILogosExecutionZoneIndexerModule) + Q_PLUGIN_METADATA(IID ILezIndexerModule_iid FILE LEZ_INDEXER_MODULE_METADATA_FILE) + Q_INTERFACES(PluginInterface ILezIndexerModule) private: LogosAPI* logosApi = nullptr; IndexerServiceFFI* indexer_service_ffi = nullptr; public: - LogosExecutionZoneIndexerModule(); - ~LogosExecutionZoneIndexerModule() override; + LezIndexerModule(); + ~LezIndexerModule() override; // === Plugin Interface === [[nodiscard]] QString name() const override; @@ -40,7 +40,7 @@ public: // Indexer Lifecycle Q_INVOKABLE int start_indexer(const QString& config_path, uint16_t port) override; - + signals: void eventResponse(const QString& eventName, const QVariantList& data); };