This file provides guidance to an AI coding tool when working with code in this repository.
HugeGraph Server is the graph engine layer of Apache HugeGraph, consisting of:
Technology: Java 11+, Maven 3.5+, Apache TinkerPop 3.5.1, Jersey 3.0 (REST), gRPC (distributed communication)
# Build all modules (from hugegraph-server directory) mvn clean install -DskipTests # Build with tests mvn clean install # Build specific module mvn clean install -pl hugegraph-core -am -DskipTests
# Run checkstyle validation mvn checkstyle:check # Checkstyle runs automatically during 'validate' phase # Configuration: ../style/checkstyle.xml
Test profiles (-P flag):
core-test (default): Core graph engine testsunit-test: Unit tests only (memory backend)api-test: REST API teststinkerpop-structure-test: TinkerPop structure compliancetinkerpop-process-test: TinkerPop process complianceBackend profiles (combine with test profiles):
memory: In-memory backend (default for tests)rocksdb: RocksDB backendhbase: HBase backendmysql, postgresql, cassandra, scylladb, palo: Other backends# Unit tests (from hugegraph-server/) mvn test -pl hugegraph-test -am -P unit-test # Core tests with RocksDB backend mvn test -pl hugegraph-test -am -P core-test,rocksdb # API tests with memory backend mvn test -pl hugegraph-test -am -P api-test,memory # Run specific test class mvn test -pl hugegraph-test -am -P core-test,memory -Dtest=YourTestClassName # TinkerPop compliance tests (for release validation) mvn test -pl hugegraph-test -am -P tinkerpop-structure-test,memory mvn test -pl hugegraph-test -am -P tinkerpop-process-test,memory
All tests are in hugegraph-test/ which depends on all other modules. Tests are organized by:
src/test/java/.../unit/src/test/java/.../core/src/test/java/.../api/Multi-module Maven project with 13 submodules:
hugegraph-server/ ├── hugegraph-core # Graph engine, TinkerPop impl, schema, backend interface ├── hugegraph-api # REST API, Gremlin/Cypher endpoints, authentication ├── hugegraph-rocksdb # RocksDB backend (default, embedded) ├── hugegraph-hstore # HStore backend (distributed, production) ├── hugegraph-mysql # MySQL backend (legacy) ├── hugegraph-postgresql # PostgreSQL backend (legacy) ├── hugegraph-cassandra # Cassandra backend (legacy) ├── hugegraph-scylladb # ScyllaDB backend (legacy) ├── hugegraph-hbase # HBase backend (legacy) ├── hugegraph-palo # Palo backend (legacy) ├── hugegraph-dist # Distribution packaging, scripts, configs ├── hugegraph-test # All test suites └── hugegraph-example # Example code
org/apache/hugegraph/ ├── HugeGraph.java # Main graph interface ├── StandardHugeGraph.java # Core implementation ├── HugeFactory.java # Factory for graph instances ├── backend/ # Backend abstraction and implementations │ ├── store/BackendStore.java # Storage backend interface │ ├── serializer/ # Data serialization │ └── tx/ # Transaction management ├── schema/ # Schema management (VertexLabel, EdgeLabel, etc.) ├── structure/ # Graph elements (Vertex, Edge, Property) ├── traversal/ # Gremlin traversal optimization ├── task/ # Async task scheduling and execution ├── auth/ # Authentication and authorization ├── job/ # Job management (rebuild, compact, etc.) └── meta/ # Metadata management
org/apache/hugegraph/ ├── api/ # REST API endpoints │ ├── graph/GraphAPI.java # Graph CRUD operations │ ├── schema/ # Schema APIs │ ├── gremlin/GremlinAPI.java # Gremlin query endpoint │ ├── cypher/CypherAPI.java # Cypher query endpoint (via OpenCypher) │ ├── auth/ # Authentication APIs │ └── job/TaskAPI.java # Job/Task management APIs ├── server/RestServer.java # Jersey/Grizzly REST server ├── auth/ # Auth filters and handlers └── metrics/ # Metrics collection
All storage backends implement the BackendStore interface from hugegraph-core. New backends can be added as separate modules without modifying core code. Backend selection is via backend property in conf/hugegraph.properties.
Full Apache TinkerPop 3 implementation with:
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/gremlin-groovy integrationhugegraph-api/src/main/java/org/apache/hugegraph/opencypher/opencypher-gremlin libraryWhen working with HStore backend or distributed features:
hugegraph-core/src/main/resources/proto/target/generated-sources/protobuf/java/mvn clean compileAuthentication is optional and disabled by default:
bin/enable-auth.sh or via configurationhugegraph-api/src/main/java/org/apache/hugegraph/auth/hugegraph-core/src/main/java/org/apache/hugegraph/auth/After building, server distribution is in hugegraph-dist/target/. Scripts are in hugegraph-dist/src/assembly/static/bin/:
# Initialize backend storage (first time only) bin/init-store.sh # Start server (REST API on 8080, Gremlin on 8182) bin/start-hugegraph.sh # Stop server bin/stop-hugegraph.sh # Gremlin console (interactive) bin/gremlin-console.sh # Monitor server status bin/monitor-hugegraph.sh # Enable authentication bin/enable-auth.sh
Located in hugegraph-dist/src/assembly/static/conf/:
hugegraph.properties: Main server configuration (backend, storage paths, cache)rest-server.properties: REST API settings (host, port, thread pool, SSL)gremlin-server.yaml: Gremlin server configuration (WebSocket, serializers)log4j2.xml: Logging configurationhugegraph-api/src/main/java/org/apache/hugegraph/api/ApiBase or relevant base class@Path, @GET, @POST, etc.)hugegraph-test/src/test/java/.../api/hugegraph-{backend-name}/hugegraph-coreBackendStore interfaceBackendStoreProvider for factorypom.xml <modules> sectionhugegraph-core/src/main/java/org/apache/hugegraph/schema/hugegraph-core/src/main/java/org/apache/hugegraph/structure/Transaction management is in hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/:
GraphTransaction: Vertex/Edge operationsSchemaTransaction: Schema operationsIndexTransaction: Index operations../style/checkstyle.xmlvalidate phaseAll Java files must have Apache License header. Verified via maven-checkstyle-plugin.
${revision} property (currently 1.7.0)flatten-maven-plugin for CI-friendly versioninghugegraph-api → hugegraph-core → hugegraph-commons (external)
hugegraph-{backend} → hugegraph-core
hugegraph-test → all modules
target/generated-sources/Backends are loaded via ServiceLoader pattern. The backend property in hugegraph.properties determines which implementation is used. All backend JARs must be on classpath.
hugegraph-dist/src/assembly/static/conf/log4j2.xmlbin/dump-conf.shbin/dump-store.shbin/raft-tools.sh