From 7cec2a75d214506751b62ccf4e59fa5ca405f3b6 Mon Sep 17 00:00:00 2001 From: V_Galaxy Date: Mon, 11 Dec 2023 12:28:45 +0800 Subject: [PATCH] chore: merge master to clean-rocksdb for synchronization (#2383) --- .github/configs/settings.xml | 60 ++ .github/outdated/.travis.yml | 2 +- .github/workflows/check-dependencies.yml | 17 +- .github/workflows/ci.yml | 56 +- .github/workflows/codeql-analysis.yml | 14 +- .github/workflows/licence-checker.yml | 9 +- .licenserc.yaml | 9 +- LICENSE | 1 + README.md | 11 +- .../hugegraph/api/metrics/MetricsAPI.java | 161 ------ .../apache/hugegraph/metrics/MetricsUtil.java | 54 -- .../masterelection/GlobalMasterInfo.java | 66 --- .../traversal/algorithm/OltpTraverser.java | 178 ------ hugegraph-pd/README.md | 5 + Dockerfile => hugegraph-server/Dockerfile | 24 +- hugegraph-server/README.md | 11 + .../hugegraph-api}/pom.xml | 21 +- .../java/org/apache/hugegraph/api/API.java | 3 +- .../hugegraph/api/arthas/ArthasAPI.java | 61 +++ .../apache/hugegraph/api/auth/AccessAPI.java | 0 .../apache/hugegraph/api/auth/BelongAPI.java | 0 .../apache/hugegraph/api/auth/GroupAPI.java | 0 .../apache/hugegraph/api/auth/LoginAPI.java | 56 +- .../apache/hugegraph/api/auth/ProjectAPI.java | 0 .../apache/hugegraph/api/auth/TargetAPI.java | 0 .../apache/hugegraph/api/auth/UserAPI.java | 0 .../hugegraph/api/cypher/CypherAPI.java | 3 + .../hugegraph/api/cypher/CypherClient.java | 0 .../hugegraph/api/cypher/CypherManager.java | 0 .../hugegraph/api/cypher/CypherModel.java | 0 .../hugegraph/api/filter/AccessLogFilter.java | 122 +++++ .../api/filter/AuthenticationFilter.java | 72 ++- .../api/filter/CompressInterceptor.java | 0 .../api/filter/DecompressInterceptor.java | 0 .../hugegraph/api/filter/ExceptionFilter.java | 0 .../api/filter/LoadDetectFilter.java | 0 .../api/filter/LoadReleaseFilter.java | 0 .../hugegraph/api/filter/PathFilter.java | 58 ++ .../hugegraph/api/filter/RedirectFilter.java | 12 +- .../filter/RedirectFilterDynamicFeature.java | 0 .../hugegraph/api/filter/StatusFilter.java | 0 .../apache/hugegraph/api/graph/BatchAPI.java | 0 .../apache/hugegraph/api/graph/EdgeAPI.java | 0 .../apache/hugegraph/api/graph/VertexAPI.java | 0 .../api/gremlin/AbstractJerseyRestClient.java | 158 ++++++ .../hugegraph/api/gremlin/GremlinAPI.java | 1 - .../hugegraph/api/gremlin/GremlinClient.java | 66 ++- .../api/gremlin/GremlinQueryAPI.java | 0 .../hugegraph/api/job/AlgorithmAPI.java | 3 + .../apache/hugegraph/api/job/ComputerAPI.java | 0 .../apache/hugegraph/api/job/GremlinAPI.java | 0 .../apache/hugegraph/api/job/RebuildAPI.java | 0 .../org/apache/hugegraph/api/job/TaskAPI.java | 0 .../hugegraph/api/metrics/MetricsAPI.java | 430 +++++++++++++++ .../hugegraph/api/profile/GraphsAPI.java | 0 .../hugegraph/api/profile/ProfileAPI.java | 0 .../hugegraph/api/profile/VersionAPI.java | 0 .../hugegraph/api/profile/WhiteIpListAPI.java | 161 ++++++ .../apache/hugegraph/api/raft/RaftAPI.java | 0 .../hugegraph/api/schema/EdgeLabelAPI.java | 0 .../hugegraph/api/schema/IndexLabelAPI.java | 0 .../hugegraph/api/schema/PropertyKeyAPI.java | 0 .../hugegraph/api/schema/SchemaAPI.java | 0 .../hugegraph/api/schema/VertexLabelAPI.java | 0 .../api/traversers/AdamicAdarAPI.java | 0 .../api/traversers/AllShortestPathsAPI.java | 0 .../hugegraph/api/traversers/CountAPI.java | 0 .../api/traversers/CrosspointsAPI.java | 0 .../traversers/CustomizedCrosspointsAPI.java | 0 .../api/traversers/CustomizedPathsAPI.java | 0 .../api/traversers/EdgeExistenceAPI.java | 85 +++ .../hugegraph/api/traversers/EdgesAPI.java | 0 .../api/traversers/FusiformSimilarityAPI.java | 0 .../api/traversers/JaccardSimilarityAPI.java | 0 .../api/traversers/KneighborAPI.java | 0 .../hugegraph/api/traversers/KoutAPI.java | 0 .../traversers/MultiNodeShortestPathAPI.java | 0 .../api/traversers/NeighborRankAPI.java | 0 .../hugegraph/api/traversers/PathsAPI.java | 0 .../api/traversers/PersonalRankAPI.java | 0 .../hugegraph/api/traversers/RaysAPI.java | 0 .../api/traversers/ResourceAllocationAPI.java | 0 .../hugegraph/api/traversers/RingsAPI.java | 0 .../api/traversers/SameNeighborsAPI.java | 0 .../api/traversers/ShortestPathAPI.java | 0 .../SingleSourceShortestPathAPI.java | 0 .../api/traversers/TemplatePathsAPI.java | 0 .../api/traversers/TraverserAPI.java | 0 .../hugegraph/api/traversers/Vertices.java | 0 .../hugegraph/api/traversers/VerticesAPI.java | 0 .../traversers/WeightedShortestPathAPI.java | 0 .../hugegraph/api/variables/VariablesAPI.java | 0 .../hugegraph/auth/ConfigAuthenticator.java | 0 .../hugegraph/auth/ContextGremlinServer.java | 0 .../hugegraph/auth/HugeAuthenticator.java | 0 .../hugegraph/auth/HugeFactoryAuthProxy.java | 0 .../hugegraph/auth/HugeGraphAuthProxy.java | 30 +- .../hugegraph/auth/StandardAuthenticator.java | 0 .../auth/WsAndHttpBasicAuthHandler.java | 0 .../hugegraph/config/ServerOptions.java | 51 +- .../apache/hugegraph/core/GraphManager.java | 94 ++-- .../apache/hugegraph/define/Checkable.java | 0 .../hugegraph/define/UpdateStrategy.java | 0 .../org/apache/hugegraph/define/WorkLoad.java | 0 .../apache/hugegraph/metrics/MetricsKeys.java | 40 ++ .../hugegraph/metrics/MetricsModule.java | 0 .../apache/hugegraph/metrics/MetricsUtil.java | 215 ++++++++ .../hugegraph/metrics/ServerReporter.java | 0 .../hugegraph/metrics/SlowQueryLog.java | 53 ++ .../hugegraph/metrics/SystemMetrics.java | 0 .../opencypher/CypherOpProcessor.java | 0 .../hugegraph/opencypher/CypherPlugin.java | 0 .../rpc/RpcClientProviderWithAuth.java | 0 .../hugegraph/serializer/JsonSerializer.java | 0 .../hugegraph/serializer/Serializer.java | 0 .../hugegraph/server/ApplicationConfig.java | 16 +- .../apache/hugegraph/server/RestServer.java | 0 .../apache/hugegraph/version/ApiVersion.java | 22 +- ...che.tinkerpop.gremlin.jsr223.GremlinPlugin | 0 ...pache.tinkerpop.gremlin.server.OpProcessor | 0 .../hugegraph-cassandra}/pom.xml | 4 +- .../driver/core/querybuilder/Clauses.java | 0 .../cassandra/CassandraBackendEntry.java | 0 .../cassandra/CassandraEntryIterator.java | 0 .../store/cassandra/CassandraFeatures.java | 0 .../store/cassandra/CassandraMetrics.java | 12 +- .../store/cassandra/CassandraOptions.java | 0 .../store/cassandra/CassandraSerializer.java | 0 .../store/cassandra/CassandraSessionPool.java | 0 .../store/cassandra/CassandraShard.java | 4 +- .../store/cassandra/CassandraStore.java | 0 .../cassandra/CassandraStoreProvider.java | 0 .../store/cassandra/CassandraTable.java | 0 .../store/cassandra/CassandraTables.java | 0 .../hugegraph-core}/pom.xml | 30 +- .../org/apache/hugegraph/HugeException.java | 0 .../org/apache/hugegraph/HugeFactory.java | 0 .../java/org/apache/hugegraph/HugeGraph.java | 8 +- .../org/apache/hugegraph/HugeGraphParams.java | 0 .../apache/hugegraph/StandardHugeGraph.java | 44 +- .../apache/hugegraph/analyzer/Analyzer.java | 0 .../hugegraph/analyzer/AnalyzerFactory.java | 0 .../hugegraph/analyzer/AnsjAnalyzer.java | 0 .../hugegraph/analyzer/HanLPAnalyzer.java | 0 .../apache/hugegraph/analyzer/IKAnalyzer.java | 0 .../hugegraph/analyzer/JcsegAnalyzer.java | 0 .../hugegraph/analyzer/JiebaAnalyzer.java | 0 .../hugegraph/analyzer/MMSeg4JAnalyzer.java | 0 .../hugegraph/analyzer/SmartCNAnalyzer.java | 0 .../apache/hugegraph/auth/AuthConstant.java | 0 .../apache/hugegraph/auth/AuthManager.java | 8 + .../apache/hugegraph/auth/EntityManager.java | 0 .../org/apache/hugegraph/auth/HugeAccess.java | 0 .../org/apache/hugegraph/auth/HugeBelong.java | 0 .../org/apache/hugegraph/auth/HugeGroup.java | 0 .../apache/hugegraph/auth/HugePermission.java | 0 .../apache/hugegraph/auth/HugeProject.java | 0 .../apache/hugegraph/auth/HugeResource.java | 0 .../org/apache/hugegraph/auth/HugeTarget.java | 0 .../org/apache/hugegraph/auth/HugeUser.java | 0 .../hugegraph/auth/RelationshipManager.java | 0 .../apache/hugegraph/auth/ResourceObject.java | 0 .../apache/hugegraph/auth/ResourceType.java | 0 .../apache/hugegraph/auth/RolePermission.java | 0 .../apache/hugegraph/auth/SchemaDefine.java | 0 .../hugegraph/auth/StandardAuthManager.java | 45 +- .../apache/hugegraph/auth/TokenGenerator.java | 0 .../apache/hugegraph/auth/UserWithRole.java | 0 .../hugegraph/backend/BackendException.java | 0 .../hugegraph/backend/LocalCounter.java | 0 .../apache/hugegraph/backend/Transaction.java | 0 .../backend/cache/AbstractCache.java | 0 .../apache/hugegraph/backend/cache/Cache.java | 0 .../hugegraph/backend/cache/CacheManager.java | 0 .../backend/cache/CacheNotifier.java | 0 .../backend/cache/CachedBackendStore.java | 0 .../backend/cache/CachedGraphTransaction.java | 0 .../cache/CachedSchemaTransaction.java | 0 .../hugegraph/backend/cache/LevelCache.java | 0 .../hugegraph/backend/cache/OffheapCache.java | 0 .../hugegraph/backend/cache/RamCache.java | 0 .../apache/hugegraph/backend/id/EdgeId.java | 0 .../org/apache/hugegraph/backend/id/Id.java | 0 .../hugegraph/backend/id/IdGenerator.java | 0 .../apache/hugegraph/backend/id/IdUtil.java | 0 .../backend/id/SnowflakeIdGenerator.java | 0 .../backend/id/SplicingIdGenerator.java | 0 .../hugegraph/backend/page/IdHolder.java | 0 .../hugegraph/backend/page/IdHolderList.java | 0 .../backend/page/PageEntryIterator.java | 0 .../hugegraph/backend/page/PageIds.java | 0 .../hugegraph/backend/page/PageInfo.java | 0 .../hugegraph/backend/page/PageState.java | 0 .../hugegraph/backend/page/QueryList.java | 0 .../backend/page/SortByCountIdHolderList.java | 0 .../hugegraph/backend/query/Aggregate.java | 0 .../backend/query/BatchConditionQuery.java | 0 .../hugegraph/backend/query/Condition.java | 0 .../backend/query/ConditionQuery.java | 0 .../backend/query/ConditionQueryFlatten.java | 0 .../backend/query/EdgesQueryIterator.java | 64 +++ .../backend/query/IdPrefixQuery.java | 0 .../hugegraph/backend/query/IdQuery.java | 0 .../hugegraph/backend/query/IdRangeQuery.java | 0 .../apache/hugegraph/backend/query/Query.java | 0 .../hugegraph/backend/query/QueryResults.java | 0 .../serializer/AbstractSerializer.java | 0 .../serializer/BinaryBackendEntry.java | 0 .../serializer/BinaryEntryIterator.java | 0 .../serializer/BinaryScatterSerializer.java | 0 .../backend/serializer/BinarySerializer.java | 0 .../backend/serializer/BytesBuffer.java | 0 .../backend/serializer/GraphSerializer.java | 0 .../backend/serializer/MergeIterator.java | 0 .../backend/serializer/SchemaSerializer.java | 0 .../backend/serializer/SerializerFactory.java | 0 .../backend/serializer/TableBackendEntry.java | 0 .../backend/serializer/TableSerializer.java | 0 .../backend/serializer/TextBackendEntry.java | 0 .../backend/serializer/TextSerializer.java | 0 .../backend/store/AbstractBackendStore.java | 0 .../store/AbstractBackendStoreProvider.java | 0 .../backend/store/BackendAction.java | 0 .../hugegraph/backend/store/BackendEntry.java | 0 .../backend/store/BackendEntryIterator.java | 0 .../backend/store/BackendFeatures.java | 0 .../backend/store/BackendMetrics.java | 0 .../backend/store/BackendMutation.java | 0 .../backend/store/BackendProviderFactory.java | 0 .../backend/store/BackendSession.java | 0 .../backend/store/BackendSessionPool.java | 0 .../hugegraph/backend/store/BackendStore.java | 0 .../backend/store/BackendStoreInfo.java | 0 .../backend/store/BackendStoreProvider.java | 0 .../hugegraph/backend/store/BackendTable.java | 0 .../backend/store/MetaDispatcher.java | 0 .../hugegraph/backend/store/MetaHandler.java | 0 .../apache/hugegraph/backend/store/Shard.java | 0 .../backend/store/SystemSchemaStore.java | 0 .../hugegraph/backend/store/TableDefine.java | 0 .../backend/store/memory/InMemoryDBStore.java | 0 .../store/memory/InMemoryDBStoreProvider.java | 0 .../backend/store/memory/InMemoryDBTable.java | 0 .../store/memory/InMemoryDBTables.java | 0 .../backend/store/memory/InMemoryMetrics.java | 0 .../backend/store/raft/RaftAddPeerJob.java | 0 .../backend/store/raft/RaftBackendStore.java | 0 .../store/raft/RaftBackendStoreProvider.java | 0 .../backend/store/raft/RaftClosure.java | 0 .../backend/store/raft/RaftContext.java | 0 .../backend/store/raft/RaftException.java | 0 .../backend/store/raft/RaftGroupManager.java | 0 .../store/raft/RaftGroupManagerImpl.java | 0 .../backend/store/raft/RaftNode.java | 0 .../backend/store/raft/RaftRemovePeerJob.java | 0 .../backend/store/raft/RaftResult.java | 0 .../backend/store/raft/RaftStoreClosure.java | 0 .../backend/store/raft/StoreCommand.java | 0 .../backend/store/raft/StoreSerializer.java | 0 .../backend/store/raft/StoreSnapshotFile.java | 0 .../backend/store/raft/StoreStateMachine.java | 0 .../store/raft/compress/CompressStrategy.java | 0 .../compress/CompressStrategyManager.java | 0 .../compress/ParallelCompressStrategy.java | 0 .../raft/compress/SerialCompressStrategy.java | 0 .../store/raft/rpc/AddPeerProcessor.java | 0 .../store/raft/rpc/ListPeersProcessor.java | 0 .../store/raft/rpc/RemovePeerProcessor.java | 0 .../backend/store/raft/rpc/RpcForwarder.java | 0 .../store/raft/rpc/SetLeaderProcessor.java | 0 .../store/raft/rpc/StoreCommandProcessor.java | 0 .../backend/store/ram/IntIntMap.java | 0 .../backend/store/ram/IntLongMap.java | 0 .../backend/store/ram/IntObjectMap.java | 9 +- .../hugegraph/backend/store/ram/RamMap.java | 0 .../hugegraph/backend/store/ram/RamTable.java | 0 .../backend/tx/AbstractTransaction.java | 0 .../backend/tx/GraphIndexTransaction.java | 0 .../backend/tx/GraphTransaction.java | 6 +- .../backend/tx/IndexableTransaction.java | 0 .../backend/tx/SchemaIndexTransaction.java | 0 .../backend/tx/SchemaTransaction.java | 0 .../apache/hugegraph/config/AuthOptions.java | 0 .../apache/hugegraph/config/CoreOptions.java | 0 .../exception/ConnectionException.java | 0 .../hugegraph/exception/ExistedException.java | 0 .../exception/HugeGremlinException.java | 0 .../exception/LimitExceedException.java | 0 .../hugegraph/exception/NoIndexException.java | 0 .../exception/NotAllowException.java | 0 .../exception/NotFoundException.java | 0 .../exception/NotSupportException.java | 0 .../io/GraphSONSchemaSerializer.java | 0 .../hugegraph/io/HugeGraphIoRegistry.java | 0 .../hugegraph/io/HugeGraphSONModule.java | 0 .../apache/hugegraph/io/HugeGryoModule.java | 0 .../apache/hugegraph/job/AlgorithmJob.java | 0 .../org/apache/hugegraph/job/ComputerJob.java | 0 .../apache/hugegraph/job/EphemeralJob.java | 0 .../hugegraph/job/EphemeralJobBuilder.java | 0 .../org/apache/hugegraph/job/GremlinJob.java | 0 .../java/org/apache/hugegraph/job/Job.java | 0 .../org/apache/hugegraph/job/JobBuilder.java | 0 .../java/org/apache/hugegraph/job/SysJob.java | 0 .../org/apache/hugegraph/job/UserJob.java | 0 .../job/algorithm/AbstractAlgorithm.java | 0 .../hugegraph/job/algorithm/Algorithm.java | 0 .../job/algorithm/AlgorithmPool.java | 0 .../hugegraph/job/algorithm/BfsTraverser.java | 0 .../hugegraph/job/algorithm/Consumers.java | 0 .../job/algorithm/CountEdgeAlgorithm.java | 0 .../job/algorithm/CountVertexAlgorithm.java | 0 .../job/algorithm/SubgraphStatAlgorithm.java | 0 .../algorithm/cent/AbstractCentAlgorithm.java | 0 .../cent/BetweennessCentralityAlgorithm.java | 0 .../BetweennessCentralityAlgorithmV2.java | 0 .../cent/ClosenessCentralityAlgorithm.java | 0 .../cent/ClosenessCentralityAlgorithmV2.java | 0 .../cent/DegreeCentralityAlgorithm.java | 0 .../cent/EigenvectorCentralityAlgorithm.java | 0 .../cent/StressCentralityAlgorithm.java | 0 .../cent/StressCentralityAlgorithmV2.java | 0 .../algorithm/comm/AbstractCommAlgorithm.java | 0 .../comm/ClusterCoefficientAlgorithm.java | 0 .../job/algorithm/comm/KCoreAlgorithm.java | 0 .../job/algorithm/comm/LouvainAlgorithm.java | 0 .../job/algorithm/comm/LouvainTraverser.java | 0 .../job/algorithm/comm/LpaAlgorithm.java | 0 .../comm/TriangleCountAlgorithm.java | 0 .../comm/WeakConnectedComponent.java | 0 .../algorithm/path/RingsDetectAlgorithm.java | 0 .../job/algorithm/rank/PageRankAlgorithm.java | 0 .../FusiformSimilarityAlgorithm.java | 0 .../job/computer/AbstractComputer.java | 8 +- .../hugegraph/job/computer/Computer.java | 0 .../hugegraph/job/computer/ComputerPool.java | 0 .../job/computer/LouvainComputer.java | 0 .../hugegraph/job/computer/LpaComputer.java | 0 .../job/computer/PageRankComputer.java | 0 .../job/computer/TriangleCountComputer.java | 0 .../WeakConnectedComponentComputer.java | 0 .../job/schema/EdgeLabelRemoveJob.java | 0 .../job/schema/IndexLabelRebuildJob.java | 0 .../job/schema/IndexLabelRemoveJob.java | 0 .../job/schema/OlapPropertyKeyClearJob.java | 0 .../job/schema/OlapPropertyKeyCreateJob.java | 0 .../job/schema/OlapPropertyKeyRemoveJob.java | 0 .../hugegraph/job/schema/SchemaJob.java | 0 .../job/schema/VertexLabelRemoveJob.java | 0 .../job/system/DeleteExpiredElementJob.java | 0 .../job/system/DeleteExpiredIndexJob.java | 0 .../job/system/DeleteExpiredJob.java | 0 .../hugegraph/job/system/JobCounters.java | 0 .../hugegraph/masterelection/ClusterRole.java | 0 .../masterelection/ClusterRoleStore.java | 0 .../hugegraph/masterelection/Config.java | 0 .../masterelection/GlobalMasterInfo.java | 119 ++++ .../masterelection/RoleElectionConfig.java | 0 .../masterelection/RoleElectionOptions.java | 0 .../RoleElectionStateMachine.java | 2 +- .../masterelection/RoleListener.java | 2 +- .../StandardClusterRoleStore.java | 0 .../StandardRoleElectionStateMachine.java | 53 +- .../masterelection/StandardRoleListener.java | 63 ++- .../masterelection/StateMachineContext.java | 2 +- .../plugin/HugeGraphGremlinPlugin.java | 0 .../hugegraph/plugin/HugeGraphPlugin.java | 0 .../rpc/RpcServiceConfig4Client.java | 0 .../rpc/RpcServiceConfig4Server.java | 0 .../apache/hugegraph/schema/EdgeLabel.java | 0 .../apache/hugegraph/schema/IndexLabel.java | 0 .../apache/hugegraph/schema/PropertyKey.java | 0 .../hugegraph/schema/SchemaElement.java | 0 .../apache/hugegraph/schema/SchemaLabel.java | 0 .../hugegraph/schema/SchemaManager.java | 0 .../org/apache/hugegraph/schema/Userdata.java | 0 .../apache/hugegraph/schema/VertexLabel.java | 0 .../schema/builder/AbstractBuilder.java | 0 .../schema/builder/EdgeLabelBuilder.java | 0 .../schema/builder/IndexLabelBuilder.java | 0 .../schema/builder/PropertyKeyBuilder.java | 0 .../schema/builder/SchemaBuilder.java | 0 .../schema/builder/VertexLabelBuilder.java | 0 .../security/HugeSecurityManager.java | 0 .../apache/hugegraph/structure/GraphType.java | 0 .../apache/hugegraph/structure/HugeEdge.java | 0 .../hugegraph/structure/HugeEdgeProperty.java | 7 +- .../hugegraph/structure/HugeElement.java | 0 .../hugegraph/structure/HugeFeatures.java | 0 .../apache/hugegraph/structure/HugeIndex.java | 0 .../hugegraph/structure/HugeProperty.java | 0 .../hugegraph/structure/HugeVertex.java | 0 .../structure/HugeVertexProperty.java | 0 .../hugegraph/task/EphemeralJobQueue.java | 0 .../apache/hugegraph/task/HugeServerInfo.java | 0 .../org/apache/hugegraph/task/HugeTask.java | 0 .../hugegraph/task/ServerInfoManager.java | 151 +++--- .../hugegraph/task/StandardTaskScheduler.java | 49 +- .../apache/hugegraph/task/TaskCallable.java | 0 .../apache/hugegraph/task/TaskManager.java | 73 +-- .../apache/hugegraph/task/TaskScheduler.java | 0 .../org/apache/hugegraph/task/TaskStatus.java | 0 .../algorithm/CollectionPathsTraverser.java | 0 .../traversal/algorithm/CountTraverser.java | 0 .../algorithm/CustomizePathsTraverser.java | 0 .../CustomizedCrosspointsTraverser.java | 0 .../algorithm/EdgeExistenceTraverser.java | 65 +++ .../FusiformSimilarityTraverser.java | 0 .../traversal/algorithm/HugeTraverser.java | 45 ++ .../algorithm/JaccardSimilarTraverser.java | 0 .../algorithm/KneighborTraverser.java | 56 +- .../traversal/algorithm/KoutTraverser.java | 76 +-- .../MultiNodeShortestPathTraverser.java | 0 .../algorithm/NeighborRankTraverser.java | 0 .../traversal/algorithm/OltpTraverser.java | 381 +++++++++++++ .../traversal/algorithm/PathTraverser.java | 0 .../traversal/algorithm/PathsTraverser.java | 0 .../algorithm/PersonalRankTraverser.java | 0 .../algorithm/PredictionTraverser.java | 0 .../algorithm/SameNeighborTraverser.java | 0 .../algorithm/ShortestPathTraverser.java | 0 .../SingleSourceShortestPathTraverser.java | 0 .../algorithm/SubGraphTraverser.java | 0 .../algorithm/TemplatePathsTraverser.java | 0 .../algorithm/iterator/NestedIterator.java | 0 .../algorithm/records/AbstractRecords.java | 0 .../records/DoubleWayMultiPathsRecords.java | 0 .../algorithm/records/KneighborRecords.java | 14 +- .../algorithm/records/KoutRecords.java | 0 .../algorithm/records/PathsRecords.java | 0 .../traversal/algorithm/records/Records.java | 0 .../records/ShortestPathRecords.java | 0 .../records/SingleWayMultiPathsRecords.java | 0 .../records/record/Int2ArrayRecord.java | 0 .../records/record/Int2IntRecord.java | 0 .../records/record/Int2SetRecord.java | 0 .../algorithm/records/record/Record.java | 0 .../records/record/RecordFactory.java | 0 .../algorithm/records/record/RecordType.java | 0 .../algorithm/records/record/SyncRecord.java | 0 .../traversal/algorithm/steps/EdgeStep.java | 0 .../algorithm/steps/RepeatEdgeStep.java | 0 .../traversal/algorithm/steps/Steps.java | 4 + .../algorithm/steps/WeightedEdgeStep.java | 0 .../strategy/ConcurrentTraverseStrategy.java | 0 .../strategy/SingleTraverseStrategy.java | 0 .../algorithm/strategy/TraverseStrategy.java | 0 .../traversal/optimize/ConditionP.java | 0 .../traversal/optimize/HugeCountStep.java | 0 .../optimize/HugeCountStepStrategy.java | 0 .../traversal/optimize/HugeGraphStep.java | 0 .../optimize/HugeGraphStepStrategy.java | 0 .../optimize/HugePrimaryKeyStrategy.java | 22 +- .../optimize/HugeScriptTraversal.java | 0 .../traversal/optimize/HugeVertexStep.java | 0 .../optimize/HugeVertexStepByBatch.java | 0 .../optimize/HugeVertexStepStrategy.java | 0 .../traversal/optimize/QueryHolder.java | 0 .../hugegraph/traversal/optimize/Text.java | 0 .../traversal/optimize/TraversalUtil.java | 0 .../org/apache/hugegraph/type/HugeType.java | 0 .../org/apache/hugegraph/type/Idfiable.java | 0 .../org/apache/hugegraph/type/Indexable.java | 0 .../org/apache/hugegraph/type/Nameable.java | 0 .../apache/hugegraph/type/Propertiable.java | 0 .../org/apache/hugegraph/type/Typeable.java | 0 .../apache/hugegraph/type/define/Action.java | 0 .../hugegraph/type/define/AggregateType.java | 0 .../hugegraph/type/define/Cardinality.java | 0 .../hugegraph/type/define/CollectionType.java | 1 + .../hugegraph/type/define/DataType.java | 0 .../hugegraph/type/define/Directions.java | 0 .../hugegraph/type/define/Frequency.java | 0 .../hugegraph/type/define/GraphMode.java | 0 .../hugegraph/type/define/GraphReadMode.java | 0 .../hugegraph/type/define/HugeKeys.java | 0 .../hugegraph/type/define/IdStrategy.java | 0 .../hugegraph/type/define/IndexType.java | 0 .../hugegraph/type/define/NodeRole.java | 0 .../hugegraph/type/define/SchemaStatus.java | 0 .../hugegraph/type/define/SerialEnum.java | 0 .../hugegraph/type/define/WriteType.java | 0 .../java/org/apache/hugegraph/util/Blob.java | 0 .../apache/hugegraph/util/CompressUtil.java | 0 .../org/apache/hugegraph/util/ConfigUtil.java | 0 .../org/apache/hugegraph/util/Consumers.java | 128 +++-- .../org/apache/hugegraph/util/CopyUtil.java | 0 .../org/apache/hugegraph/util/Events.java | 0 .../util/FixedTimerWindowRateLimiter.java | 0 .../util/FixedWatchWindowRateLimiter.java | 0 .../org/apache/hugegraph/util/GZipUtil.java | 0 .../org/apache/hugegraph/util/JsonUtil.java | 0 .../org/apache/hugegraph/util/KryoUtil.java | 0 .../org/apache/hugegraph/util/LZ4Util.java | 0 .../org/apache/hugegraph/util/LockUtil.java | 0 .../apache/hugegraph/util/ParameterUtil.java | 0 .../apache/hugegraph/util/RateLimiter.java | 0 .../org/apache/hugegraph/util/Reflection.java | 0 .../apache/hugegraph/util/StringEncoding.java | 0 .../util/collection/CollectionFactory.java | 0 .../hugegraph/util/collection/IdSet.java | 0 .../util/collection/Int2IntsMap.java | 0 .../util/collection/IntIterator.java | 0 .../hugegraph/util/collection/IntMap.java | 0 .../hugegraph/util/collection/IntSet.java | 0 .../util/collection/ObjectIntMapping.java | 0 .../collection/ObjectIntMappingFactory.java | 0 .../hugegraph/variables/HugeVariables.java | 0 .../apache/hugegraph/version/CoreVersion.java | 24 +- ...che.tinkerpop.gremlin.jsr223.GremlinPlugin | 0 .../src/main/resources/hugegraph.properties | 0 .../src/main/resources/proto/raft.proto | 0 .../hugegraph-dist}/README.md | 6 +- .../hugegraph-dist}/dist.sh | 0 .../docker/docker-entrypoint.sh | 24 + .../example/docker-compose-cassandra.yml | 61 +++ .../docker/scripts/detect-storage.groovy | 31 ++ .../docker/scripts/remote-connect.groovy | 19 + .../hugegraph-dist}/pom.xml | 18 +- .../hugegraph-dist}/release-docs/LICENSE | 3 +- .../hugegraph-dist}/release-docs/NOTICE | 38 ++ .../licenses/LICENSE-HdrHistogram.txt | 0 .../release-docs/licenses/LICENSE-ST4.txt | 0 .../licenses/LICENSE-arthas-agent-attach.txt | 0 .../licenses/LICENSE-arthas-packaging.txt | 0 .../licenses/LICENSE-audience-annotations.txt | 0 .../LICENSE-byte-buddy-agent-1.11.6.txt | 0 .../licenses/LICENSE-byte-buddy-agent.txt | 176 ++++++ .../licenses/LICENSE-byte-buddy.txt | 0 .../licenses/LICENSE-cassandra-all.txt | 0 .../licenses/LICENSE-commons-beanutils.txt | 0 .../licenses/LICENSE-commons-cli.txt | 0 .../licenses/LICENSE-commons-codec.txt | 0 .../licenses/LICENSE-commons-collections.txt | 0 .../licenses/LICENSE-commons-compress.txt | 0 .../LICENSE-commons-configuration.txt | 0 .../LICENSE-commons-configuration2.txt | 0 .../licenses/LICENSE-commons-io.txt | 0 .../licenses/LICENSE-commons-lang.txt | 0 .../licenses/LICENSE-commons-lang3.txt | 0 .../licenses/LICENSE-commons-logging.txt | 0 .../licenses/LICENSE-commons-math3.txt | 0 .../licenses/LICENSE-commons-text.txt | 0 .../licenses/LICENSE-compress-lzf.txt | 0 .../licenses/LICENSE-concurrent-trees.txt | 0 .../LICENSE-concurrentlinkedhashmap-lru.txt | 0 .../licenses/LICENSE-disruptor.txt | 0 .../licenses/LICENSE-error-prone.txt | 0 .../release-docs/licenses/LICENSE-exp4j.txt | 0 .../licenses/LICENSE-expressions-9.0.txt | 0 .../licenses/LICENSE-fastutil.txt | 0 .../licenses/LICENSE-findbugs-annotations.txt | 0 .../licenses/LICENSE-front-end.txt | 0 .../licenses/LICENSE-gremlin-console.txt | 0 .../licenses/LICENSE-gremlin-core.txt | 0 .../licenses/LICENSE-gremlin-driver.txt | 0 .../licenses/LICENSE-gremlin-groovy.txt | 0 .../licenses/LICENSE-gremlin-server.txt | 0 .../licenses/LICENSE-gremlin-shaded.txt | 0 .../licenses/LICENSE-gremlin-test.txt | 0 .../licenses/LICENSE-groovy-2.5.14.txt | 0 .../licenses/LICENSE-groovy-cli-picocli.txt | 0 .../licenses/LICENSE-groovy-console.txt | 0 .../licenses/LICENSE-groovy-groovysh.txt | 0 .../licenses/LICENSE-groovy-json.txt | 0 .../licenses/LICENSE-groovy-jsr223.txt | 0 .../licenses/LICENSE-groovy-swing.txt | 0 .../licenses/LICENSE-groovy-templates.txt | 0 .../licenses/LICENSE-groovy-xml.txt | 0 .../licenses/LICENSE-hamcrest.txt | 0 .../LICENSE-hbase-shaded-endpoint.txt | 0 .../release-docs/licenses/LICENSE-hppc.txt | 0 .../licenses/LICENSE-htrace-core4-4.2.0.txt | 0 .../licenses/LICENSE-httpclient.txt | 0 .../licenses/LICENSE-httpcore.txt | 0 .../licenses/LICENSE-ikanalyzer-2012_u6.txt | 0 .../release-docs/licenses/LICENSE-ivy.txt | 0 .../licenses/LICENSE-jackson-annotations.txt | 0 .../licenses/LICENSE-jackson-core.txt | 0 .../licenses/LICENSE-jackson-databind.txt | 0 .../LICENSE-jackson-dataformat-yaml.txt | 0 .../LICENSE-jackson-datatype-jsr310.txt | 0 .../licenses/LICENSE-jackson-jaxrs-base.txt | 0 ...NSE-jackson-jaxrs-json-provider-2.12.1.txt | 0 .../LICENSE-jackson-jaxrs-json-provider.txt | 0 ...ICENSE-jackson-module-jaxb-annotations.txt | 0 .../licenses/LICENSE-javax.json.txt | 0 .../licenses/LICENSE-jcabi-log.txt | 0 .../licenses/LICENSE-jcabi-manifests.txt | 0 .../licenses/LICENSE-jcl-over-slf4j.txt | 0 .../licenses/LICENSE-jersey-client.txt | 0 .../release-docs/licenses/LICENSE-jflex.txt | 0 .../licenses/LICENSE-jieba-analysis.txt | 0 .../release-docs/licenses/LICENSE-jna.txt | 0 .../licenses/LICENSE-json-simple.txt | 0 .../licenses/LICENSE-json-smart.txt | 0 .../licenses/LICENSE-kerb-admin.txt | 0 .../licenses/LICENSE-kerb-client.txt | 0 .../licenses/LICENSE-kerb-common.txt | 0 .../licenses/LICENSE-kerb-core.txt | 0 .../licenses/LICENSE-kerb-crypto.txt | 0 .../licenses/LICENSE-kerb-identity.txt | 0 .../licenses/LICENSE-kerb-server.txt | 0 .../licenses/LICENSE-kerb-simplekdc.txt | 0 .../licenses/LICENSE-kerb-util.txt | 0 .../licenses/LICENSE-kerby-asn1.txt | 0 .../licenses/LICENSE-kerby-config.txt | 0 .../licenses/LICENSE-kerby-pkix.txt | 0 .../licenses/LICENSE-kerby-util.txt | 0 .../licenses/LICENSE-kerby-xdr.txt | 0 .../licenses/LICENSE-log4j-api.txt | 0 .../licenses/LICENSE-log4j-core.txt | 0 .../licenses/LICENSE-log4j-slf4j-impl.txt | 0 .../licenses/LICENSE-objenesis.txt | 0 .../licenses/LICENSE-ohc-core.txt | 0 .../licenses/LICENSE-opencypher-ast-9.0.txt | 0 .../licenses/LICENSE-parboiled-core.txt | 0 .../licenses/LICENSE-parboiled-scala_2.12.txt | 0 .../licenses/LICENSE-parser-9.0.txt | 0 .../licenses/LICENSE-postgresql.txt | 0 .../licenses/LICENSE-rewriting-9.0.txt | 0 .../licenses/LICENSE-rocksdbjni.txt | 0 .../release-docs/licenses/LICENSE-sigar.txt | 0 .../licenses/LICENSE-snakeyaml.txt | 0 .../licenses/LICENSE-snowball-stemmer.txt | 0 .../licenses/LICENSE-swagger-annotations.txt | 0 .../licenses/LICENSE-swagger-models.txt | 0 .../licenses/LICENSE-tinkergraph-gremlin.txt | 202 +++++++ .../licenses/LICENSE-token-provider.txt | 202 +++++++ .../licenses/LICENSE-tracer-core.txt | 0 .../licenses/LICENSE-util-9.0.txt | 0 .../release-docs/licenses/LICENSE-zt-zip.txt | 202 +++++++ .../licenses/LINCENSE-jopt-simple.txt | 0 .../hugegraph-dist}/scripts/apache-release.sh | 2 +- .../scripts/dependency/check_dependencies.sh | 17 +- .../scripts/dependency/known-dependencies.txt | 116 ++-- .../regenerate_known_dependencies.sh | 0 .../src/assembly/descriptor/assembly.xml | 2 +- .../src/assembly/jenkins/build.sh | 0 .../src/assembly/jenkins/config.sh | 0 .../src/assembly/jenkins/deploy.sh | 0 .../src/assembly/jenkins/jenkins.sh | 2 +- .../src/assembly/jenkins/publish.sh | 0 .../src/assembly/jenkins/test.sh | 0 .../src/assembly/static/bin/checksocket.sh | 0 .../assembly/static/bin/docker-entrypoint.sh | 24 + .../src/assembly/static/bin/dump-conf.sh | 0 .../src/assembly/static/bin/dump-store.sh | 0 .../assembly/static/bin/gremlin-console.sh | 10 +- .../src/assembly/static/bin/hugegraph | 0 .../assembly/static/bin/hugegraph-server.sh | 0 .../src/assembly/static/bin/hugegraph.service | 0 .../src/assembly/static/bin/init-store.sh | 0 .../src/assembly/static/bin/install.sh | 0 .../assembly/static/bin/monitor-hugegraph.sh | 0 .../src/assembly/static/bin/raft-tools.sh | 8 +- .../assembly/static/bin/start-hugegraph.sh | 0 .../src/assembly/static/bin/start-monitor.sh | 0 .../src/assembly/static/bin/stop-hugegraph.sh | 0 .../src/assembly/static/bin/stop-monitor.sh | 0 .../src/assembly/static/bin/util.sh | 2 +- .../src/assembly/static/bin/wait-storage.sh | 56 ++ .../src/assembly/static/conf/computer.yaml | 0 .../static/conf/graphs/hugegraph.properties | 0 .../static/conf/gremlin-driver-settings.yaml | 0 .../assembly/static/conf/gremlin-server.yaml | 3 +- .../src/assembly/static/conf/log4j2.xml | 27 + .../assembly/static/conf/remote-objects.yaml | 0 .../src/assembly/static/conf/remote.yaml | 0 .../static/conf/rest-server.properties | 9 + .../src/assembly/static/ext/README.txt | 0 .../src/assembly/static/ext/plugins.txt | 0 .../static/scripts/empty-sample.groovy | 0 .../assembly/static/scripts/example.groovy | 0 .../src/assembly/travis/build-report.sh | 2 +- .../conf-raft1/graphs/hugegraph.properties | 0 .../travis/conf-raft1/gremlin-server.yaml | 6 +- .../travis/conf-raft1/rest-server.properties | 0 .../conf-raft2/graphs/hugegraph.properties | 0 .../travis/conf-raft2/gremlin-server.yaml | 6 +- .../travis/conf-raft2/rest-server.properties | 0 .../conf-raft3/graphs/hugegraph.properties | 0 .../travis/conf-raft3/gremlin-server.yaml | 6 +- .../travis/conf-raft3/rest-server.properties | 0 .../src/assembly/travis/hbase-site.xml | 0 .../src/assembly/travis/install-backend.sh | 2 + .../src/assembly/travis/install-cassandra.sh | 3 +- .../src/assembly/travis/install-hbase.sh | 2 +- .../travis/install-mysql-via-docker.sh | 2 +- .../src/assembly/travis/install-mysql.sh | 0 .../travis/install-postgresql-via-docker.sh | 2 +- .../src/assembly/travis/install-postgresql.sh | 2 +- .../src/assembly/travis/install-scylladb.sh | 0 .../src/assembly/travis/maven.xml | 0 .../src/assembly/travis/mysql.cnf | 0 .../assembly/travis/run-api-test-for-raft.sh | 8 +- .../src/assembly/travis/run-api-test.sh | 5 +- .../src/assembly/travis/run-core-test.sh | 2 +- .../src/assembly/travis/run-tinkerpop-test.sh | 4 +- .../src/assembly/travis/run-unit-test.sh | 2 +- .../src/assembly/travis/start-server.sh | 0 .../src/assembly/travis/stop-server.sh | 0 .../org/apache/hugegraph/cmd/ConfDumper.java | 0 .../org/apache/hugegraph/cmd/InitStore.java | 0 .../org/apache/hugegraph/cmd/StoreDumper.java | 0 .../apache/hugegraph/dist/DistOptions.java | 0 .../hugegraph/dist/HugeGraphServer.java | 0 .../hugegraph/dist/HugeGremlinServer.java | 0 .../apache/hugegraph/dist/HugeRestServer.java | 0 .../apache/hugegraph/dist/RegisterUtil.java | 0 .../src/main/resources/backend.properties | 0 .../src/main/resources/log4j2.xml | 28 + .../hugegraph-example}/pom.xml | 2 +- .../apache/hugegraph/example/Example1.java | 0 .../apache/hugegraph/example/Example2.java | 0 .../apache/hugegraph/example/Example3.java | 0 .../apache/hugegraph/example/ExampleUtil.java | 7 +- .../example/GraphOfTheMoviesExample.java | 0 .../hugegraph/example/PerfExample1.java | 0 .../hugegraph/example/PerfExample2.java | 0 .../hugegraph/example/PerfExample3.java | 0 .../hugegraph/example/PerfExample4.java | 0 .../hugegraph/example/PerfExampleBase.java | 96 ++-- .../apache/hugegraph/example/TaskExample.java | 0 .../example/ThreadRangePerfTest.java | 0 .../src/main/resources/hugegraph.properties | 0 .../src/main/resources/log4j2.xml | 0 .../hugegraph-hbase}/pom.xml | 2 +- .../backend/store/hbase/HbaseFeatures.java | 0 .../backend/store/hbase/HbaseMetrics.java | 0 .../backend/store/hbase/HbaseOptions.java | 0 .../backend/store/hbase/HbaseSerializer.java | 0 .../backend/store/hbase/HbaseSessions.java | 11 +- .../backend/store/hbase/HbaseStore.java | 0 .../store/hbase/HbaseStoreProvider.java | 0 .../backend/store/hbase/HbaseTable.java | 0 .../backend/store/hbase/HbaseTables.java | 0 .../hugegraph-mysql}/pom.xml | 2 +- .../store/mysql/MysqlBackendEntry.java | 0 .../store/mysql/MysqlEntryIterator.java | 0 .../backend/store/mysql/MysqlFeatures.java | 0 .../backend/store/mysql/MysqlMetrics.java | 0 .../backend/store/mysql/MysqlOptions.java | 0 .../backend/store/mysql/MysqlSerializer.java | 0 .../backend/store/mysql/MysqlSessions.java | 0 .../backend/store/mysql/MysqlStore.java | 0 .../store/mysql/MysqlStoreProvider.java | 0 .../backend/store/mysql/MysqlTable.java | 0 .../backend/store/mysql/MysqlTables.java | 0 .../backend/store/mysql/MysqlUtil.java | 0 .../backend/store/mysql/ResultSetWrapper.java | 5 +- .../backend/store/mysql/WhereBuilder.java | 0 .../hugegraph-palo}/pom.xml | 2 +- .../backend/store/palo/PaloFeatures.java | 0 .../backend/store/palo/PaloFile.java | 0 .../backend/store/palo/PaloHttpClient.java | 15 +- .../backend/store/palo/PaloLoadInfo.java | 0 .../backend/store/palo/PaloOptions.java | 0 .../backend/store/palo/PaloSerializer.java | 0 .../backend/store/palo/PaloSessions.java | 0 .../backend/store/palo/PaloStore.java | 0 .../backend/store/palo/PaloStoreProvider.java | 0 .../backend/store/palo/PaloTable.java | 0 .../backend/store/palo/PaloTables.java | 0 .../hugegraph-postgresql}/pom.xml | 4 +- .../store/postgresql/PostgresqlOptions.java | 0 .../postgresql/PostgresqlSerializer.java | 0 .../store/postgresql/PostgresqlSessions.java | 0 .../store/postgresql/PostgresqlStore.java | 0 .../postgresql/PostgresqlStoreProvider.java | 0 .../store/postgresql/PostgresqlTable.java | 0 .../store/postgresql/PostgresqlTables.java | 0 .../hugegraph-rocksdb}/pom.xml | 2 +- .../backend/store/rocksdb/OpenedRocksDB.java | 0 .../store/rocksdb/RocksDBFeatures.java | 0 .../store/rocksdb/RocksDBIngester.java | 0 .../store/rocksdb/RocksDBIteratorPool.java | 0 .../backend/store/rocksdb/RocksDBMetrics.java | 0 .../backend/store/rocksdb/RocksDBOptions.java | 0 .../store/rocksdb/RocksDBSessions.java | 0 .../store/rocksdb/RocksDBStdSessions.java | 0 .../backend/store/rocksdb/RocksDBStore.java | 10 +- .../store/rocksdb/RocksDBStoreProvider.java | 0 .../backend/store/rocksdb/RocksDBTable.java | 0 .../backend/store/rocksdb/RocksDBTables.java | 0 .../store/rocksdbsst/RocksDBSstSessions.java | 7 +- .../store/rocksdbsst/RocksDBSstStore.java | 0 .../rocksdbsst/RocksDBSstStoreProvider.java | 0 .../hugegraph-scylladb}/pom.xml | 2 +- .../store/scylladb/ScyllaDBFeatures.java | 0 .../store/scylladb/ScyllaDBMetrics.java | 0 .../store/scylladb/ScyllaDBStoreProvider.java | 0 .../store/scylladb/ScyllaDBTablesWithMV.java | 0 .../hugegraph-test}/pom.xml | 2 +- .../apache/hugegraph/api/ApiTestSuite.java | 6 +- .../apache/hugegraph/api/ArthasApiTest.java | 58 ++ .../org/apache/hugegraph/api/BaseApiTest.java | 32 +- .../apache/hugegraph/api/CypherApiTest.java | 0 .../org/apache/hugegraph/api/EdgeApiTest.java | 24 +- .../hugegraph/api/EdgeLabelApiTest.java | 23 +- .../apache/hugegraph/api/GremlinApiTest.java | 2 +- .../hugegraph/api/IndexLabelApiTest.java | 27 +- .../apache/hugegraph/api/LoginApiTest.java | 33 +- .../apache/hugegraph/api/MetricsApiTest.java | 61 ++- .../apache/hugegraph/api/ProjectApiTest.java | 63 +-- .../hugegraph/api/PropertyKeyApiTest.java | 20 +- .../apache/hugegraph/api/SchemaApiTest.java | 7 +- .../org/apache/hugegraph/api/TaskApiTest.java | 36 +- .../org/apache/hugegraph/api/UserApiTest.java | 26 +- .../apache/hugegraph/api/VertexApiTest.java | 19 +- .../hugegraph/api/VertexLabelApiTest.java | 23 +- .../api/traversers/AdamicAdarAPITest.java | 0 .../traversers/AllShortestPathsApiTest.java | 0 .../api/traversers/CountApiTest.java | 0 .../api/traversers/CrosspointsApiTest.java | 0 .../CustomizedCrosspointsApiTest.java | 0 .../api/traversers/EdgesApiTest.java | 0 .../traversers/FusiformSimilarityApiTest.java | 0 .../traversers/JaccardSimilarityApiTest.java | 0 .../api/traversers/KneighborApiTest.java | 0 .../hugegraph/api/traversers/KoutApiTest.java | 0 .../MultiNodeShortestPathApiTest.java | 0 .../api/traversers/NeighborRankApiTest.java | 0 .../api/traversers/PathsApiTest.java | 0 .../api/traversers/PersonalRankApiTest.java | 0 .../hugegraph/api/traversers/RaysApiTest.java | 11 +- .../traversers/ResourceAllocationAPITest.java | 0 .../api/traversers/RingsApiTest.java | 0 .../api/traversers/SameNeighborsApiTest.java | 14 +- .../api/traversers/ShortestPathApiTest.java | 0 .../SingleSourceShortestPathApiTest.java | 11 +- .../api/traversers/TemplatePathsApiTest.java | 0 .../traversers/TraversersApiTestSuite.java | 0 .../WeightedShortestPathApiTest.java | 0 .../org/apache/hugegraph/core/AuthTest.java | 0 .../apache/hugegraph/core/BaseCoreTest.java | 5 +- .../apache/hugegraph/core/CoreTestSuite.java | 4 +- .../apache/hugegraph/core/EdgeCoreTest.java | 0 .../hugegraph/core/EdgeLabelCoreTest.java | 0 .../hugegraph/core/IndexLabelCoreTest.java | 0 .../hugegraph/core/MultiGraphsTest.java | 11 +- .../hugegraph/core/PropertyCoreTest.java | 0 .../hugegraph/core/PropertyKeyCoreTest.java | 0 .../apache/hugegraph/core/RamTableTest.java | 0 .../hugegraph/core/RestoreCoreTest.java | 0 .../core/RoleElectionStateMachineTest.java | 54 +- .../apache/hugegraph/core/SchemaCoreTest.java | 0 .../apache/hugegraph/core/TaskCoreTest.java | 0 .../apache/hugegraph/core/VertexCoreTest.java | 0 .../hugegraph/core/VertexLabelCoreTest.java | 0 .../hugegraph/testutil/FakeObjects.java | 0 .../org/apache/hugegraph/testutil/Utils.java | 0 .../tinkerpop/ProcessBasicSuite.java | 0 .../tinkerpop/ProcessStandardTest.java | 0 .../tinkerpop/ProcessTestGraphProvider.java | 0 .../tinkerpop/StructureBasicSuite.java | 0 .../tinkerpop/StructureStandardTest.java | 0 .../tinkerpop/StructureTestGraphProvider.java | 0 .../apache/hugegraph/tinkerpop/TestGraph.java | 22 +- .../hugegraph/tinkerpop/TestGraphFactory.java | 0 .../tinkerpop/TestGraphProvider.java | 0 .../tinkerpop/tests/HugeGraphWriteTest.java | 0 .../apache/hugegraph/unit/BaseUnitTest.java | 0 .../apache/hugegraph/unit/FakeObjects.java | 0 .../apache/hugegraph/unit/UnitTestSuite.java | 37 +- .../unit/cache/CacheManagerTest.java | 0 .../hugegraph/unit/cache/CacheTest.java | 0 .../cache/CachedGraphTransactionTest.java | 0 .../cache/CachedSchemaTransactionTest.java | 0 .../hugegraph/unit/cache/RamTableTest.java | 0 .../unit/cassandra/CassandraTest.java | 0 .../hugegraph/unit/core/AnalyzerTest.java | 0 .../unit/core/BackendMutationTest.java | 0 .../unit/core/BackendStoreInfoTest.java | 0 .../unit/core/ConditionQueryFlattenTest.java | 0 .../hugegraph/unit/core/ConditionTest.java | 0 .../hugegraph/unit/core/DataTypeTest.java | 0 .../hugegraph/unit/core/DirectionsTest.java | 0 .../hugegraph/unit/core/ExceptionTest.java | 0 .../hugegraph/unit/core/LocksTableTest.java | 0 .../hugegraph/unit/core/PageStateTest.java | 0 .../apache/hugegraph/unit/core/QueryTest.java | 0 .../apache/hugegraph/unit/core/RangeTest.java | 0 .../unit/core/RolePermissionTest.java | 0 .../hugegraph/unit/core/RowLockTest.java | 0 .../unit/core/SecurityManagerTest.java | 13 +- .../hugegraph/unit/core/SerialEnumTest.java | 0 .../unit/core/SystemSchemaStoreTest.java | 0 .../unit/core/TraversalUtilTest.java | 0 .../apache/hugegraph/unit/id/EdgeIdTest.java | 0 .../org/apache/hugegraph/unit/id/IdTest.java | 0 .../apache/hugegraph/unit/id/IdUtilTest.java | 0 .../unit/id/SplicingIdGeneratorTest.java | 0 .../hugegraph/unit/mysql/MysqlUtilTest.java | 0 .../unit/mysql/WhereBuilderTest.java | 0 .../unit/rocksdb/BaseRocksDBUnitTest.java | 0 .../unit/rocksdb/RocksDBCountersTest.java | 0 .../unit/rocksdb/RocksDBPerfTest.java | 0 .../unit/rocksdb/RocksDBSessionTest.java | 0 .../unit/rocksdb/RocksDBSessionsTest.java | 0 .../serializer/BinaryBackendEntryTest.java | 0 .../BinaryScatterSerializerTest.java | 0 .../unit/serializer/BinarySerializerTest.java | 0 .../unit/serializer/BytesBufferTest.java | 0 .../serializer/SerializerFactoryTest.java | 0 .../unit/serializer/StoreSerializerTest.java | 0 .../serializer/TableBackendEntryTest.java | 0 .../unit/serializer/TextBackendEntryTest.java | 0 .../unit/store/RamIntObjectMapTest.java | 72 +++ .../hugegraph/unit/util/CompressUtilTest.java | 0 .../hugegraph/unit/util/JsonUtilTest.java | 0 .../hugegraph/unit/util/RateLimiterTest.java | 0 .../unit/util/StringEncodingTest.java | 0 .../hugegraph/unit/util/VersionTest.java | 0 .../collection/CollectionFactoryTest.java | 0 .../unit/util/collection/IdSetTest.java | 0 .../unit/util/collection/Int2IntsMapTest.java | 0 .../unit/util/collection/IntMapTest.java | 0 .../unit/util/collection/IntSetTest.java | 0 .../util/collection/ObjectIntMappingTest.java | 0 .../src/main/resources/fast-methods.filter | 0 .../src/main/resources/hugegraph.properties | 0 .../src/main/resources/log4j2.xml | 28 + .../src/main/resources/methods.filter | 0 .../benchmark/BenchmarkConstants.java | 0 .../hugegraph/benchmark/SimpleRandom.java | 0 .../map/MapRandomGetPutThroughputTest.java | 0 hugegraph-server/pom.xml | 495 +++++++++++++++++ hugegraph-store/README.md | 5 + pom.xml | 511 ++---------------- 930 files changed, 5377 insertions(+), 1977 deletions(-) create mode 100644 .github/configs/settings.xml delete mode 100644 hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java delete mode 100644 hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java delete mode 100644 hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/GlobalMasterInfo.java delete mode 100644 hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/OltpTraverser.java create mode 100644 hugegraph-pd/README.md rename Dockerfile => hugegraph-server/Dockerfile (72%) create mode 100644 hugegraph-server/README.md rename {hugegraph-api => hugegraph-server/hugegraph-api}/pom.xml (91%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/API.java (98%) create mode 100644 hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/auth/LoginAPI.java (89%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java (98%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/cypher/CypherManager.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java (100%) create mode 100644 hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java (87%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java (100%) create mode 100644 hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/PathFilter.java rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java (93%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/filter/RedirectFilterDynamicFeature.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java (100%) create mode 100644 hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java (98%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/gremlin/GremlinClient.java (55%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java (97%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/job/ComputerAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/job/RebuildAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java (100%) create mode 100644 hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java (100%) create mode 100644 hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/schema/EdgeLabelAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/schema/IndexLabelAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/schema/PropertyKeyAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/schema/SchemaAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/schema/VertexLabelAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/AllShortestPathsAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/CrosspointsAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/CustomizedPathsAPI.java (100%) create mode 100644 hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/EdgesAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/FusiformSimilarityAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/JaccardSimilarityAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/KneighborAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/KoutAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/MultiNodeShortestPathAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/PathsAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/RaysAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/RingsAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/SameNeighborsAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/ShortestPathAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/SingleSourceShortestPathAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/TemplatePathsAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/TraverserAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/VerticesAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/traversers/WeightedShortestPathAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java (98%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/config/ServerOptions.java (86%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/core/GraphManager.java (91%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/define/Checkable.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/define/WorkLoad.java (100%) create mode 100644 hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsKeys.java rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java (100%) create mode 100644 hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java (100%) create mode 100644 hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SlowQueryLog.java rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/serializer/JsonSerializer.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/serializer/Serializer.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java (93%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/server/RestServer.java (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/java/org/apache/hugegraph/version/ApiVersion.java (89%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin (100%) rename {hugegraph-api => hugegraph-server/hugegraph-api}/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.server.OpProcessor (100%) rename {hugegraph-cassandra => hugegraph-server/hugegraph-cassandra}/pom.xml (97%) rename {hugegraph-cassandra => hugegraph-server/hugegraph-cassandra}/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java (100%) rename {hugegraph-cassandra => hugegraph-server/hugegraph-cassandra}/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraBackendEntry.java (100%) rename {hugegraph-cassandra => hugegraph-server/hugegraph-cassandra}/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java (100%) rename {hugegraph-cassandra => hugegraph-server/hugegraph-cassandra}/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraFeatures.java (100%) rename {hugegraph-cassandra => hugegraph-server/hugegraph-cassandra}/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java (97%) rename {hugegraph-cassandra => hugegraph-server/hugegraph-cassandra}/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraOptions.java (100%) rename {hugegraph-cassandra => hugegraph-server/hugegraph-cassandra}/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java (100%) rename {hugegraph-cassandra => hugegraph-server/hugegraph-cassandra}/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java (100%) rename {hugegraph-cassandra => hugegraph-server/hugegraph-cassandra}/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java (99%) rename {hugegraph-cassandra => hugegraph-server/hugegraph-cassandra}/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java (100%) rename {hugegraph-cassandra => hugegraph-server/hugegraph-cassandra}/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStoreProvider.java (100%) rename {hugegraph-cassandra => hugegraph-server/hugegraph-cassandra}/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java (100%) rename {hugegraph-cassandra => hugegraph-server/hugegraph-cassandra}/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/pom.xml (92%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/HugeException.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/HugeFactory.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/HugeGraph.java (98%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/HugeGraphParams.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/StandardHugeGraph.java (96%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/analyzer/Analyzer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/analyzer/AnalyzerFactory.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/analyzer/AnsjAnalyzer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/analyzer/HanLPAnalyzer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/analyzer/IKAnalyzer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/analyzer/JcsegAnalyzer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/analyzer/JiebaAnalyzer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/analyzer/MMSeg4JAnalyzer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/analyzer/SmartCNAnalyzer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/AuthConstant.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/AuthManager.java (95%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/EntityManager.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/HugeAccess.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/HugeBelong.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/HugeGroup.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/HugePermission.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/HugeProject.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/HugeResource.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/HugeTarget.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/HugeUser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/RelationshipManager.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/ResourceObject.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/ResourceType.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/RolePermission.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/SchemaDefine.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java (97%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/TokenGenerator.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/auth/UserWithRole.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/BackendException.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/LocalCounter.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/Transaction.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/cache/AbstractCache.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/cache/Cache.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/cache/CacheManager.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/cache/CacheNotifier.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/cache/CachedBackendStore.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/cache/CachedGraphTransaction.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/cache/CachedSchemaTransaction.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/cache/LevelCache.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/cache/OffheapCache.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/cache/RamCache.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/id/EdgeId.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/id/Id.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/id/IdGenerator.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/id/IdUtil.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/id/SplicingIdGenerator.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/page/IdHolder.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/page/IdHolderList.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/page/PageEntryIterator.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/page/PageIds.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/page/PageInfo.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/page/PageState.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/page/QueryList.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/page/SortByCountIdHolderList.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/query/Aggregate.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/query/BatchConditionQuery.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/query/Condition.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/query/ConditionQuery.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/query/ConditionQueryFlatten.java (100%) create mode 100644 hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/EdgesQueryIterator.java rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/query/IdPrefixQuery.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/query/IdQuery.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/query/IdRangeQuery.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/query/Query.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/query/QueryResults.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/serializer/AbstractSerializer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/serializer/BinaryBackendEntry.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/serializer/BinaryEntryIterator.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/serializer/BinaryScatterSerializer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/serializer/BinarySerializer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/serializer/GraphSerializer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/serializer/MergeIterator.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/serializer/SchemaSerializer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/serializer/SerializerFactory.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/serializer/TableBackendEntry.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/serializer/TableSerializer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/serializer/TextBackendEntry.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/serializer/TextSerializer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStore.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStoreProvider.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/BackendAction.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/BackendEntry.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/BackendEntryIterator.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/BackendFeatures.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/BackendMetrics.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/BackendMutation.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/BackendProviderFactory.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/BackendSession.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/BackendSessionPool.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/BackendStore.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/BackendStoreInfo.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/BackendStoreProvider.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/BackendTable.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/MetaDispatcher.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/MetaHandler.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/Shard.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/SystemSchemaStore.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/TableDefine.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStore.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStoreProvider.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTable.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTables.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryMetrics.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/RaftAddPeerJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStore.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStoreProvider.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/RaftClosure.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/RaftContext.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/RaftException.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManager.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManagerImpl.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/RaftNode.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/RaftRemovePeerJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/RaftResult.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/RaftStoreClosure.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/StoreCommand.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSerializer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSnapshotFile.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/StoreStateMachine.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/compress/CompressStrategy.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/compress/CompressStrategyManager.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/compress/ParallelCompressStrategy.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/compress/SerialCompressStrategy.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/AddPeerProcessor.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/ListPeersProcessor.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RemovePeerProcessor.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RpcForwarder.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/SetLeaderProcessor.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/StoreCommandProcessor.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/ram/IntIntMap.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/ram/IntLongMap.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/ram/IntObjectMap.java (91%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/ram/RamMap.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/store/ram/RamTable.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/tx/AbstractTransaction.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java (99%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/tx/IndexableTransaction.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/tx/SchemaIndexTransaction.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/backend/tx/SchemaTransaction.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/config/AuthOptions.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/config/CoreOptions.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/exception/ConnectionException.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/exception/ExistedException.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/exception/HugeGremlinException.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/exception/LimitExceedException.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/exception/NoIndexException.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/exception/NotAllowException.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/exception/NotFoundException.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/exception/NotSupportException.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/io/GraphSONSchemaSerializer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/io/HugeGraphIoRegistry.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/io/HugeGraphSONModule.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/io/HugeGryoModule.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/AlgorithmJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/ComputerJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/EphemeralJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/EphemeralJobBuilder.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/GremlinJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/Job.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/JobBuilder.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/SysJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/UserJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/AbstractAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/Algorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/AlgorithmPool.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/BfsTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/Consumers.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/CountEdgeAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/CountVertexAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/SubgraphStatAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/cent/AbstractCentAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithmV2.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithmV2.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/cent/DegreeCentralityAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/cent/EigenvectorCentralityAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithmV2.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/comm/AbstractCommAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/comm/ClusterCoefficientAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/comm/KCoreAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/comm/LpaAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/comm/TriangleCountAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/comm/WeakConnectedComponent.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/path/RingsDetectAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/rank/PageRankAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/algorithm/similarity/FusiformSimilarityAlgorithm.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/computer/AbstractComputer.java (99%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/computer/Computer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/computer/ComputerPool.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/computer/LouvainComputer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/computer/LpaComputer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/computer/PageRankComputer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/computer/TriangleCountComputer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/computer/WeakConnectedComponentComputer.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/schema/EdgeLabelRemoveJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRebuildJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRemoveJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyClearJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyCreateJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyRemoveJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/schema/SchemaJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/schema/VertexLabelRemoveJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredElementJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredIndexJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredJob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/job/system/JobCounters.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/masterelection/ClusterRole.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/masterelection/ClusterRoleStore.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/masterelection/Config.java (100%) create mode 100644 hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/GlobalMasterInfo.java rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/masterelection/RoleElectionConfig.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/masterelection/RoleElectionOptions.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/masterelection/RoleElectionStateMachine.java (93%) rename hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StateMachineCallback.java => hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleListener.java (96%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/masterelection/StandardClusterRoleStore.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/masterelection/StandardRoleElectionStateMachine.java (89%) rename hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardStateMachineCallback.java => hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardRoleListener.java (67%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/masterelection/StateMachineContext.java (97%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/plugin/HugeGraphGremlinPlugin.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/plugin/HugeGraphPlugin.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/schema/EdgeLabel.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/schema/IndexLabel.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/schema/PropertyKey.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/schema/SchemaElement.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/schema/SchemaLabel.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/schema/SchemaManager.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/schema/Userdata.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/schema/VertexLabel.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/schema/builder/AbstractBuilder.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/schema/builder/EdgeLabelBuilder.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/schema/builder/IndexLabelBuilder.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/schema/builder/PropertyKeyBuilder.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/schema/builder/SchemaBuilder.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/schema/builder/VertexLabelBuilder.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/structure/GraphType.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/structure/HugeEdge.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/structure/HugeEdgeProperty.java (94%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/structure/HugeElement.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/structure/HugeFeatures.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/structure/HugeIndex.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/structure/HugeProperty.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/structure/HugeVertex.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/structure/HugeVertexProperty.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/task/EphemeralJobQueue.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/task/HugeServerInfo.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/task/HugeTask.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java (78%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/task/StandardTaskScheduler.java (96%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/task/TaskCallable.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/task/TaskManager.java (91%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/task/TaskScheduler.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/task/TaskStatus.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/CollectionPathsTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/CountTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/CustomizePathsTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/CustomizedCrosspointsTraverser.java (100%) create mode 100644 hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/EdgeExistenceTraverser.java rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/FusiformSimilarityTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java (95%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/JaccardSimilarTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/KneighborTraverser.java (68%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/KoutTraverser.java (76%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/MultiNodeShortestPathTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/NeighborRankTraverser.java (100%) create mode 100644 hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/OltpTraverser.java rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/PathTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/PathsTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/PersonalRankTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/PredictionTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/SameNeighborTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/ShortestPathTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/SingleSourceShortestPathTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/SubGraphTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/TemplatePathsTraverser.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/iterator/NestedIterator.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/records/AbstractRecords.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/records/DoubleWayMultiPathsRecords.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KneighborRecords.java (89%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KoutRecords.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/records/PathsRecords.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/records/Records.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/records/ShortestPathRecords.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/records/SingleWayMultiPathsRecords.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Int2ArrayRecord.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Int2IntRecord.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Int2SetRecord.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Record.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/RecordFactory.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/RecordType.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/SyncRecord.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/EdgeStep.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/RepeatEdgeStep.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/Steps.java (98%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/WeightedEdgeStep.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/ConcurrentTraverseStrategy.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/SingleTraverseStrategy.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/TraverseStrategy.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/optimize/ConditionP.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStep.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStepStrategy.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStep.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStepStrategy.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/optimize/HugePrimaryKeyStrategy.java (92%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStep.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepByBatch.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepStrategy.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/optimize/QueryHolder.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/optimize/Text.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/HugeType.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/Idfiable.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/Indexable.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/Nameable.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/Propertiable.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/Typeable.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/Action.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/AggregateType.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/Cardinality.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/CollectionType.java (99%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/DataType.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/Directions.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/Frequency.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/GraphMode.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/GraphReadMode.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/HugeKeys.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/IdStrategy.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/IndexType.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/NodeRole.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/SchemaStatus.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/SerialEnum.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/type/define/WriteType.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/Blob.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/CompressUtil.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/ConfigUtil.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/Consumers.java (73%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/CopyUtil.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/Events.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/FixedTimerWindowRateLimiter.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/FixedWatchWindowRateLimiter.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/GZipUtil.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/JsonUtil.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/KryoUtil.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/LZ4Util.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/LockUtil.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/ParameterUtil.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/RateLimiter.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/Reflection.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/StringEncoding.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/collection/CollectionFactory.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/collection/IdSet.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/collection/Int2IntsMap.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/collection/IntIterator.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/collection/IntMap.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/collection/IntSet.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/collection/ObjectIntMapping.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/util/collection/ObjectIntMappingFactory.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/variables/HugeVariables.java (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/java/org/apache/hugegraph/version/CoreVersion.java (74%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/resources/hugegraph.properties (100%) rename {hugegraph-core => hugegraph-server/hugegraph-core}/src/main/resources/proto/raft.proto (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/README.md (72%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/dist.sh (100%) create mode 100644 hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh create mode 100644 hugegraph-server/hugegraph-dist/docker/example/docker-compose-cassandra.yml create mode 100644 hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy create mode 100644 hugegraph-server/hugegraph-dist/docker/scripts/remote-connect.groovy rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/pom.xml (91%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/LICENSE (99%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/NOTICE (98%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-HdrHistogram.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-ST4.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-audience-annotations.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-arthas-agent-attach.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-commons-io.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-arthas-packaging.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-audience-annotations.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy-agent.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy-agent-1.11.6.txt (100%) create mode 100644 hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy-agent.txt rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-byte-buddy.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-cassandra-all.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-commons-beanutils.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-commons-cli.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-commons-codec.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-commons-collections.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-commons-compress.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-commons-configuration.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-commons-configuration2.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-error-prone.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-io.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-commons-lang.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-commons-lang3.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-commons-logging.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-commons-math3.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-gremlin-console.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-compress-lzf.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-concurrent-trees.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-concurrentlinkedhashmap-lru.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-disruptor.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-gremlin-core.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-error-prone.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-exp4j.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-expressions-9.0.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-fastutil.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-findbugs-annotations.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-front-end.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-gremlin-driver.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-console.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-gremlin-groovy.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-core.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-gremlin-server.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-driver.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-gremlin-shaded.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-groovy.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-gremlin-test.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-server.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-groovy-cli-picocli.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-shaded.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-groovy-console.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-test.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-groovy-2.5.14.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-groovy-swing.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-cli-picocli.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-groovy-templates.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-console.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-groovy-groovysh.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-groovy-json.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-groovy-jsr223.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-groovy-xml.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-swing.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-htrace-core4-4.2.0.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-templates.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-httpclient.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-xml.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-hamcrest.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-hbase-shaded-endpoint.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-hppc.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-httpcore.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-htrace-core4-4.2.0.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-ikanalyzer-2012_u6.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-httpclient.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-httpcore.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-jackson-core.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-ikanalyzer-2012_u6.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-ivy.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-kerb-admin.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-kerb-client.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-dataformat-yaml.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-datatype-jsr310.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-jaxrs-base.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider-2.12.1.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-javax.json.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-jcabi-log.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-jcabi-manifests.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-jcl-over-slf4j.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-jersey-client.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-jflex.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-jieba-analysis.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-jna.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-json-simple.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-json-smart.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-kerb-common.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-admin.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-kerb-core.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-client.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-kerb-crypto.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-common.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-kerb-identity.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-core.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-kerb-server.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-crypto.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-kerb-simplekdc.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-identity.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-kerb-util.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-server.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-kerby-asn1.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-simplekdc.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-kerby-config.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-util.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-kerby-pkix.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerby-asn1.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-kerby-util.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerby-config.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-kerby-xdr.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerby-pkix.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-log4j-api.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerby-util.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-log4j-slf4j-impl.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerby-xdr.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-objenesis.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-log4j-api.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-log4j-core.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-tinkergraph-gremlin.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-log4j-slf4j-impl.txt (100%) rename hugegraph-dist/release-docs/licenses/LICENSE-token-provider.txt => hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-objenesis.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-ohc-core.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-opencypher-ast-9.0.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-parboiled-core.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-parboiled-scala_2.12.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-parser-9.0.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-postgresql.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-rewriting-9.0.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-rocksdbjni.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-sigar.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-snakeyaml.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-snowball-stemmer.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-swagger-annotations.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-swagger-models.txt (100%) create mode 100644 hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-tinkergraph-gremlin.txt create mode 100644 hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-token-provider.txt rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-tracer-core.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LICENSE-util-9.0.txt (100%) create mode 100644 hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-zt-zip.txt rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/release-docs/licenses/LINCENSE-jopt-simple.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/scripts/apache-release.sh (96%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/scripts/dependency/check_dependencies.sh (75%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/scripts/dependency/known-dependencies.txt (74%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/scripts/dependency/regenerate_known_dependencies.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/descriptor/assembly.xml (96%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/jenkins/build.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/jenkins/config.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/jenkins/deploy.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/jenkins/jenkins.sh (97%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/jenkins/publish.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/jenkins/test.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/checksocket.sh (100%) create mode 100644 hugegraph-server/hugegraph-dist/src/assembly/static/bin/docker-entrypoint.sh rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/dump-conf.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/dump-store.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/gremlin-console.sh (91%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/hugegraph (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/hugegraph-server.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/hugegraph.service (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/init-store.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/install.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/monitor-hugegraph.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/raft-tools.sh (95%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/start-hugegraph.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/start-monitor.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/stop-hugegraph.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/stop-monitor.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/bin/util.sh (99%) create mode 100644 hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-storage.sh rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/conf/computer.yaml (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/conf/graphs/hugegraph.properties (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/conf/gremlin-driver-settings.yaml (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/conf/gremlin-server.yaml (98%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/conf/log4j2.xml (79%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/conf/remote-objects.yaml (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/conf/remote.yaml (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/conf/rest-server.properties (88%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/ext/README.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/ext/plugins.txt (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/scripts/empty-sample.groovy (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/static/scripts/example.groovy (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/build-report.sh (97%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/conf-raft1/graphs/hugegraph.properties (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/conf-raft1/gremlin-server.yaml (94%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/conf-raft1/rest-server.properties (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/conf-raft2/graphs/hugegraph.properties (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/conf-raft2/gremlin-server.yaml (94%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/conf-raft2/rest-server.properties (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/conf-raft3/graphs/hugegraph.properties (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/conf-raft3/gremlin-server.yaml (94%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/conf-raft3/rest-server.properties (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/hbase-site.xml (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/install-backend.sh (93%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/install-cassandra.sh (97%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/install-hbase.sh (98%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/install-mysql-via-docker.sh (94%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/install-mysql.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/install-postgresql-via-docker.sh (94%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/install-postgresql.sh (94%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/install-scylladb.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/maven.xml (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/mysql.cnf (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/run-api-test-for-raft.sh (88%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/run-api-test.sh (92%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/run-core-test.sh (91%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/run-tinkerpop-test.sh (84%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/run-unit-test.sh (92%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/start-server.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/assembly/travis/stop-server.sh (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/main/java/org/apache/hugegraph/cmd/ConfDumper.java (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/main/java/org/apache/hugegraph/cmd/InitStore.java (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/main/java/org/apache/hugegraph/cmd/StoreDumper.java (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/main/java/org/apache/hugegraph/dist/DistOptions.java (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/main/java/org/apache/hugegraph/dist/HugeGraphServer.java (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/main/java/org/apache/hugegraph/dist/HugeGremlinServer.java (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/main/java/org/apache/hugegraph/dist/HugeRestServer.java (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/main/java/org/apache/hugegraph/dist/RegisterUtil.java (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/main/resources/backend.properties (100%) rename {hugegraph-dist => hugegraph-server/hugegraph-dist}/src/main/resources/log4j2.xml (79%) rename {hugegraph-example => hugegraph-server/hugegraph-example}/pom.xml (98%) rename {hugegraph-example => hugegraph-server/hugegraph-example}/src/main/java/org/apache/hugegraph/example/Example1.java (100%) rename {hugegraph-example => hugegraph-server/hugegraph-example}/src/main/java/org/apache/hugegraph/example/Example2.java (100%) rename {hugegraph-example => hugegraph-server/hugegraph-example}/src/main/java/org/apache/hugegraph/example/Example3.java (100%) rename {hugegraph-example => hugegraph-server/hugegraph-example}/src/main/java/org/apache/hugegraph/example/ExampleUtil.java (95%) rename {hugegraph-example => hugegraph-server/hugegraph-example}/src/main/java/org/apache/hugegraph/example/GraphOfTheMoviesExample.java (100%) rename {hugegraph-example => hugegraph-server/hugegraph-example}/src/main/java/org/apache/hugegraph/example/PerfExample1.java (100%) rename {hugegraph-example => hugegraph-server/hugegraph-example}/src/main/java/org/apache/hugegraph/example/PerfExample2.java (100%) rename {hugegraph-example => hugegraph-server/hugegraph-example}/src/main/java/org/apache/hugegraph/example/PerfExample3.java (100%) rename {hugegraph-example => hugegraph-server/hugegraph-example}/src/main/java/org/apache/hugegraph/example/PerfExample4.java (100%) rename {hugegraph-example => hugegraph-server/hugegraph-example}/src/main/java/org/apache/hugegraph/example/PerfExampleBase.java (74%) rename {hugegraph-example => hugegraph-server/hugegraph-example}/src/main/java/org/apache/hugegraph/example/TaskExample.java (100%) rename {hugegraph-example => hugegraph-server/hugegraph-example}/src/main/java/org/apache/hugegraph/example/ThreadRangePerfTest.java (100%) rename {hugegraph-example => hugegraph-server/hugegraph-example}/src/main/resources/hugegraph.properties (100%) rename {hugegraph-example => hugegraph-server/hugegraph-example}/src/main/resources/log4j2.xml (100%) rename {hugegraph-hbase => hugegraph-server/hugegraph-hbase}/pom.xml (97%) rename {hugegraph-hbase => hugegraph-server/hugegraph-hbase}/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseFeatures.java (100%) rename {hugegraph-hbase => hugegraph-server/hugegraph-hbase}/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseMetrics.java (100%) rename {hugegraph-hbase => hugegraph-server/hugegraph-hbase}/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseOptions.java (100%) rename {hugegraph-hbase => hugegraph-server/hugegraph-hbase}/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSerializer.java (100%) rename {hugegraph-hbase => hugegraph-server/hugegraph-hbase}/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSessions.java (98%) rename {hugegraph-hbase => hugegraph-server/hugegraph-hbase}/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseStore.java (100%) rename {hugegraph-hbase => hugegraph-server/hugegraph-hbase}/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseStoreProvider.java (100%) rename {hugegraph-hbase => hugegraph-server/hugegraph-hbase}/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTable.java (100%) rename {hugegraph-hbase => hugegraph-server/hugegraph-hbase}/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTables.java (100%) rename {hugegraph-mysql => hugegraph-server/hugegraph-mysql}/pom.xml (97%) rename {hugegraph-mysql => hugegraph-server/hugegraph-mysql}/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlBackendEntry.java (100%) rename {hugegraph-mysql => hugegraph-server/hugegraph-mysql}/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java (100%) rename {hugegraph-mysql => hugegraph-server/hugegraph-mysql}/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlFeatures.java (100%) rename {hugegraph-mysql => hugegraph-server/hugegraph-mysql}/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java (100%) rename {hugegraph-mysql => hugegraph-server/hugegraph-mysql}/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java (100%) rename {hugegraph-mysql => hugegraph-server/hugegraph-mysql}/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java (100%) rename {hugegraph-mysql => hugegraph-server/hugegraph-mysql}/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java (100%) rename {hugegraph-mysql => hugegraph-server/hugegraph-mysql}/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java (100%) rename {hugegraph-mysql => hugegraph-server/hugegraph-mysql}/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStoreProvider.java (100%) rename {hugegraph-mysql => hugegraph-server/hugegraph-mysql}/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java (100%) rename {hugegraph-mysql => hugegraph-server/hugegraph-mysql}/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java (100%) rename {hugegraph-mysql => hugegraph-server/hugegraph-mysql}/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlUtil.java (100%) rename {hugegraph-mysql => hugegraph-server/hugegraph-mysql}/src/main/java/org/apache/hugegraph/backend/store/mysql/ResultSetWrapper.java (99%) rename {hugegraph-mysql => hugegraph-server/hugegraph-mysql}/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java (100%) rename {hugegraph-palo => hugegraph-server/hugegraph-palo}/pom.xml (97%) rename {hugegraph-palo => hugegraph-server/hugegraph-palo}/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFeatures.java (100%) rename {hugegraph-palo => hugegraph-server/hugegraph-palo}/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java (100%) rename {hugegraph-palo => hugegraph-server/hugegraph-palo}/src/main/java/org/apache/hugegraph/backend/store/palo/PaloHttpClient.java (86%) rename {hugegraph-palo => hugegraph-server/hugegraph-palo}/src/main/java/org/apache/hugegraph/backend/store/palo/PaloLoadInfo.java (100%) rename {hugegraph-palo => hugegraph-server/hugegraph-palo}/src/main/java/org/apache/hugegraph/backend/store/palo/PaloOptions.java (100%) rename {hugegraph-palo => hugegraph-server/hugegraph-palo}/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSerializer.java (100%) rename {hugegraph-palo => hugegraph-server/hugegraph-palo}/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java (100%) rename {hugegraph-palo => hugegraph-server/hugegraph-palo}/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java (100%) rename {hugegraph-palo => hugegraph-server/hugegraph-palo}/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java (100%) rename {hugegraph-palo => hugegraph-server/hugegraph-palo}/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java (100%) rename {hugegraph-palo => hugegraph-server/hugegraph-palo}/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java (100%) rename {hugegraph-postgresql => hugegraph-server/hugegraph-postgresql}/pom.xml (95%) rename {hugegraph-postgresql => hugegraph-server/hugegraph-postgresql}/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlOptions.java (100%) rename {hugegraph-postgresql => hugegraph-server/hugegraph-postgresql}/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java (100%) rename {hugegraph-postgresql => hugegraph-server/hugegraph-postgresql}/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java (100%) rename {hugegraph-postgresql => hugegraph-server/hugegraph-postgresql}/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStore.java (100%) rename {hugegraph-postgresql => hugegraph-server/hugegraph-postgresql}/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java (100%) rename {hugegraph-postgresql => hugegraph-server/hugegraph-postgresql}/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java (100%) rename {hugegraph-postgresql => hugegraph-server/hugegraph-postgresql}/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java (100%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/pom.xml (97%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/src/main/java/org/apache/hugegraph/backend/store/rocksdb/OpenedRocksDB.java (100%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBFeatures.java (100%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBIngester.java (100%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBIteratorPool.java (100%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBMetrics.java (100%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBOptions.java (100%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBSessions.java (100%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java (100%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStore.java (99%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStoreProvider.java (100%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBTable.java (100%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBTables.java (100%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstSessions.java (98%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstStore.java (100%) rename {hugegraph-rocksdb => hugegraph-server/hugegraph-rocksdb}/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstStoreProvider.java (100%) rename {hugegraph-scylladb => hugegraph-server/hugegraph-scylladb}/pom.xml (96%) rename {hugegraph-scylladb => hugegraph-server/hugegraph-scylladb}/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBFeatures.java (100%) rename {hugegraph-scylladb => hugegraph-server/hugegraph-scylladb}/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java (100%) rename {hugegraph-scylladb => hugegraph-server/hugegraph-scylladb}/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java (100%) rename {hugegraph-scylladb => hugegraph-server/hugegraph-scylladb}/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/pom.xml (99%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/ApiTestSuite.java (97%) create mode 100644 hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/BaseApiTest.java (98%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/CypherApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/EdgeApiTest.java (92%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/EdgeLabelApiTest.java (89%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/GremlinApiTest.java (99%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/IndexLabelApiTest.java (87%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/LoginApiTest.java (88%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java (88%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/ProjectApiTest.java (82%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/PropertyKeyApiTest.java (85%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/SchemaApiTest.java (92%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/TaskApiTest.java (84%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/UserApiTest.java (90%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/VertexApiTest.java (87%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/VertexLabelApiTest.java (87%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPITest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/AllShortestPathsApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/CountApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/CrosspointsApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/EdgesApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/FusiformSimilarityApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/JaccardSimilarityApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/KneighborApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/KoutApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/PathsApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/RaysApiTest.java (93%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPITest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/RingsApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/SameNeighborsApiTest.java (90%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/ShortestPathApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/SingleSourceShortestPathApiTest.java (92%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/TemplatePathsApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/TraversersApiTestSuite.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/api/traversers/WeightedShortestPathApiTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/AuthTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/BaseCoreTest.java (96%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/CoreTestSuite.java (95%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/EdgeLabelCoreTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/IndexLabelCoreTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/MultiGraphsTest.java (97%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/PropertyCoreTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/PropertyKeyCoreTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/RamTableTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/RestoreCoreTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/RoleElectionStateMachineTest.java (86%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/SchemaCoreTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/TaskCoreTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/VertexCoreTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/core/VertexLabelCoreTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/testutil/FakeObjects.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/testutil/Utils.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/tinkerpop/ProcessBasicSuite.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/tinkerpop/ProcessStandardTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/tinkerpop/ProcessTestGraphProvider.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/tinkerpop/StructureBasicSuite.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/tinkerpop/StructureStandardTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/tinkerpop/StructureTestGraphProvider.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/tinkerpop/TestGraph.java (99%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/tinkerpop/TestGraphFactory.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/tinkerpop/TestGraphProvider.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/tinkerpop/tests/HugeGraphWriteTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/BaseUnitTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/FakeObjects.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java (96%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/cache/CacheManagerTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/cache/CacheTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/cache/CachedGraphTransactionTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/cache/CachedSchemaTransactionTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/cache/RamTableTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/cassandra/CassandraTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/AnalyzerTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/BackendMutationTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/BackendStoreInfoTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/ConditionQueryFlattenTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/ConditionTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/DataTypeTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/DirectionsTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/ExceptionTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/LocksTableTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/PageStateTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/QueryTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/RangeTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/RolePermissionTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/RowLockTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/SecurityManagerTest.java (98%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/SerialEnumTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/SystemSchemaStoreTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/core/TraversalUtilTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/id/EdgeIdTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/id/IdTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/id/IdUtilTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/id/SplicingIdGeneratorTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/mysql/MysqlUtilTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/mysql/WhereBuilderTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/rocksdb/BaseRocksDBUnitTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBCountersTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBPerfTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBSessionTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBSessionsTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/serializer/BinaryBackendEntryTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/serializer/BinaryScatterSerializerTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/serializer/BinarySerializerTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/serializer/BytesBufferTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/serializer/SerializerFactoryTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/serializer/StoreSerializerTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/serializer/TableBackendEntryTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/serializer/TextBackendEntryTest.java (100%) create mode 100644 hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/store/RamIntObjectMapTest.java rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/util/CompressUtilTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/util/JsonUtilTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/util/RateLimiterTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/util/StringEncodingTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/util/VersionTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/util/collection/CollectionFactoryTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/util/collection/IdSetTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/util/collection/Int2IntsMapTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/util/collection/IntMapTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/util/collection/IntSetTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/java/org/apache/hugegraph/unit/util/collection/ObjectIntMappingTest.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/resources/fast-methods.filter (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/resources/hugegraph.properties (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/resources/log4j2.xml (79%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/main/resources/methods.filter (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/test/java/org/apache/hugegraph/benchmark/BenchmarkConstants.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/test/java/org/apache/hugegraph/benchmark/SimpleRandom.java (100%) rename {hugegraph-test => hugegraph-server/hugegraph-test}/src/test/java/org/apache/hugegraph/benchmark/map/MapRandomGetPutThroughputTest.java (100%) create mode 100644 hugegraph-server/pom.xml create mode 100644 hugegraph-store/README.md diff --git a/.github/configs/settings.xml b/.github/configs/settings.xml new file mode 100644 index 0000000000..294ded1cb2 --- /dev/null +++ b/.github/configs/settings.xml @@ -0,0 +1,60 @@ + + + + + + github + ${env.GITHUB_ACTOR} + ${env.GITHUB_TOKEN} + + + + + + local-repo + + + central + https://repo.maven.apache.org/maven2 + + true + + + false + + + + staged-releases + https://repository.apache.org/content/groups/staging/ + + + + + staged-releases + https://repository.apache.org/content/groups/staging/ + + + + + + + local-repo + + diff --git a/.github/outdated/.travis.yml b/.github/outdated/.travis.yml index 4b5c57ad72..485fe441f8 100644 --- a/.github/outdated/.travis.yml +++ b/.github/outdated/.travis.yml @@ -115,7 +115,7 @@ env: global: - RELEASE_BRANCH=^release-.*$ - RELEASE_TAG=^v[0-9]\..*$ - - TRAVIS_DIR=hugegraph-dist/src/assembly/travis + - TRAVIS_DIR=hugegraph-server/hugegraph-dist/src/assembly/travis - DEPLOYED=0 - secure: dYmFTVeEtRzLNaHp9ToTV/+CkTD0/rEj+K7dRN8wsv/yg4pbqwnyWbSXcqMlj6iNFzAz3nPbmFLCvAWON9/SMN9iJIT6x/xfcf+LqCT8QWczo2nc9xeX144ij2VHX1Drvtk5fRTMaTXRfWEQIrjqx2yrJTIdrXWzWSaZLFv1CRCUizEiGGCePnzUWxx9dBypNyC6IaH6lIv8uN5E6+10SYhb7UJGjWUMDg1bCeW9X7X2wg4QpsGDzlGFXT2EBPU/dAb5attTAtW8dKxrCZqZJTPWe0BarXDBR4PO15BC+a0V1g8LwexedtDjJeFRcGPaJ5NN4d3jDSusCzt5Jf4U0Wa1gDRMVTU3jT+KYkm5eoV4wOZMySobjh6VpQH/LyL0QTDy5apRPAxw+wO+tc91P+nkJmnlr3pN8abtMZ6NciZizUBYQRgR/m2Ir0stvtbZxBQOATuPtBgNDKiDgVdSYcRJzSqYEMFOn35AvsDZ9aUsyC8k29PCUZ0gQO2Is6cV1ClFBnM52hfU9XX0gu+NviSnYNGvcokod8z9VjGtnM7V3LYjqXSFqO9kkMbOmkME1tD2Bh/klw2/OM+2tBBZiAgxB89st5jSUHI4a2hpUyaQBezJUcU9t2vVT/zAVEIqzw2PDxkMU7t0n6L1x+qUIUTG/WynfIni5msxuR7HoiU= - secure: XbX6AX5zDPc2PcWYAMW+6fazqRRUqpgQkt4eXUugLuVIYZBmJ0WqncEhJ4+mdwOGPIhnP2HsOaSeK2eE/O+iLY2XpBFbugoBgm9VaZlCC4CY1gRNHaanYg64Lrm3NPY3n08IHRMazHqMpJwUqNO+OG/6QwkepULQLj5Rluf716AoXHa7IEJhAIrwr+OXQvdEaJdUXlS1lRycXVeYtOewl7qYxCO4dD4RMhPlNykh9KEK7fd5wnPkiUsp1SwF4g5XsaLvGXmT/qQ1nj8oa9Caej/iaj6HMKG3BO057mq4KK5JDxTPWhBueNpEkUwldAnrMhYWLRnNf4IyjUsaB/Pmi6HspzcaiORPLYwPmdvLGGSnYwbtO+fAHebgpgOnj/vGmRmY4YtIkYdFtbPBI0HpbGB77tqNRFCe/5deLrjx0hXJBfoKTy7d42SI1eBhNR0svZYUHkSfuXwly6hMTlH1DN/bumMFxfXDkY9PFHlzV1Mn3vb9BxKTaP88hJsWk7JqgniqUF7EWAc0EhHMbJct2gC0pDc95z4Yy9391n7/XWJErhIdYon1Ukds5+a43xFXoy76gR4LuMDpzzCnutMjhC2yDuGaZx/DfkPBb5JFU7SHtTKj05zb73Moogi7qqbH8jwcwoSfogAKyrIAWTcAgvJ2LVnRzwdsiLTc6MEagiM= diff --git a/.github/workflows/check-dependencies.yml b/.github/workflows/check-dependencies.yml index 60185492bf..5350d53fe6 100644 --- a/.github/workflows/check-dependencies.yml +++ b/.github/workflows/check-dependencies.yml @@ -3,10 +3,9 @@ name: "3rd-party" on: push: branches: - - master - /^release-.*$/ pull_request: - + permissions: contents: read @@ -14,15 +13,23 @@ jobs: dependency-check: runs-on: ubuntu-latest env: - SCRIPT_DEPENDENCY: hugegraph-dist/scripts/dependency + USE_STAGE: 'true' # Whether to include the stage repository. + SCRIPT_DEPENDENCY: hugegraph-server/hugegraph-dist/scripts/dependency steps: - name: Checkout source - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up JDK 11 uses: actions/setup-java@v3 with: java-version: '11' distribution: 'adopt' + + - name: use staged maven repo settings + if: ${{ env.USE_STAGE == 'true' }} + run: | + cp $HOME/.m2/settings.xml /tmp/settings.xml + mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml + - name: mvn install run: | mvn install -DskipTests=true -ntp @@ -37,7 +44,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Checkout Repository' - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 'Dependency Review' uses: actions/dependency-review-action@v3 # Refer: https://github.com/actions/dependency-review-action diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 414fd4a3f7..5907bffa30 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,23 +12,41 @@ jobs: build: runs-on: ubuntu-20.04 env: - TRAVIS_DIR: hugegraph-dist/src/assembly/travis + USE_STAGE: 'true' # Whether to include the stage repository. + TRAVIS_DIR: hugegraph-server/hugegraph-dist/src/assembly/travis REPORT_DIR: target/site/jacoco BACKEND: ${{ matrix.BACKEND }} TRIGGER_BRANCH_NAME: ${{ github.ref_name }} HEAD_BRANCH_NAME: ${{ github.head_ref }} BASE_BRANCH_NAME: ${{ github.base_ref }} TARGET_BRANCH_NAME: ${{ github.base_ref != '' && github.base_ref || github.ref_name }} - RELEASE_BRANCH: ${{ startsWith(github.ref_name, 'release-') || startsWith(github.ref_name, 'test-') || startsWith(github.base_ref, 'release-') }} + RELEASE_BRANCH: ${{ startsWith(github.ref_name, 'release-') || startsWith(github.ref_name, 'test-') }} + RAFT_MODE: ${{ startsWith(github.head_ref, 'test') || startsWith(github.head_ref, 'raft') }} strategy: fail-fast: false matrix: - BACKEND: [ memory, cassandra, scylladb, hbase, rocksdb, mysql, postgresql ] + BACKEND: [ memory, rocksdb, hbase, cassandra, mysql, postgresql, scylladb ] JAVA_VERSION: [ '8', '11' ] steps: - - name: Install JDK ${{ matrix.JAVA_VERSION }} + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + # TODO: Remove this step after install-backend.sh updated + - name: Install Java8 for backend + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'zulu' + + - name: Prepare backend environment + run: | + $TRAVIS_DIR/install-backend.sh $BACKEND && jps -l + + - name: Install Java ${{ matrix.JAVA_VERSION }} uses: actions/setup-java@v3 with: java-version: ${{ matrix.JAVA_VERSION }} @@ -41,30 +59,16 @@ jobs: key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 + - name: Use staged maven repo settings + if: ${{ env.USE_STAGE == 'true' }} + run: | + cp $HOME/.m2/settings.xml /tmp/settings.xml + cp -vf .github/configs/settings.xml $HOME/.m2/settings.xml && cat $HOME/.m2/settings.xml - name: Compile run: | mvn clean compile -U -Dmaven.javadoc.skip=true -ntp - - name: Install JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'zulu' - - name: Prepare env and service - run: | - $TRAVIS_DIR/install-backend.sh $BACKEND - - - name: Install JDK ${{ matrix.JAVA_VERSION }} - uses: actions/setup-java@v3 - with: - java-version: ${{ matrix.JAVA_VERSION }} - distribution: 'zulu' - - name: Run unit test run: | $TRAVIS_DIR/run-unit-test.sh $BACKEND @@ -77,8 +81,9 @@ jobs: run: | $TRAVIS_DIR/run-api-test.sh $BACKEND $REPORT_DIR + # TODO: disable raft test in normal PR due to the always timeout problem - name: Run raft test - if: ${{ env.BACKEND == 'rocksdb' }} + if: ${{ env.RAFT_MODE == 'true' && env.BACKEND == 'rocksdb' }} run: | $TRAVIS_DIR/run-api-test-for-raft.sh $BACKEND $REPORT_DIR @@ -88,6 +93,7 @@ jobs: $TRAVIS_DIR/run-tinkerpop-test.sh $BACKEND tinkerpop - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3.0.0 + uses: codecov/codecov-action@v3 with: + token: ${{ secrets.CODECOV_TOKEN }} file: ${{ env.REPORT_DIR }}/*.xml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a8e40be83a..9165bfda94 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -4,13 +4,15 @@ on: push: branches: [ master, release-* ] pull_request: - # The branches below must be a subset of the branches above - # branches: [ master ] # enable in all PR + # The branches below must be a subset of the branches above + # branches: [ master ] # enable in all PRs schedule: - cron: '33 0 * * 5' jobs: analyze: + env: + USE_STAGE: 'true' # Whether to include the stage repository. name: Analyze runs-on: ubuntu-latest permissions: @@ -25,7 +27,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Java JDK uses: actions/setup-java@v3 @@ -33,6 +35,12 @@ jobs: distribution: 'zulu' java-version: '11' + - name: use staged maven repo settings + if: ${{ env.USE_STAGE == 'true' }} + run: | + cp $HOME/.m2/settings.xml /tmp/settings.xml + mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.github/workflows/licence-checker.yml b/.github/workflows/licence-checker.yml index 163e59e1de..2510b44de1 100644 --- a/.github/workflows/licence-checker.yml +++ b/.github/workflows/licence-checker.yml @@ -10,8 +10,10 @@ on: jobs: check-license: runs-on: ubuntu-latest + env: + USE_STAGE: 'true' # Whether to include the stage repository. steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check License Header uses: apache/skywalking-eyes@main @@ -22,11 +24,6 @@ jobs: token: ${{ github.token }} config: .licenserc.yaml - - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'adopt' - - name: License check(RAT) run: | mvn apache-rat:check -ntp diff --git a/.licenserc.yaml b/.licenserc.yaml index 334d89b51e..0c7e588bf4 100644 --- a/.licenserc.yaml +++ b/.licenserc.yaml @@ -68,7 +68,7 @@ header: # `header` section is configurations for source codes license header. - '**/*.properties' - '**/RaftRequests.java' - 'dist/**/*' - - 'hugegraph-dist' + - 'hugegraph-server/hugegraph-dist' - '**/assembly/static/bin/hugegraph.service' - 'scripts/dev/reviewers' - 'scripts/dev/reviewers' @@ -89,13 +89,14 @@ header: # `header` section is configurations for source codes license header. - '**/META-INF/MANIFEST.MF' - '.repository/**' - '**/.flattened-pom.xml' - - 'hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java' + - 'hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java' - '**/optimize/HugeScriptTraversal.java' - '**/type/Nameable.java' - '**/define/Cardinality.java' - '**/util/StringEncoding.java' - - 'hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java' - - 'hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java' + - 'hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java' + - 'hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java' + - 'hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-storage.sh' comment: on-failure # on what condition license-eye will comment on the pull request, `on-failure`, `always`, `never`. # license-location-threshold specifies the index threshold where the license header can be located, diff --git a/LICENSE b/LICENSE index ad08080e31..cea0b74f43 100644 --- a/LICENSE +++ b/LICENSE @@ -214,5 +214,6 @@ hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptT hugegraph-core/src/main/java/org/apache/hugegraph/type/Nameable.java from https://github.com/JanusGraph/janusgraph hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Cardinality.java from https://github.com/JanusGraph/janusgraph hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java from https://github.com/JanusGraph/janusgraph +hugegraph-dist/src/assembly/static/bin/wait-storage.sh from https://github.com/JanusGraph/janusgraph hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java from https://github.com/opencypher/cypher-for-gremlin hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java from https://github.com/opencypher/cypher-for-gremlin diff --git a/README.md b/README.md index edc7c97bba..5e589be604 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,10 @@ Billions of vertices and edges can be easily stored into and queried from HugeGr We can use `docker run -itd --name=graph -p 8080:8080 hugegraph/hugegraph` to quickly start an inner HugeGraph server with `RocksDB` in background. -Optional: use `docker exec -it graph bash` to enter the container to do some operations. +Optional: + +1. use `docker exec -it graph bash` to enter the container to do some operations. +2. use `docker run -itd --name=graph -p 8080:8080 -e PRELOAD="true" hugegraph/hugegraph` to start with a **built-in** (example) graph. ### 2. Download Way @@ -54,9 +57,9 @@ The project [doc page](https://hugegraph.apache.org/docs/) contains more informa and provides detailed documentation for users. (Structure / Usage / API / Configs...) And here are links of other **HugeGraph** component/repositories: -1. [hugegraph-toolchain](https://github.com/apache/incubator-hugegraph-toolchain) (graph **loader/dashboard/tool/client**) -2. [hugegraph-computer](https://github.com/apache/incubator-hugegraph-computer) (matched **graph computing** system) -3. [hugegraph-commons](https://github.com/apache/incubator-hugegraph-commons) (**common & rpc** module) +1. [hugegraph-toolchain](https://github.com/apache/incubator-hugegraph-toolchain) (graph tools **[loader](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-loader)/[dashboard](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-hubble)/[tool](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-tools)/[client](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-client)**) +2. [hugegraph-computer](https://github.com/apache/incubator-hugegraph-computer) (integrated **graph computing** system) +3. [hugegraph-commons](https://github.com/apache/incubator-hugegraph-commons) (**common & rpc** libs) 4. [hugegraph-website](https://github.com/apache/incubator-hugegraph-doc) (**doc & website** code) ## License diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java b/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java deleted file mode 100644 index 6df4f6453b..0000000000 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ - -package org.apache.hugegraph.api.metrics; - -import static java.util.concurrent.TimeUnit.MILLISECONDS; -import static java.util.concurrent.TimeUnit.SECONDS; - -import java.util.LinkedHashMap; -import java.util.Map; - -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.annotation.security.RolesAllowed; -import jakarta.inject.Singleton; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.Context; - -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.metrics.MetricsModule; -import org.apache.hugegraph.metrics.ServerReporter; -import org.apache.hugegraph.metrics.SystemMetrics; -import org.slf4j.Logger; - -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.api.API; -import org.apache.hugegraph.backend.store.BackendMetrics; -import org.apache.hugegraph.util.InsertionOrderUtil; -import org.apache.hugegraph.util.JsonUtil; -import org.apache.hugegraph.util.Log; -import com.codahale.metrics.Metric; -import com.codahale.metrics.annotation.Timed; - -@Singleton -@Path("metrics") -@Tag(name = "MetricsAPI") -public class MetricsAPI extends API { - - private static final Logger LOG = Log.logger(MetricsAPI.class); - - private SystemMetrics systemMetrics; - - static { - JsonUtil.registerModule(new MetricsModule(SECONDS, MILLISECONDS, false)); - } - - public MetricsAPI() { - this.systemMetrics = new SystemMetrics(); - } - - @GET - @Timed - @Path("system") - @Produces(APPLICATION_JSON_WITH_CHARSET) - @RolesAllowed({"admin", "$owner= $action=metrics_read"}) - public String system() { - return JsonUtil.toJson(this.systemMetrics.metrics()); - } - - @GET - @Timed - @Path("backend") - @Produces(APPLICATION_JSON_WITH_CHARSET) - @RolesAllowed({"admin", "$owner= $action=metrics_read"}) - public String backend(@Context GraphManager manager) { - Map> results = InsertionOrderUtil.newMap(); - for (String graph : manager.graphs()) { - HugeGraph g = manager.graph(graph); - Map metrics = InsertionOrderUtil.newMap(); - metrics.put(BackendMetrics.BACKEND, g.backend()); - try { - metrics.putAll(g.metadata(null, "metrics")); - } catch (Throwable e) { - metrics.put(BackendMetrics.EXCEPTION, e.toString()); - LOG.debug("Failed to get backend metrics", e); - } - results.put(graph, metrics); - } - return JsonUtil.toJson(results); - } - - @GET - @Timed - @Produces(APPLICATION_JSON_WITH_CHARSET) - @RolesAllowed({"admin", "$owner= $action=metrics_read"}) - public String all() { - ServerReporter reporter = ServerReporter.instance(); - Map> result = new LinkedHashMap<>(); - result.put("gauges", reporter.gauges()); - result.put("counters", reporter.counters()); - result.put("histograms", reporter.histograms()); - result.put("meters", reporter.meters()); - result.put("timers", reporter.timers()); - return JsonUtil.toJson(result); - } - - @GET - @Timed - @Path("gauges") - @Produces(APPLICATION_JSON_WITH_CHARSET) - @RolesAllowed({"admin", "$owner= $action=metrics_read"}) - public String gauges() { - ServerReporter reporter = ServerReporter.instance(); - return JsonUtil.toJson(reporter.gauges()); - } - - @GET - @Timed - @Path("counters") - @Produces(APPLICATION_JSON_WITH_CHARSET) - @RolesAllowed({"admin", "$owner= $action=metrics_read"}) - public String counters() { - ServerReporter reporter = ServerReporter.instance(); - return JsonUtil.toJson(reporter.counters()); - } - - @GET - @Timed - @Path("histograms") - @Produces(APPLICATION_JSON_WITH_CHARSET) - @RolesAllowed({"admin", "$owner= $action=metrics_read"}) - public String histograms() { - ServerReporter reporter = ServerReporter.instance(); - return JsonUtil.toJson(reporter.histograms()); - } - - @GET - @Timed - @Path("meters") - @Produces(APPLICATION_JSON_WITH_CHARSET) - @RolesAllowed({"admin", "$owner= $action=metrics_read"}) - public String meters() { - ServerReporter reporter = ServerReporter.instance(); - return JsonUtil.toJson(reporter.meters()); - } - - @GET - @Timed - @Path("timers") - @Produces(APPLICATION_JSON_WITH_CHARSET) - @RolesAllowed({"admin", "$owner= $action=metrics_read"}) - public String timers() { - ServerReporter reporter = ServerReporter.instance(); - return JsonUtil.toJson(reporter.timers()); - } -} diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java b/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java deleted file mode 100644 index fabd1df7b9..0000000000 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ - -package org.apache.hugegraph.metrics; - -import org.apache.tinkerpop.gremlin.server.util.MetricManager; - -import com.codahale.metrics.Counter; -import com.codahale.metrics.Gauge; -import com.codahale.metrics.Histogram; -import com.codahale.metrics.Meter; -import com.codahale.metrics.MetricRegistry; -import com.codahale.metrics.Timer; - -public class MetricsUtil { - - private static final MetricRegistry REGISTRY = - MetricManager.INSTANCE.getRegistry(); - - public static Gauge registerGauge(Class clazz, String name, - Gauge gauge) { - return REGISTRY.register(MetricRegistry.name(clazz, name), gauge); - } - - public static Counter registerCounter(Class clazz, String name) { - return REGISTRY.counter(MetricRegistry.name(clazz, name)); - } - - public static Histogram registerHistogram(Class clazz, String name) { - return REGISTRY.histogram(MetricRegistry.name(clazz, name)); - } - - public static Meter registerMeter(Class clazz, String name) { - return REGISTRY.meter(MetricRegistry.name(clazz, name)); - } - - public static Timer registerTimer(Class clazz, String name) { - return REGISTRY.timer(MetricRegistry.name(clazz, name)); - } -} diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/GlobalMasterInfo.java b/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/GlobalMasterInfo.java deleted file mode 100644 index d7dd127af5..0000000000 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/GlobalMasterInfo.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ - -package org.apache.hugegraph.masterelection; - -public class GlobalMasterInfo { - - private NodeInfo nodeInfo; - private volatile boolean featureSupport; - - public GlobalMasterInfo() { - this.featureSupport = false; - this.nodeInfo = new NodeInfo(false, ""); - } - - public final void nodeInfo(boolean isMaster, String url) { - // final can avoid instruction rearrangement, visibility can be ignored - final NodeInfo tmp = new NodeInfo(isMaster, url); - this.nodeInfo = tmp; - } - - public final NodeInfo nodeInfo() { - return this.nodeInfo; - } - - public void isFeatureSupport(boolean featureSupport) { - this.featureSupport = featureSupport; - } - - public boolean isFeatureSupport() { - return this.featureSupport; - } - - public static class NodeInfo { - - private final boolean isMaster; - private final String url; - - public NodeInfo(boolean isMaster, String url) { - this.isMaster = isMaster; - this.url = url; - } - - public boolean isMaster() { - return this.isMaster; - } - - public String url() { - return this.url; - } - } -} diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/OltpTraverser.java b/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/OltpTraverser.java deleted file mode 100644 index b05de24228..0000000000 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/OltpTraverser.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ - -package org.apache.hugegraph.traversal.algorithm; - -import java.util.Iterator; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.function.Consumer; - -import com.google.common.base.Objects; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.config.CoreOptions; -import org.apache.hugegraph.util.Consumers; -import org.apache.tinkerpop.gremlin.structure.Element; -import org.apache.tinkerpop.gremlin.structure.Property; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; - -import org.apache.hugegraph.iterator.FilterIterator; - -public abstract class OltpTraverser extends HugeTraverser - implements AutoCloseable { - - private static final String EXECUTOR_NAME = "oltp"; - private static Consumers.ExecutorPool executors; - - protected OltpTraverser(HugeGraph graph) { - super(graph); - if (executors != null) { - return; - } - synchronized (OltpTraverser.class) { - if (executors != null) { - return; - } - int workers = this.graph() - .option(CoreOptions.OLTP_CONCURRENT_THREADS); - if (workers > 0) { - executors = new Consumers.ExecutorPool(EXECUTOR_NAME, workers); - } - } - } - - @Override - public void close() { - // pass - } - - public static void destroy() { - synchronized (OltpTraverser.class) { - if (executors != null) { - executors.destroy(); - executors = null; - } - } - } - - protected long traversePairs(Iterator> pairs, - Consumer> consumer) { - return this.traverse(pairs, consumer, "traverse-pairs"); - } - - protected long traverseIds(Iterator ids, Consumer consumer, - boolean concurrent) { - if (concurrent) { - return this.traverseIds(ids, consumer); - } else { - long count = 0L; - while (ids.hasNext()) { - count++; - consumer.accept(ids.next()); - } - return count; - } - } - - protected long traverseIds(Iterator ids, Consumer consumer) { - return this.traverse(ids, consumer, "traverse-ids"); - } - - protected long traverse(Iterator iterator, Consumer consumer, - String name) { - if (!iterator.hasNext()) { - return 0L; - } - - Consumers consumers = new Consumers<>(executors.getExecutor(), - consumer, null); - consumers.start(name); - long total = 0L; - try { - while (iterator.hasNext()) { - total++; - K v = iterator.next(); - consumers.provide(v); - } - } catch (Consumers.StopExecution e) { - // pass - } catch (Throwable e) { - throw Consumers.wrapException(e); - } finally { - try { - consumers.await(); - } catch (Throwable e) { - throw Consumers.wrapException(e); - } finally { - executors.returnExecutor(consumers.executor()); - CloseableIterator.closeIterator(iterator); - } - } - return total; - } - - protected Iterator filter(Iterator vertices, - String key, Object value) { - return new FilterIterator<>(vertices, vertex -> { - return match(vertex, key, value); - }); - } - - protected boolean match(Element elem, String key, Object value) { - // check property key exists - this.graph().propertyKey(key); - // return true if property value exists & equals to specified value - Property p = elem.property(key); - return p.isPresent() && Objects.equal(p.value(), value); - } - - public static class ConcurrentMultiValuedMap - extends ConcurrentHashMap> { - - private static final long serialVersionUID = -7249946839643493614L; - - public ConcurrentMultiValuedMap() { - super(); - } - - public void add(K key, V value) { - List values = this.getValues(key); - values.add(value); - } - - public void addAll(K key, List value) { - List values = this.getValues(key); - values.addAll(value); - } - - public List getValues(K key) { - List values = this.get(key); - if (values == null) { - values = new CopyOnWriteArrayList<>(); - List old = this.putIfAbsent(key, values); - if (old != null) { - values = old; - } - } - return values; - } - } -} diff --git a/hugegraph-pd/README.md b/hugegraph-pd/README.md new file mode 100644 index 0000000000..49548c216d --- /dev/null +++ b/hugegraph-pd/README.md @@ -0,0 +1,5 @@ +# HugeGraph PD + +HugeGraph PD is a meta server responsible for service discovery, partition information storage, and node scheduling. + +> Note: Currently, the contents of this folder are empty. Starting from revision 1.5.0, the code of HugeGraph PD will be adapted to this location (WIP). diff --git a/Dockerfile b/hugegraph-server/Dockerfile similarity index 72% rename from Dockerfile rename to hugegraph-server/Dockerfile index e096f3430a..a28e63ea13 100644 --- a/Dockerfile +++ b/hugegraph-server/Dockerfile @@ -26,15 +26,16 @@ RUN mvn package -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true && pwd && ls -l # 2nd stage: runtime env FROM openjdk:11-slim # TODO: get the version from the pom.xml -ENV version=1.0.0 -COPY --from=build /pkg/apache-hugegraph-incubating-$version/ /hugegraph +ENV version=1.2.0 +COPY --from=build /pkg/hugegraph-server/apache-hugegraph-incubating-$version/ /hugegraph-server LABEL maintainer="HugeGraph Docker Maintainers " # TODO: use g1gc or zgc as default -ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport -XX:MaxRAMPercentage=50 -XshowSettings:vm" +ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport -XX:MaxRAMPercentage=50 -XshowSettings:vm" \ + HUGEGRAPH_HOME="hugegraph" #COPY . /hugegraph/hugegraph-server -WORKDIR /hugegraph/ +WORKDIR /hugegraph-server/ # 1. Install environment RUN set -x \ @@ -49,12 +50,17 @@ RUN set -x \ # 2. Init HugeGraph Sever RUN set -e \ - && pwd && cd /hugegraph/ \ - && sed -i "s/^restserver.url.*$/restserver.url=http:\/\/0.0.0.0:8080/g" ./conf/rest-server.properties \ - && ./bin/init-store.sh + && pwd && cd /hugegraph-server/ \ + && sed -i "s/^restserver.url.*$/restserver.url=http:\/\/0.0.0.0:8080/g" ./conf/rest-server.properties + +# 3. Init docker script +COPY hugegraph-server/hugegraph-dist/docker/scripts/remote-connect.groovy ./scripts +COPY hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy ./scripts +COPY hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh . +RUN chmod 755 ./docker-entrypoint.sh EXPOSE 8080 -VOLUME /hugegraph +VOLUME /hugegraph-server ENTRYPOINT ["/usr/bin/dumb-init", "--"] -CMD ["./bin/start-hugegraph.sh", "-d false -j $JAVA_OPTS -g zgc"] +CMD ["./docker-entrypoint.sh"] diff --git a/hugegraph-server/README.md b/hugegraph-server/README.md new file mode 100644 index 0000000000..f2c3ceee7f --- /dev/null +++ b/hugegraph-server/README.md @@ -0,0 +1,11 @@ +# HugeGraph Server + +HugeGraph Server consists of two layers of functionality: the graph engine layer, and the storage layer. + +- Graph Engine Layer: + - REST Server: Provides a RESTful API for querying graph/schema information, supports the [Gremlin](https://tinkerpop.apache.org/gremlin.html) and [Cypher](https://en.wikipedia.org/wiki/Cypher) query languages, and offers APIs for service monitoring and operations. + - Graph Engine: Supports both OLTP and OLAP graph computation types, with OLTP implementing the [Apache TinkerPop3](https://tinkerpop.apache.org) framework. + - Backend Interface: Implements the storage of graph data to the backend. + +- Storage Layer: + - Storage Backend: Supports multiple built-in storage backends (RocksDB/MySQL/HBase/...) and allows users to extend custom backends without modifying the existing source code. diff --git a/hugegraph-api/pom.xml b/hugegraph-server/hugegraph-api/pom.xml similarity index 91% rename from hugegraph-api/pom.xml rename to hugegraph-server/hugegraph-api/pom.xml index 2d7370056e..459a22e0ea 100644 --- a/hugegraph-api/pom.xml +++ b/hugegraph-server/hugegraph-api/pom.xml @@ -15,12 +15,12 @@ License for the specific language governing permissions and limitations under the License. --> - org.apache.hugegraph - hugegraph + hugegraph-server ${revision} ../pom.xml @@ -151,7 +151,18 @@ io.swagger.core.v3 swagger-jaxrs2-jakarta - 2.1.9 + ${swagger.version} + + + + com.taobao.arthas + arthas-agent-attach + ${arthas.version} + + + com.taobao.arthas + arthas-packaging + ${arthas.version} @@ -177,7 +188,7 @@ - 0.69.0.0 + 0.71.0.0 diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java similarity index 98% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java index 99fe67e5ba..e57f6739df 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java @@ -27,6 +27,7 @@ import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.core.GraphManager; import org.apache.hugegraph.define.Checkable; +import org.apache.hugegraph.exception.NotFoundException; import org.apache.hugegraph.metrics.MetricsUtil; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.InsertionOrderUtil; @@ -38,7 +39,6 @@ import com.google.common.collect.ImmutableMap; import jakarta.ws.rs.ForbiddenException; -import jakarta.ws.rs.NotFoundException; import jakarta.ws.rs.NotSupportedException; import jakarta.ws.rs.core.MediaType; @@ -49,6 +49,7 @@ public class API { public static final String APPLICATION_JSON = MediaType.APPLICATION_JSON; public static final String APPLICATION_JSON_WITH_CHARSET = APPLICATION_JSON + ";charset=" + CHARSET; + public static final String APPLICATION_TEXT_WITH_CHARSET = MediaType.TEXT_PLAIN + ";charset=" + CHARSET; public static final String JSON = MediaType.APPLICATION_JSON_TYPE .getSubtype(); public static final String ACTION_APPEND = "append"; diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java new file mode 100644 index 0000000000..67e65a31a8 --- /dev/null +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hugegraph.api.arthas; + +import java.util.HashMap; + +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.config.ServerOptions; +import org.apache.hugegraph.util.JsonUtil; + +import com.codahale.metrics.annotation.Timed; +import com.taobao.arthas.agent.attach.ArthasAgent; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; + +import jakarta.inject.Singleton; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; + +@Path("arthas") +@Singleton +@Tag(name = "ArthasAPI") +public class ArthasAPI extends API { + + @Context + private jakarta.inject.Provider configProvider; + + @PUT + @Timed + @Produces(APPLICATION_JSON_WITH_CHARSET) + @Operation(summary = "start arthas agent") + public Object startArthas() { + HugeConfig config = this.configProvider.get(); + HashMap configMap = new HashMap<>(4); + configMap.put("arthas.telnetPort", config.get(ServerOptions.ARTHAS_TELNET_PORT)); + configMap.put("arthas.httpPort", config.get(ServerOptions.ARTHAS_HTTP_PORT)); + configMap.put("arthas.ip", config.get(ServerOptions.ARTHAS_IP)); + configMap.put("arthas.disabledCommands", config.get(ServerOptions.ARTHAS_DISABLED_COMMANDS)); + ArthasAgent.attach(configMap); + return JsonUtil.toJson(configMap); + } +} diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/LoginAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/LoginAPI.java similarity index 89% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/LoginAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/LoginAPI.java index a227fd0b50..0982e01c1e 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/LoginAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/LoginAPI.java @@ -17,39 +17,40 @@ package org.apache.hugegraph.api.auth; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.inject.Singleton; import javax.security.sasl.AuthenticationException; -import jakarta.ws.rs.BadRequestException; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELETE; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.NotAuthorizedException; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.Context; -import jakarta.ws.rs.core.HttpHeaders; import org.apache.commons.lang3.StringUtils; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.define.Checkable; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.api.API; import org.apache.hugegraph.api.filter.AuthenticationFilter; import org.apache.hugegraph.api.filter.StatusFilter.Status; import org.apache.hugegraph.auth.AuthConstant; import org.apache.hugegraph.auth.UserWithRole; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.define.Checkable; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.collect.ImmutableMap; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.BadRequestException; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.HeaderParam; +import jakarta.ws.rs.NotAuthorizedException; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.HttpHeaders; + @Path("graphs/{graph}/auth") @Singleton @Tag(name = "LoginAPI") @@ -63,8 +64,7 @@ public class LoginAPI extends API { @Status(Status.OK) @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON_WITH_CHARSET) - public String login(@Context GraphManager manager, - @PathParam("graph") String graph, + public String login(@Context GraphManager manager, @PathParam("graph") String graph, JsonLogin jsonLogin) { LOG.debug("Graph [{}] user login: {}", graph, jsonLogin); checkCreatingBody(jsonLogin); @@ -94,13 +94,10 @@ public void logout(@Context GraphManager manager, LOG.debug("Graph [{}] user logout: {}", graph, auth); if (!auth.startsWith(AuthenticationFilter.BEARER_TOKEN_PREFIX)) { - throw new BadRequestException( - "Only HTTP Bearer authentication is supported"); + throw new BadRequestException("Only HTTP Bearer authentication is supported"); } - String token = auth.substring(AuthenticationFilter.BEARER_TOKEN_PREFIX - .length()); - + String token = auth.substring(AuthenticationFilter.BEARER_TOKEN_PREFIX.length()); manager.authManager().logoutUser(token); } @@ -119,12 +116,10 @@ public String verifyToken(@Context GraphManager manager, LOG.debug("Graph [{}] get user: {}", graph, token); if (!token.startsWith(AuthenticationFilter.BEARER_TOKEN_PREFIX)) { - throw new BadRequestException( - "Only HTTP Bearer authentication is supported"); + throw new BadRequestException("Only HTTP Bearer authentication is supported"); } - token = token.substring(AuthenticationFilter.BEARER_TOKEN_PREFIX - .length()); + token = token.substring(AuthenticationFilter.BEARER_TOKEN_PREFIX.length()); UserWithRole userWithRole = manager.authManager().validateUser(token); HugeGraph g = graph(manager, graph); @@ -144,8 +139,7 @@ private static class JsonLogin implements Checkable { @Override public void checkCreate(boolean isBatch) { - E.checkArgument(!StringUtils.isEmpty(this.name), - "The name of user can't be null"); + E.checkArgument(!StringUtils.isEmpty(this.name), "The name of user can't be null"); E.checkArgument(!StringUtils.isEmpty(this.password), "The password of user can't be null"); } diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java similarity index 98% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java index bf43d6af44..0018bcd2f2 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java @@ -33,6 +33,8 @@ import com.codahale.metrics.annotation.Timed; +import io.swagger.v3.oas.annotations.tags.Tag; + import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; @@ -47,6 +49,7 @@ @Path("graphs/{graph}/cypher") @Singleton +@Tag(name = "CypherAPI") public class CypherAPI extends API { private static final Logger LOG = Log.logger(CypherAPI.class); diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherManager.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherManager.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherManager.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherManager.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java new file mode 100644 index 0000000000..0b864e4b22 --- /dev/null +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hugegraph.api.filter; + +import static org.apache.hugegraph.api.filter.PathFilter.REQUEST_TIME; +import static org.apache.hugegraph.metrics.MetricsUtil.METRICS_PATH_FAILED_COUNTER; +import static org.apache.hugegraph.metrics.MetricsUtil.METRICS_PATH_RESPONSE_TIME_HISTOGRAM; +import static org.apache.hugegraph.metrics.MetricsUtil.METRICS_PATH_SUCCESS_COUNTER; +import static org.apache.hugegraph.metrics.MetricsUtil.METRICS_PATH_TOTAL_COUNTER; + +import java.io.IOException; +import java.net.URI; + +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.config.ServerOptions; +import org.apache.hugegraph.metrics.MetricsUtil; +import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import jakarta.inject.Singleton; +import jakarta.ws.rs.HttpMethod; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerResponseContext; +import jakarta.ws.rs.container.ContainerResponseFilter; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.ext.Provider; + +// TODO: should add test for this class +@Provider +@Singleton +public class AccessLogFilter implements ContainerResponseFilter { + + private static final Logger LOG = Log.logger(AccessLogFilter.class); + + private static final String DELIMITER = "/"; + private static final String GRAPHS = "graphs"; + private static final String GREMLIN = "gremlin"; + private static final String CYPHER = "cypher"; + + @Context + private jakarta.inject.Provider configProvider; + + public static boolean needRecordLog(ContainerRequestContext context) { + // TODO: add test for 'path' result ('/gremlin' or 'gremlin') + String path = context.getUriInfo().getPath(); + + // GraphsAPI/CypherAPI/Job GremlinAPI + if (path.startsWith(GRAPHS)) { + if (HttpMethod.GET.equals(context.getMethod()) || path.endsWith(CYPHER)) { + return true; + } + } + // Direct GremlinAPI + return path.endsWith(GREMLIN); + } + + private String join(String path1, String path2) { + return String.join(DELIMITER, path1, path2); + } + + /** + * Use filter to log request info + * + * @param requestContext requestContext + * @param responseContext responseContext + */ + @Override + public void filter(ContainerRequestContext requestContext, + ContainerResponseContext responseContext) throws IOException { + // Grab corresponding request / response info from context; + URI uri = requestContext.getUriInfo().getRequestUri(); + String path = uri.getRawPath(); + String method = requestContext.getMethod(); + String metricsName = join(path, method); + + MetricsUtil.registerCounter(join(metricsName, METRICS_PATH_TOTAL_COUNTER)).inc(); + if (statusOk(responseContext.getStatus())) { + MetricsUtil.registerCounter(join(metricsName, METRICS_PATH_SUCCESS_COUNTER)).inc(); + } else { + MetricsUtil.registerCounter(join(metricsName, METRICS_PATH_FAILED_COUNTER)).inc(); + } + + Object requestTime = requestContext.getProperty(REQUEST_TIME); + if (requestTime != null) { + long now = System.currentTimeMillis(); + long start = (Long) requestTime; + long executeTime = now - start; + + MetricsUtil.registerHistogram(join(metricsName, METRICS_PATH_RESPONSE_TIME_HISTOGRAM)) + .update(executeTime); + + HugeConfig config = configProvider.get(); + long timeThreshold = config.get(ServerOptions.SLOW_QUERY_LOG_TIME_THRESHOLD); + // Record slow query if meet needs, watch out the perf + if (timeThreshold > 0 && executeTime > timeThreshold && + needRecordLog(requestContext)) { + // TODO: set RequestBody null, handle it later & should record "client IP" + LOG.info("[Slow Query] execTime={}ms, body={}, method={}, path={}, query={}", + executeTime, null, method, path, uri.getQuery()); + } + } + } + + private boolean statusOk(int status) { + return status >= 200 && status < 300; + } +} diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java similarity index 87% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java index f534a0ac9a..d3da3af6d0 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java @@ -17,14 +17,38 @@ package org.apache.hugegraph.api.filter; +import static org.apache.hugegraph.config.ServerOptions.WHITE_IP_STATUS; + import java.io.IOException; import java.security.Principal; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.Set; + +import javax.xml.bind.DatatypeConverter; + +import org.apache.hugegraph.auth.HugeAuthenticator; +import org.apache.hugegraph.auth.HugeAuthenticator.RequiredPerm; +import org.apache.hugegraph.auth.HugeAuthenticator.RolePerm; +import org.apache.hugegraph.auth.HugeAuthenticator.User; +import org.apache.hugegraph.auth.RolePermission; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.server.auth.AuthenticationException; +import org.glassfish.grizzly.http.server.Request; +import org.glassfish.grizzly.utils.Charsets; +import org.slf4j.Logger; + +import com.alipay.remoting.util.StringUtils; +import com.google.common.collect.ImmutableList; import jakarta.annotation.Priority; import jakarta.ws.rs.BadRequestException; +import jakarta.ws.rs.ForbiddenException; import jakarta.ws.rs.NotAuthorizedException; import jakarta.ws.rs.Priorities; import jakarta.ws.rs.container.ContainerRequestContext; @@ -35,23 +59,6 @@ import jakarta.ws.rs.core.SecurityContext; import jakarta.ws.rs.core.UriInfo; import jakarta.ws.rs.ext.Provider; -import javax.xml.bind.DatatypeConverter; - -import org.apache.commons.lang3.StringUtils; -import org.apache.tinkerpop.gremlin.server.auth.AuthenticationException; -import org.glassfish.grizzly.http.server.Request; -import org.glassfish.grizzly.utils.Charsets; -import org.slf4j.Logger; - -import org.apache.hugegraph.auth.HugeAuthenticator; -import org.apache.hugegraph.auth.HugeAuthenticator.RequiredPerm; -import org.apache.hugegraph.auth.HugeAuthenticator.RolePerm; -import org.apache.hugegraph.auth.HugeAuthenticator.User; -import org.apache.hugegraph.auth.RolePermission; -import org.apache.hugegraph.core.GraphManager; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import com.google.common.collect.ImmutableList; @Provider @PreMatching @@ -65,15 +72,24 @@ public class AuthenticationFilter implements ContainerRequestFilter { private static final List WHITE_API_LIST = ImmutableList.of( "auth/login", - "versions" + "versions", + "openapi.json" ); + private static String whiteIpStatus; + + private static final String STRING_WHITE_IP_LIST = "whiteiplist"; + private static final String STRING_ENABLE = "enable"; + @Context private jakarta.inject.Provider managerProvider; @Context private jakarta.inject.Provider requestProvider; + @Context + private jakarta.inject.Provider configProvider; + @Override public void filter(ContainerRequestContext context) throws IOException { if (AuthenticationFilter.isWhiteAPI(context)) { @@ -102,6 +118,26 @@ protected User authenticate(ContainerRequestContext context) { path = request.getRequestURI(); } + // Check whiteIp + if (whiteIpStatus == null) { + whiteIpStatus = this.configProvider.get().get(WHITE_IP_STATUS); + } + + if (Objects.equals(whiteIpStatus, STRING_ENABLE) && request != null) { + peer = request.getRemoteAddr() + ":" + request.getRemotePort(); + path = request.getRequestURI(); + + String remoteIp = request.getRemoteAddr(); + Set whiteIpList = manager.authManager().listWhiteIPs(); + boolean whiteIpEnabled = manager.authManager().getWhiteIpStatus(); + if (!path.contains(STRING_WHITE_IP_LIST) && whiteIpEnabled && + !whiteIpList.contains(remoteIp)) { + throw new ForbiddenException( + String.format("Remote ip '%s' is not permitted", + remoteIp)); + } + } + Map credentials = new HashMap<>(); // Extract authentication credentials String auth = context.getHeaderString(HttpHeaders.AUTHORIZATION); diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/PathFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/PathFilter.java new file mode 100644 index 0000000000..e7520f84fb --- /dev/null +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/PathFilter.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hugegraph.api.filter; + +import java.io.IOException; + +import jakarta.inject.Singleton; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerRequestFilter; +import jakarta.ws.rs.container.PreMatching; +import jakarta.ws.rs.ext.Provider; + +@Provider +@Singleton +@PreMatching +public class PathFilter implements ContainerRequestFilter { + + public static final String REQUEST_TIME = "request_time"; + public static final String REQUEST_PARAMS_JSON = "request_params_json"; + + @Override + public void filter(ContainerRequestContext context) throws IOException { + context.setProperty(REQUEST_TIME, System.currentTimeMillis()); + + // TODO: temporarily comment it to fix loader bug, handle it later + /*// record the request json + String method = context.getMethod(); + String requestParamsJson = ""; + if (method.equals(HttpMethod.POST)) { + requestParamsJson = IOUtils.toString(context.getEntityStream(), + Charsets.toCharset(CHARSET)); + // replace input stream because we have already read it + InputStream in = IOUtils.toInputStream(requestParamsJson, Charsets.toCharset(CHARSET)); + context.setEntityStream(in); + } else if (method.equals(HttpMethod.GET)) { + MultivaluedMap pathParameters = context.getUriInfo() + .getPathParameters(); + requestParamsJson = pathParameters.toString(); + } + + context.setProperty(REQUEST_PARAMS_JSON, requestParamsJson);*/ + } +} diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java similarity index 93% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java index e675dd9554..3fdfd7689c 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java @@ -82,16 +82,16 @@ public void filter(ContainerRequestContext context) throws IOException { return; } - GlobalMasterInfo globalMasterInfo = manager.globalMasterInfo(); - if (globalMasterInfo == null || !globalMasterInfo.isFeatureSupport()) { + GlobalMasterInfo globalNodeInfo = manager.globalNodeRoleInfo(); + if (globalNodeInfo == null || !globalNodeInfo.supportElection()) { return; } - GlobalMasterInfo.NodeInfo masterNodeInfo = globalMasterInfo.nodeInfo(); - if (masterNodeInfo == null || masterNodeInfo.isMaster() || - StringUtils.isEmpty(masterNodeInfo.url())) { + GlobalMasterInfo.NodeInfo masterInfo = globalNodeInfo.masterInfo(); + if (masterInfo == null || masterInfo.isMaster() || + StringUtils.isEmpty(masterInfo.nodeUrl())) { return; } - String url = masterNodeInfo.url(); + String url = masterInfo.nodeUrl(); URI redirectUri; try { diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilterDynamicFeature.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilterDynamicFeature.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilterDynamicFeature.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilterDynamicFeature.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java new file mode 100644 index 0000000000..181abc46d5 --- /dev/null +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java @@ -0,0 +1,158 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hugegraph.api.gremlin; + +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.pool.PoolStats; +import org.apache.hugegraph.util.ExecutorUtil; +import org.glassfish.jersey.apache.connector.ApacheClientProperties; +import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.JerseyClientBuilder; +import org.glassfish.jersey.message.GZipEncoder; + +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.WebTarget; + +/** + * This class is a simplified class of AbstractRestClient from hugegraph-common. + * For some reason, we replace the rest implementation from jersey to okhttp. + * But GremlinClient still uses jersey-client to forward request, so we copy the old + * AbstractRestClient from hugegraph-common and rename the name to AbstractJerseyRestClient. + * Because we don't need the full feature of AbstractRestClient, so we reduce some useless code. + */ +public abstract class AbstractJerseyRestClient { + + /** + * Time unit: hour + */ + private static final long TTL = 24L; + /** + * Time unit: ms + */ + private static final long IDLE_TIME = 40L * 1000L; + private static final String PROPERTY_MAX_TOTAL = "maxTotal"; + private static final String PROPERTY_MAX_PER_ROUTE = "maxPerRoute"; + private static final String PROPERTY_IDLE_TIME = "idleTime"; + private static final String CONNECTION_MANAGER = ApacheClientProperties.CONNECTION_MANAGER; + + private final Client client; + private final WebTarget webTarget; + private final PoolingHttpClientConnectionManager pool; + private ScheduledExecutorService cleanExecutor; + + public AbstractJerseyRestClient(String url, int timeout, int maxTotal, int maxPerRoute) { + this(url, new ConfigBuilder().configTimeout(timeout) + .configPool(maxTotal, maxPerRoute) + .build()); + } + + public AbstractJerseyRestClient(String url, ClientConfig config) { + this.pool = configConnectionManager(config); + + this.client = JerseyClientBuilder.newClient(config); + this.client.register(GZipEncoder.class); + this.webTarget = this.client.target(url); + + cleanThreadPoolExecutor(config); + } + + private static PoolingHttpClientConnectionManager configConnectionManager(ClientConfig conf) { + /* + * Using httpclient with connection pooling, and configuring the + * jersey connector. But the jersey that has been released in the maven central + * repository seems to have a bug: https://github.com/jersey/jersey/pull/3752 + */ + PoolingHttpClientConnectionManager pool = + new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS); + Integer maxTotal = (Integer) conf.getProperty(PROPERTY_MAX_TOTAL); + Integer maxPerRoute = (Integer) conf.getProperty(PROPERTY_MAX_PER_ROUTE); + + if (maxTotal != null) { + pool.setMaxTotal(maxTotal); + } + if (maxPerRoute != null) { + pool.setDefaultMaxPerRoute(maxPerRoute); + } + conf.property(CONNECTION_MANAGER, pool); + conf.connectorProvider(new ApacheConnectorProvider()); + return pool; + } + + private void cleanThreadPoolExecutor(ClientConfig config) { + this.cleanExecutor = ExecutorUtil.newScheduledThreadPool("conn-clean-worker-%d"); + Number idleTimeProp = (Number) config.getProperty(PROPERTY_IDLE_TIME); + final long idleTime = idleTimeProp == null ? IDLE_TIME : idleTimeProp.longValue(); + final long checkPeriod = idleTime / 2L; + this.cleanExecutor.scheduleWithFixedDelay(() -> { + PoolStats stats = this.pool.getTotalStats(); + int using = stats.getLeased() + stats.getPending(); + if (using > 0) { + // Do clean only when all connections are idle + return; + } + // Release connections when all clients are inactive + this.pool.closeIdleConnections(idleTime, TimeUnit.MILLISECONDS); + this.pool.closeExpiredConnections(); + }, checkPeriod, checkPeriod, TimeUnit.MILLISECONDS); + } + + protected WebTarget getWebTarget() { + return this.webTarget; + } + + public void close() { + try { + if (this.pool != null) { + this.pool.close(); + this.cleanExecutor.shutdownNow(); + } + } finally { + this.client.close(); + } + } + + private static class ConfigBuilder { + + private final ClientConfig config; + + ConfigBuilder() { + this.config = new ClientConfig(); + } + + public ConfigBuilder configTimeout(int timeout) { + this.config.property(ClientProperties.CONNECT_TIMEOUT, timeout); + this.config.property(ClientProperties.READ_TIMEOUT, timeout); + return this; + } + + public ConfigBuilder configPool(int maxTotal, int maxPerRoute) { + this.config.property(PROPERTY_MAX_TOTAL, maxTotal); + this.config.property(PROPERTY_MAX_PER_ROUTE, maxPerRoute); + return this; + } + + public ClientConfig build() { + return this.config; + } + } +} diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java similarity index 98% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java index 50df7e93d4..fae75ca95d 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java @@ -52,7 +52,6 @@ public class GremlinAPI extends GremlinQueryAPI { @Compress @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON_WITH_CHARSET) - @RedirectFilter.RedirectMasterRole public Response post(@Context HugeConfig conf, @Context HttpHeaders headers, String request) { diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinClient.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinClient.java similarity index 55% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinClient.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinClient.java index 793884e4da..72af6e8cb1 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinClient.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinClient.java @@ -20,6 +20,9 @@ import java.util.List; import java.util.Map; +import org.apache.hugegraph.api.filter.CompressInterceptor; +import org.apache.hugegraph.util.E; + import jakarta.ws.rs.client.Entity; import jakarta.ws.rs.client.WebTarget; import jakarta.ws.rs.core.HttpHeaders; @@ -27,43 +30,52 @@ import jakarta.ws.rs.core.MultivaluedMap; import jakarta.ws.rs.core.Response; -import org.apache.hugegraph.api.filter.CompressInterceptor; -import org.apache.hugegraph.rest.AbstractRestClient; -import org.apache.hugegraph.testutil.Whitebox; -import org.apache.hugegraph.util.E; - -public class GremlinClient extends AbstractRestClient { - - private final WebTarget webTarget; +/** + * GremlinClient is a client for interacting with a Gremlin server. + * It extends the AbstractJerseyRestClient and provides methods for sending GET and POST requests. + */ +public class GremlinClient extends AbstractJerseyRestClient { - public GremlinClient(String url, int timeout, - int maxTotal, int maxPerRoute) { + /** + * Constructs a GremlinClient with the specified URL, timeout, maxTotal, and maxPerRoute. + * + * @param url The URL of the Gremlin server this client will interact with. + * @param timeout The timeout for the client. + * @param maxTotal The maximum total connections for the client. + * @param maxPerRoute The maximum connections per route for the client. + */ + public GremlinClient(String url, int timeout, int maxTotal, int maxPerRoute) { super(url, timeout, maxTotal, maxPerRoute); - this.webTarget = Whitebox.getInternalState(this, "target"); - E.checkNotNull(this.webTarget, "target"); - } - - @Override - protected void checkStatus(Response response, Response.Status... statuses) { - // pass } + /** + * Sends a POST request to the Gremlin server. + * + * @param auth The authorization token for the request. + * @param req The body of the request. + * @return The response from the server. + */ public Response doPostRequest(String auth, String req) { Entity body = Entity.entity(req, MediaType.APPLICATION_JSON); - return this.webTarget.request() - .header(HttpHeaders.AUTHORIZATION, auth) - .accept(MediaType.APPLICATION_JSON) - .acceptEncoding(CompressInterceptor.GZIP) - .post(body); + return this.getWebTarget().request() + .header(HttpHeaders.AUTHORIZATION, auth) + .accept(MediaType.APPLICATION_JSON) + .acceptEncoding(CompressInterceptor.GZIP) + .post(body); } - public Response doGetRequest(String auth, - MultivaluedMap params) { - WebTarget target = this.webTarget; + /** + * Sends a GET request to the Gremlin server. + * + * @param auth The authorization token for the request. + * @param params The query parameters for the request. + * @return The response from the server. + */ + public Response doGetRequest(String auth, MultivaluedMap params) { + WebTarget target = this.getWebTarget(); for (Map.Entry> entry : params.entrySet()) { E.checkArgument(entry.getValue().size() == 1, - "Invalid query param '%s', can only accept " + - "one value, but got %s", + "Invalid query param '%s', can only accept one value, but got %s", entry.getKey(), entry.getValue()); target = target.queryParam(entry.getKey(), entry.getValue().get(0)); } diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java similarity index 97% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java index 8e0e7d10c3..8341adad8b 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java @@ -36,6 +36,8 @@ import com.codahale.metrics.annotation.Timed; import com.google.common.collect.ImmutableMap; +import io.swagger.v3.oas.annotations.tags.Tag; + import jakarta.inject.Singleton; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.NotFoundException; @@ -47,6 +49,7 @@ @Path("graphs/{graph}/jobs/algorithm") @Singleton +@Tag(name = "AlgorithmAPI") public class AlgorithmAPI extends API { private static final Logger LOG = Log.logger(RestServer.class); diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/ComputerAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/ComputerAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/job/ComputerAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/ComputerAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/RebuildAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/RebuildAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/job/RebuildAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/RebuildAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java new file mode 100644 index 0000000000..952ac90eeb --- /dev/null +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java @@ -0,0 +1,430 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hugegraph.api.metrics; + +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.hugegraph.metrics.MetricsUtil.COUNT_ATTR; +import static org.apache.hugegraph.metrics.MetricsUtil.END_LSTR; +import static org.apache.hugegraph.metrics.MetricsUtil.FIFT_MIN_RATE_ATRR; +import static org.apache.hugegraph.metrics.MetricsUtil.FIVE_MIN_RATE_ATRR; +import static org.apache.hugegraph.metrics.MetricsUtil.GAUGE_TYPE; +import static org.apache.hugegraph.metrics.MetricsUtil.HISTOGRAM_TYPE; +import static org.apache.hugegraph.metrics.MetricsUtil.LEFT_NAME_STR; +import static org.apache.hugegraph.metrics.MetricsUtil.MEAN_RATE_ATRR; +import static org.apache.hugegraph.metrics.MetricsUtil.METRICS_PATH_FAILED_COUNTER; +import static org.apache.hugegraph.metrics.MetricsUtil.METRICS_PATH_RESPONSE_TIME_HISTOGRAM; +import static org.apache.hugegraph.metrics.MetricsUtil.METRICS_PATH_SUCCESS_COUNTER; +import static org.apache.hugegraph.metrics.MetricsUtil.METRICS_PATH_TOTAL_COUNTER; +import static org.apache.hugegraph.metrics.MetricsUtil.ONE_MIN_RATE_ATRR; +import static org.apache.hugegraph.metrics.MetricsUtil.PROM_HELP_NAME; +import static org.apache.hugegraph.metrics.MetricsUtil.RIGHT_NAME_STR; +import static org.apache.hugegraph.metrics.MetricsUtil.SPACE_STR; +import static org.apache.hugegraph.metrics.MetricsUtil.STR_HELP; +import static org.apache.hugegraph.metrics.MetricsUtil.STR_TYPE; +import static org.apache.hugegraph.metrics.MetricsUtil.UNTYPED; +import static org.apache.hugegraph.metrics.MetricsUtil.VERSION_STR; +import static org.apache.hugegraph.metrics.MetricsUtil.exportSnapshot; +import static org.apache.hugegraph.metrics.MetricsUtil.replaceDotDashInKey; +import static org.apache.hugegraph.metrics.MetricsUtil.replaceSlashInKey; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.backend.store.BackendMetrics; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.metrics.MetricsKeys; +import org.apache.hugegraph.metrics.MetricsModule; +import org.apache.hugegraph.metrics.MetricsUtil; +import org.apache.hugegraph.metrics.ServerReporter; +import org.apache.hugegraph.metrics.SystemMetrics; +import org.apache.hugegraph.util.InsertionOrderUtil; +import org.apache.hugegraph.util.JsonUtil; +import org.apache.hugegraph.util.Log; +import org.apache.hugegraph.version.ApiVersion; +import org.apache.tinkerpop.gremlin.server.util.MetricManager; +import org.slf4j.Logger; + +import com.codahale.metrics.Counter; +import com.codahale.metrics.Gauge; +import com.codahale.metrics.Histogram; +import com.codahale.metrics.Meter; +import com.codahale.metrics.Metric; +import com.codahale.metrics.annotation.Timed; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; + +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + +@Singleton +@Path("metrics") +@Tag(name = "MetricsAPI") +public class MetricsAPI extends API { + + private static final Logger LOG = Log.logger(MetricsAPI.class); + + private static final String JSON_STR = "json"; + + static { + JsonUtil.registerModule(new MetricsModule(SECONDS, MILLISECONDS, false)); + } + + private final SystemMetrics systemMetrics; + + public MetricsAPI() { + this.systemMetrics = new SystemMetrics(); + } + + @GET + @Timed + @Path("system") + @Produces(APPLICATION_JSON_WITH_CHARSET) + @RolesAllowed({"admin", "$owner= $action=metrics_read"}) + @Operation(summary = "get the system metrics") + public String system() { + return JsonUtil.toJson(this.systemMetrics.metrics()); + } + + @GET + @Timed + @Path("backend") + @Produces(APPLICATION_JSON_WITH_CHARSET) + @RolesAllowed({"admin", "$owner= $action=metrics_read"}) + @Operation(summary = "get the backend metrics") + public String backend(@Context GraphManager manager) { + Map> results = InsertionOrderUtil.newMap(); + for (String graph : manager.graphs()) { + HugeGraph g = manager.graph(graph); + Map metrics = InsertionOrderUtil.newMap(); + metrics.put(BackendMetrics.BACKEND, g.backend()); + try { + metrics.putAll(g.metadata(null, "metrics")); + } catch (Throwable e) { + metrics.put(BackendMetrics.EXCEPTION, e.toString()); + LOG.debug("Failed to get backend metrics", e); + } + results.put(graph, metrics); + } + return JsonUtil.toJson(results); + } + + @GET + @Timed + @Path("gauges") + @Produces(APPLICATION_JSON_WITH_CHARSET) + @RolesAllowed({"admin", "$owner= $action=metrics_read"}) + @Operation(summary = "get the gauges metrics") + public String gauges() { + ServerReporter reporter = ServerReporter.instance(); + return JsonUtil.toJson(reporter.gauges()); + } + + @GET + @Timed + @Path("counters") + @Produces(APPLICATION_JSON_WITH_CHARSET) + @RolesAllowed({"admin", "$owner= $action=metrics_read"}) + @Operation(summary = "get the counters metrics") + public String counters() { + ServerReporter reporter = ServerReporter.instance(); + return JsonUtil.toJson(reporter.counters()); + } + + @GET + @Timed + @Path("histograms") + @Produces(APPLICATION_JSON_WITH_CHARSET) + @RolesAllowed({"admin", "$owner= $action=metrics_read"}) + @Operation(summary = "get the histograms metrics") + public String histograms() { + ServerReporter reporter = ServerReporter.instance(); + return JsonUtil.toJson(reporter.histograms()); + } + + @GET + @Timed + @Path("meters") + @Produces(APPLICATION_JSON_WITH_CHARSET) + @RolesAllowed({"admin", "$owner= $action=metrics_read"}) + @Operation(summary = "get the meters metrics") + public String meters() { + ServerReporter reporter = ServerReporter.instance(); + return JsonUtil.toJson(reporter.meters()); + } + + @GET + @Timed + @Path("timers") + @Produces(APPLICATION_JSON_WITH_CHARSET) + @RolesAllowed({"admin", "$owner= $action=metrics_read"}) + @Operation(summary = "get the timers metrics") + public String timers() { + ServerReporter reporter = ServerReporter.instance(); + return JsonUtil.toJson(reporter.timers()); + } + + @GET + @Timed + @Produces(APPLICATION_TEXT_WITH_CHARSET) + @RolesAllowed({"admin", "$owner= $action=metrics_read"}) + @Operation(summary = "get all base metrics") + public String all(@Context GraphManager manager, + @QueryParam("type") String type) { + if (type != null && type.equals(JSON_STR)) { + return baseMetricAll(); + } else { + return baseMetricPrometheusAll(); + } + } + + @GET + @Path("statistics") + @Timed + @Produces(APPLICATION_TEXT_WITH_CHARSET) + @RolesAllowed({"admin", "$owner= $action=metrics_read"}) + @Operation(summary = "get all statistics metrics") + public String statistics(@QueryParam("type") String type) { + Map> metricMap = statistics(); + + if (type != null && type.equals(JSON_STR)) { + return JsonUtil.toJson(metricMap); + } + return statisticsProm(metricMap); + } + + public String baseMetricAll() { + ServerReporter reporter = ServerReporter.instance(); + Map> result = new LinkedHashMap<>(); + result.put("gauges", reporter.gauges()); + result.put("counters", reporter.counters()); + result.put("histograms", reporter.histograms()); + result.put("meters", reporter.meters()); + result.put("timers", reporter.timers()); + return JsonUtil.toJson(result); + } + + private String baseMetricPrometheusAll() { + StringBuilder promMetric = new StringBuilder(); + ServerReporter reporter = ServerReporter.instance(); + String helpName = PROM_HELP_NAME; + // build version info + promMetric.append(STR_HELP) + .append(helpName).append(END_LSTR); + promMetric.append(STR_TYPE) + .append(helpName) + .append(SPACE_STR + UNTYPED + END_LSTR); + promMetric.append(helpName) + .append(VERSION_STR) + .append(ApiVersion.VERSION.toString()).append("\",}") + .append(SPACE_STR + "1.0" + END_LSTR); + + // build gauges metric info + for (String key : reporter.gauges().keySet()) { + final Gauge gauge + = reporter.gauges().get(key); + if (gauge != null) { + helpName = replaceDotDashInKey(key); + promMetric.append(STR_HELP) + .append(helpName).append(END_LSTR); + promMetric.append(STR_TYPE) + .append(helpName).append(SPACE_STR + GAUGE_TYPE + END_LSTR); + promMetric.append(helpName) + .append(SPACE_STR + gauge.getValue() + END_LSTR); + } + } + + // build histograms metric info + for (String histogramkey : reporter.histograms().keySet()) { + final Histogram histogram = reporter.histograms().get(histogramkey); + if (histogram != null) { + helpName = replaceDotDashInKey(histogramkey); + promMetric.append(STR_HELP) + .append(helpName).append(END_LSTR); + promMetric.append(STR_TYPE) + .append(helpName) + .append(SPACE_STR + HISTOGRAM_TYPE + END_LSTR); + + promMetric.append(helpName) + .append(COUNT_ATTR) + .append(histogram.getCount() + END_LSTR); + promMetric.append( + exportSnapshot(helpName, histogram.getSnapshot())); + } + } + + // build meters metric info + for (String meterkey : reporter.meters().keySet()) { + final Meter metric = reporter.meters().get(meterkey); + if (metric != null) { + helpName = replaceDotDashInKey(meterkey); + promMetric.append(STR_HELP) + .append(helpName).append(END_LSTR); + promMetric.append(STR_TYPE) + .append(helpName) + .append(SPACE_STR + HISTOGRAM_TYPE + END_LSTR); + + promMetric.append(helpName) + .append(COUNT_ATTR) + .append(metric.getCount() + END_LSTR); + promMetric.append(helpName) + .append(MEAN_RATE_ATRR) + .append(metric.getMeanRate() + END_LSTR); + promMetric.append(helpName) + .append(ONE_MIN_RATE_ATRR) + .append(metric.getOneMinuteRate() + END_LSTR); + promMetric.append(helpName) + .append(FIVE_MIN_RATE_ATRR) + .append(metric.getFiveMinuteRate() + END_LSTR); + promMetric.append(helpName) + .append(FIFT_MIN_RATE_ATRR) + .append(metric.getFifteenMinuteRate() + END_LSTR); + } + } + + // build timer metric info + for (String timerkey : reporter.timers().keySet()) { + final com.codahale.metrics.Timer timer = reporter.timers() + .get(timerkey); + if (timer != null) { + helpName = replaceDotDashInKey(timerkey); + promMetric.append(STR_HELP) + .append(helpName).append(END_LSTR); + promMetric.append(STR_TYPE) + .append(helpName) + .append(SPACE_STR + HISTOGRAM_TYPE + END_LSTR); + + promMetric.append(helpName) + .append(COUNT_ATTR) + .append(timer.getCount() + END_LSTR); + promMetric.append(helpName) + .append(ONE_MIN_RATE_ATRR) + .append(timer.getOneMinuteRate() + END_LSTR); + promMetric.append(helpName) + .append(FIVE_MIN_RATE_ATRR) + .append(timer.getFiveMinuteRate() + END_LSTR); + promMetric.append(helpName) + .append(FIFT_MIN_RATE_ATRR) + .append(timer.getFifteenMinuteRate() + END_LSTR); + promMetric.append( + exportSnapshot(helpName, timer.getSnapshot())); + } + } + + MetricsUtil.writePrometheusFormat(promMetric, MetricManager.INSTANCE.getRegistry()); + + return promMetric.toString(); + } + + private Map> statistics() { + Map> metricsMap = new HashMap<>(); + ServerReporter reporter = ServerReporter.instance(); + for (Map.Entry entry : reporter.histograms().entrySet()) { + // entryKey = path/method/responseTimeHistogram + String entryKey = entry.getKey(); + String[] split = entryKey.split("/"); + String lastWord = split[split.length - 1]; + if (!lastWord.equals(METRICS_PATH_RESPONSE_TIME_HISTOGRAM)) { + // original metrics dont report + continue; + } + // metricsName = path/method + String metricsName = + entryKey.substring(0, entryKey.length() - lastWord.length() - 1); + + Counter totalCounter = reporter.counters().get( + joinWithSlash(metricsName, METRICS_PATH_TOTAL_COUNTER)); + Counter failedCounter = reporter.counters().get( + joinWithSlash(metricsName, METRICS_PATH_FAILED_COUNTER)); + Counter successCounter = reporter.counters().get( + joinWithSlash(metricsName, METRICS_PATH_SUCCESS_COUNTER)); + + + Histogram histogram = entry.getValue(); + Map entryMetricsMap = new HashMap<>(); + entryMetricsMap.put(MetricsKeys.MAX_RESPONSE_TIME.name(), + histogram.getSnapshot().getMax()); + entryMetricsMap.put(MetricsKeys.MEAN_RESPONSE_TIME.name(), + histogram.getSnapshot().getMean()); + + entryMetricsMap.put(MetricsKeys.TOTAL_REQUEST.name(), + totalCounter.getCount()); + + if (failedCounter == null) { + entryMetricsMap.put(MetricsKeys.FAILED_REQUEST.name(), 0); + } else { + entryMetricsMap.put(MetricsKeys.FAILED_REQUEST.name(), + failedCounter.getCount()); + } + + if (successCounter == null) { + entryMetricsMap.put(MetricsKeys.SUCCESS_REQUEST.name(), 0); + } else { + entryMetricsMap.put(MetricsKeys.SUCCESS_REQUEST.name(), + successCounter.getCount()); + } + + metricsMap.put(metricsName, entryMetricsMap); + + } + return metricsMap; + } + + private String statisticsProm(Map> metricMap) { + StringBuilder promMetric = new StringBuilder(); + + // build version info + promMetric.append(STR_HELP) + .append(PROM_HELP_NAME).append(END_LSTR); + promMetric.append(STR_TYPE) + .append(PROM_HELP_NAME) + .append(SPACE_STR + UNTYPED + END_LSTR); + promMetric.append(PROM_HELP_NAME) + .append(VERSION_STR) + .append(ApiVersion.VERSION.toString()).append("\",}") + .append(SPACE_STR + "1.0" + END_LSTR); + + for (String methodKey : metricMap.keySet()) { + String metricName = replaceSlashInKey(methodKey); + promMetric.append(STR_HELP) + .append(metricName).append(END_LSTR); + promMetric.append(STR_TYPE) + .append(metricName).append(SPACE_STR + GAUGE_TYPE + END_LSTR); + Map itemMetricMap = metricMap.get(methodKey); + for (String labelName : itemMetricMap.keySet()) { + promMetric.append(metricName).append(LEFT_NAME_STR).append(labelName) + .append(RIGHT_NAME_STR).append(itemMetricMap.get(labelName)) + .append(END_LSTR); + } + } + return promMetric.toString(); + } + + private String joinWithSlash(String path1, String path2) { + return String.join("/", path1, path2); + } +} diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java new file mode 100644 index 0000000000..860da55750 --- /dev/null +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java @@ -0,0 +1,161 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hugegraph.api.profile; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.commons.lang.StringUtils; +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.api.filter.StatusFilter; +import org.apache.hugegraph.auth.AuthManager; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; + +import com.codahale.metrics.annotation.Timed; +import com.google.common.collect.ImmutableMap; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.security.RolesAllowed; +import jakarta.inject.Singleton; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + +@Path("whiteiplist") +@Singleton +@Tag(name = "WhiteIpListAPI") +public class WhiteIpListAPI extends API { + + private static final Logger LOG = Log.logger(WhiteIpListAPI.class); + + @GET + @Timed + @Produces(APPLICATION_JSON_WITH_CHARSET) + @RolesAllowed("admin") + @Operation(summary = "list white ips") + public Map list(@Context GraphManager manager) { + LOG.debug("List white ips"); + AuthManager authManager = manager.authManager(); + Set whiteIpList = authManager.listWhiteIPs(); + return ImmutableMap.of("whiteIpList", whiteIpList); + } + + @POST + @Timed + @StatusFilter.Status(StatusFilter.Status.ACCEPTED) + @Consumes(APPLICATION_JSON) + @Produces(APPLICATION_JSON_WITH_CHARSET) + @RolesAllowed("admin") + @Operation(summary = "update white ip list") + public Map updateWhiteIPs(@Context GraphManager manager, Map actionMap) { + E.checkArgument(actionMap != null, + "Missing argument: actionMap"); + Set whiteIpList = manager.authManager().listWhiteIPs(); + Object ipListRaw = actionMap.get("ips"); + E.checkArgument(ipListRaw instanceof List, + "Invalid ips type '%s', must be list", ipListRaw.getClass()); + List ipList = (List) ipListRaw; + Object actionRaw = actionMap.get("action"); + E.checkArgument(actionRaw != null, + "Missing argument: action"); + E.checkArgument(actionRaw instanceof String, + "Invalid action type '%s', must be string", + actionRaw.getClass()); + String action = (String) actionRaw; + E.checkArgument(StringUtils.isNotEmpty(action), + "Missing argument: action"); + Set existedIPs = new HashSet<>(); + Set loadedIPs = new HashSet<>(); + Set illegalIPs = new HashSet<>(); + Map result = new HashMap<>(); + for (String ip : ipList) { + if (whiteIpList.contains(ip)) { + existedIPs.add(ip); + continue; + } + if ("load".equals(action)) { + boolean rightIp = checkIp(ip) ? loadedIPs.add(ip) : illegalIPs.add(ip); + } + } + switch (action) { + case "load": + LOG.debug("Load to white ip list"); + result.put("existed_ips", existedIPs); + result.put("added_ips", loadedIPs); + if (!illegalIPs.isEmpty()) { + result.put("illegal_ips", illegalIPs); + } + whiteIpList.addAll(loadedIPs); + break; + case "remove": + LOG.debug("Remove from white ip list"); + result.put("removed_ips", existedIPs); + result.put("non_existed_ips", loadedIPs); + whiteIpList.removeAll(existedIPs); + break; + default: + throw new AssertionError(String.format("Invalid action '%s', " + + "supported action is " + + "'load' or 'remove'", + action)); + } + manager.authManager().setWhiteIPs(whiteIpList); + return result; + } + + @PUT + @Timed + @Produces(APPLICATION_JSON_WITH_CHARSET) + @RolesAllowed("admin") + @Operation(summary = "enable/disable the white ip list") + public Map updateStatus(@Context GraphManager manager, @QueryParam("status") String status) { + LOG.debug("Enable or disable white ip list"); + E.checkArgument("true".equals(status) || + "false".equals(status), + "Invalid status, valid status is 'true' or 'false'"); + boolean open = Boolean.parseBoolean(status); + manager.authManager().enabledWhiteIpList(open); + Map map = new HashMap<>(); + map.put("WhiteIpListOpen", open); + return map; + } + + private boolean checkIp(String ipStr) { + String ip = "^(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\." + + "(00?\\d|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\." + + "(00?\\d|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\." + + "(00?\\d|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)$"; + Pattern pattern = Pattern.compile(ip); + Matcher matcher = pattern.matcher(ipStr); + return matcher.matches(); + } +} diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/EdgeLabelAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/EdgeLabelAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/EdgeLabelAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/EdgeLabelAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/IndexLabelAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/IndexLabelAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/IndexLabelAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/IndexLabelAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/PropertyKeyAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/PropertyKeyAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/PropertyKeyAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/PropertyKeyAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/SchemaAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/SchemaAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/SchemaAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/SchemaAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/VertexLabelAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/VertexLabelAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/VertexLabelAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/schema/VertexLabelAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AllShortestPathsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AllShortestPathsAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AllShortestPathsAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AllShortestPathsAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CrosspointsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CrosspointsAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CrosspointsAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CrosspointsAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CustomizedPathsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CustomizedPathsAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CustomizedPathsAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CustomizedPathsAPI.java diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java new file mode 100644 index 0000000000..4af3ff52fa --- /dev/null +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hugegraph.api.traversers; + +import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_LIMIT; + +import java.util.Iterator; + +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.api.graph.VertexAPI; +import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.core.GraphManager; +import org.apache.hugegraph.structure.HugeVertex; +import org.apache.hugegraph.traversal.algorithm.EdgeExistenceTraverser; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.slf4j.Logger; + +import com.codahale.metrics.annotation.Timed; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.inject.Singleton; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; + +@Path("graphs/{graph}/traversers/edgeexist") +@Singleton +@Tag(name = "EdgeExistenceAPI") +public class EdgeExistenceAPI extends TraverserAPI { + + private static final Logger LOG = Log.logger(EdgeExistenceAPI.class); + private static final String DEFAULT_EMPTY = ""; + + @GET + @Timed + @Produces(APPLICATION_JSON_WITH_CHARSET) + @Operation(summary = "get edges from 'source' to 'target' vertex") + public String get(@Context GraphManager manager, + @PathParam("graph") String graph, + @QueryParam("source") String source, + @QueryParam("target") String target, + @QueryParam("label") String edgeLabel, + @QueryParam("sort_values") + @DefaultValue(DEFAULT_EMPTY) String sortValues, + @QueryParam("limit") + @DefaultValue(DEFAULT_LIMIT) long limit) { + LOG.debug("Graph [{}] get edgeExistence with " + + "source '{}', target '{}', edgeLabel '{}', sortValue '{}', limit '{}'", + graph, source, target, edgeLabel, sortValues, limit); + + E.checkArgumentNotNull(source, "The source can't be null"); + E.checkArgumentNotNull(target, "The target can't be null"); + + Id sourceId = VertexAPI.checkAndParseVertexId(source); + Id targetId = VertexAPI.checkAndParseVertexId(target); + HugeGraph hugegraph = graph(manager, graph); + EdgeExistenceTraverser traverser = new EdgeExistenceTraverser(hugegraph); + Iterator edges = traverser.queryEdgeExistence(sourceId, targetId, edgeLabel, + sortValues, limit); + + return manager.serializer(hugegraph).writeEdges(edges, false); + } +} diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgesAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgesAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgesAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgesAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/FusiformSimilarityAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/FusiformSimilarityAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/FusiformSimilarityAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/FusiformSimilarityAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/JaccardSimilarityAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/JaccardSimilarityAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/JaccardSimilarityAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/JaccardSimilarityAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KneighborAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KneighborAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KneighborAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KneighborAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KoutAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KoutAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KoutAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KoutAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/MultiNodeShortestPathAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/MultiNodeShortestPathAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/MultiNodeShortestPathAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/MultiNodeShortestPathAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PathsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PathsAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PathsAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PathsAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/RaysAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/RaysAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/RaysAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/RaysAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/RingsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/RingsAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/RingsAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/RingsAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/SameNeighborsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/SameNeighborsAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/SameNeighborsAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/SameNeighborsAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ShortestPathAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ShortestPathAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ShortestPathAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ShortestPathAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/SingleSourceShortestPathAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/SingleSourceShortestPathAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/SingleSourceShortestPathAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/SingleSourceShortestPathAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/TemplatePathsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/TemplatePathsAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/TemplatePathsAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/TemplatePathsAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/TraverserAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/TraverserAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/TraverserAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/TraverserAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/VerticesAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/VerticesAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/VerticesAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/VerticesAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/WeightedShortestPathAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/WeightedShortestPathAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/WeightedShortestPathAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/WeightedShortestPathAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java similarity index 98% rename from hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java index 04cfac30d7..d22b86bab4 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java @@ -55,6 +55,7 @@ import org.apache.hugegraph.exception.NotSupportException; import org.apache.hugegraph.iterator.FilterIterator; import org.apache.hugegraph.iterator.MapperIterator; +import org.apache.hugegraph.masterelection.GlobalMasterInfo; import org.apache.hugegraph.masterelection.RoleElectionStateMachine; import org.apache.hugegraph.rpc.RpcServiceConfig4Client; import org.apache.hugegraph.rpc.RpcServiceConfig4Server; @@ -78,7 +79,6 @@ import org.apache.hugegraph.type.Nameable; import org.apache.hugegraph.type.define.GraphMode; import org.apache.hugegraph.type.define.GraphReadMode; -import org.apache.hugegraph.type.define.NodeRole; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; import org.apache.hugegraph.util.RateLimiter; @@ -669,9 +669,9 @@ public void waitReady(RpcServer rpcServer) { } @Override - public void serverStarted(Id serverId, NodeRole serverRole) { + public void serverStarted(GlobalMasterInfo nodeInfo) { this.verifyAdminPermission(); - this.hugegraph.serverStarted(serverId, serverRole); + this.hugegraph.serverStarted(nodeInfo); } @Override @@ -776,9 +776,9 @@ public void resumeSnapshot() { } @Override - public void create(String configPath, Id server, NodeRole role) { + public void create(String configPath, GlobalMasterInfo nodeInfo) { this.verifyPermission(HugePermission.WRITE, ResourceType.STATUS); - this.hugegraph.create(configPath, server, role); + this.hugegraph.create(configPath, nodeInfo); } @Override @@ -1568,6 +1568,26 @@ public UserWithRole validateUser(String token) { } } + @Override + public Set listWhiteIPs() { + return this.authManager.listWhiteIPs(); + } + + @Override + public void setWhiteIPs(Set whiteIpList) { + this.authManager.setWhiteIPs(whiteIpList); + } + + @Override + public boolean getWhiteIpStatus() { + return this.authManager.getWhiteIpStatus(); + } + + @Override + public void enabledWhiteIpList(boolean status) { + this.authManager.enabledWhiteIpList(status); + } + @Override public String loginUser(String username, String password) { try { diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java similarity index 86% rename from hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java index e66b593568..a8bbe5a5f2 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java @@ -264,4 +264,53 @@ public static synchronized ServerOptions instance() { disallowEmpty(), true ); -} \ No newline at end of file + + public static final ConfigOption WHITE_IP_STATUS = + new ConfigOption<>( + "white_ip.status", + "The status of whether enable white ip.", + disallowEmpty(), + "disable" + ); + + public static final ConfigOption ARTHAS_TELNET_PORT = + new ConfigOption<>( + "arthas.telnet_port", + "The telnet port provided by Arthas, it can be accessible from the outside.", + disallowEmpty(), + "8562" + ); + + public static final ConfigOption ARTHAS_HTTP_PORT = + new ConfigOption<>( + "arthas.http_port", + "The HTTP port provided by Arthas, it can be accessible from the outside.", + disallowEmpty(), + "8561" + ); + + public static final ConfigOption ARTHAS_IP = + new ConfigOption<>( + "arthas.ip", + "The IP provided by Arthas, it can be accessible from the outside.", + disallowEmpty(), + "0.0.0.0" + ); + + public static final ConfigOption ARTHAS_DISABLED_COMMANDS = + new ConfigOption<>( + "arthas.disabled_commands", + "The disabled Arthas commands due to high risk.", + null, + "jad" + ); + + public static final ConfigOption SLOW_QUERY_LOG_TIME_THRESHOLD = + new ConfigOption<>( + "log.slow_query_threshold", + "The threshold time(ms) of logging slow query, " + + "0 means logging slow query is disabled.", + nonNegativeInt(), + 1000L + ); +} diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java similarity index 91% rename from hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java index 2c73b5ee93..b8770ca7df 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java @@ -23,8 +23,6 @@ import java.util.Objects; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -41,7 +39,6 @@ import org.apache.hugegraph.backend.BackendException; import org.apache.hugegraph.backend.cache.Cache; import org.apache.hugegraph.backend.cache.CacheManager; -import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.backend.store.BackendStoreInfo; import org.apache.hugegraph.config.CoreOptions; @@ -53,7 +50,7 @@ import org.apache.hugegraph.masterelection.GlobalMasterInfo; import org.apache.hugegraph.masterelection.RoleElectionOptions; import org.apache.hugegraph.masterelection.RoleElectionStateMachine; -import org.apache.hugegraph.masterelection.StandardStateMachineCallback; +import org.apache.hugegraph.masterelection.StandardRoleListener; import org.apache.hugegraph.metrics.MetricsUtil; import org.apache.hugegraph.metrics.ServerReporter; import org.apache.hugegraph.rpc.RpcClientProvider; @@ -88,14 +85,11 @@ public final class GraphManager { private final HugeAuthenticator authenticator; private final RpcServer rpcServer; private final RpcClientProvider rpcClient; - private final HugeConfig conf; - - private RoleElectionStateMachine roleStateWorker; - private GlobalMasterInfo globalMasterInfo; - private Id server; - private NodeRole role; + private RoleElectionStateMachine roleStateMachine; + private GlobalMasterInfo globalNodeRoleInfo; + private final HugeConfig conf; private final EventHub eventHub; public GraphManager(HugeConfig conf, EventHub hub) { @@ -104,6 +98,10 @@ public GraphManager(HugeConfig conf, EventHub hub) { this.authenticator = HugeAuthenticator.loadAuthenticator(conf); this.rpcServer = new RpcServer(conf); this.rpcClient = new RpcClientProvider(conf); + + this.roleStateMachine = null; + this.globalNodeRoleInfo = new GlobalMasterInfo(); + this.eventHub = hub; this.conf = conf; } @@ -141,8 +139,7 @@ public void loadGraphs(Map graphConfs) { } } - public HugeGraph cloneGraph(String name, String newName, - String configText) { + public HugeGraph cloneGraph(String name, String newName, String configText) { /* * 0. check and modify params * 1. create graph instance @@ -270,6 +267,10 @@ public AuthManager authManager() { return this.authenticator().authManager(); } + public GlobalMasterInfo globalNodeRoleInfo() { + return this.globalNodeRoleInfo; + } + public void close() { for (Graph graph : this.graphs.values()) { try { @@ -280,8 +281,8 @@ public void close() { } this.destroyRpcServer(); this.unlistenChanges(); - if (this.roleStateWorker != null) { - this.roleStateWorker.shutdown(); + if (this.roleStateMachine != null) { + this.roleStateMachine.shutdown(); } } @@ -414,8 +415,7 @@ private void waitGraphsReady() { LOG.info("RpcServer is not enabled, skip wait graphs ready"); return; } - com.alipay.remoting.rpc.RpcServer remotingRpcServer = - this.remotingRpcServer(); + com.alipay.remoting.rpc.RpcServer remotingRpcServer = this.remotingRpcServer(); for (String graphName : this.graphs.keySet()) { HugeGraph graph = this.graph(graphName); graph.waitReady(remotingRpcServer); @@ -433,7 +433,7 @@ private void checkBackendVersionOrExit(HugeConfig config) { if (this.requireAuthentication()) { String token = config.get(ServerOptions.AUTH_ADMIN_TOKEN); try { - this.authenticator.initAdminUser(token); + this.authenticator().initAdminUser(token); } catch (Exception e) { throw new BackendException( "The backend store of '%s' can't " + @@ -455,65 +455,57 @@ private void checkBackendVersionOrExit(HugeConfig config) { } private void serverStarted(HugeConfig config) { - String server = config.get(ServerOptions.SERVER_ID); + String id = config.get(ServerOptions.SERVER_ID); String role = config.get(ServerOptions.SERVER_ROLE); - E.checkArgument(StringUtils.isNotEmpty(server), + E.checkArgument(StringUtils.isNotEmpty(id), "The server name can't be null or empty"); E.checkArgument(StringUtils.isNotEmpty(role), "The server role can't be null or empty"); - this.server = IdGenerator.of(server); - this.role = NodeRole.valueOf(role.toUpperCase()); - boolean supportRoleStateWorker = this.supportRoleStateWorker(); - if (supportRoleStateWorker) { - this.role = NodeRole.WORKER; + NodeRole nodeRole = NodeRole.valueOf(role.toUpperCase()); + boolean supportRoleElection = !nodeRole.computer() && + this.supportRoleElection(); + if (supportRoleElection) { + // Init any server as Worker role, then do role election + nodeRole = NodeRole.WORKER; } + this.globalNodeRoleInfo.initNodeId(IdGenerator.of(id)); + this.globalNodeRoleInfo.initNodeRole(nodeRole); + for (String graph : this.graphs()) { HugeGraph hugegraph = this.graph(graph); assert hugegraph != null; - hugegraph.serverStarted(this.server, this.role); + hugegraph.serverStarted(this.globalNodeRoleInfo); } - if (supportRoleStateWorker) { - this.initRoleStateWorker(); + if (supportRoleElection) { + this.initRoleStateMachine(); } } - private void initRoleStateWorker() { - E.checkArgument(this.roleStateWorker == null, "Repetition init"); - Executor applyThread = Executors.newSingleThreadExecutor(); - this.roleStateWorker = this.authenticator().graph().roleElectionStateMachine(); - this.globalMasterInfo = new GlobalMasterInfo(); - StandardStateMachineCallback stateMachineCallback = new StandardStateMachineCallback( - TaskManager.instance(), - this.globalMasterInfo); - applyThread.execute(() -> { - this.roleStateWorker.apply(stateMachineCallback); - }); - } - - public GlobalMasterInfo globalMasterInfo() { - return this.globalMasterInfo; + private void initRoleStateMachine() { + E.checkArgument(this.roleStateMachine == null, + "Repeated initialization of role state worker"); + this.globalNodeRoleInfo.supportElection(true); + this.roleStateMachine = this.authenticator().graph().roleElectionStateMachine(); + StandardRoleListener listener = new StandardRoleListener(TaskManager.instance(), + this.globalNodeRoleInfo); + this.roleStateMachine.start(listener); } - private boolean supportRoleStateWorker() { - if (this.role.computer()) { - return false; - } - + private boolean supportRoleElection() { try { if (!(this.authenticator() instanceof StandardAuthenticator)) { LOG.info("{} authenticator does not support role election currently", this.authenticator().getClass().getSimpleName()); return false; } + return true; } catch (IllegalStateException e) { - LOG.info("Unconfigured StandardAuthenticator, not support role election currently"); + LOG.info("{}, does not support role election currently", e.getMessage()); return false; } - - return true; } private void addMetrics(HugeConfig config) { @@ -591,7 +583,7 @@ private HugeGraph createGraph(HugeConfig config, String name) { graph = (HugeGraph) GraphFactory.open(config); // Init graph and start it - graph.create(this.graphsDir, this.server, this.role); + graph.create(this.graphsDir, this.globalNodeRoleInfo); } catch (Throwable e) { LOG.error("Failed to create graph '{}' due to: {}", name, e.getMessage(), e); diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/define/Checkable.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/Checkable.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/define/Checkable.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/Checkable.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/define/WorkLoad.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/WorkLoad.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/define/WorkLoad.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/WorkLoad.java diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsKeys.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsKeys.java new file mode 100644 index 0000000000..1cda15c829 --- /dev/null +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsKeys.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hugegraph.metrics; + +public enum MetricsKeys { + + MAX_RESPONSE_TIME(1, "max_response_time"), + + MEAN_RESPONSE_TIME(2, "mean_response_time"), + + TOTAL_REQUEST(3, "total_request"), + + FAILED_REQUEST(4, "failed_request"), + + SUCCESS_REQUEST(5, "success_request"); + + private final byte code; + private final String name; + + MetricsKeys(int code, String name) { + assert code < 256; + this.code = (byte) code; + this.name = name; + } +} diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java new file mode 100644 index 0000000000..bb411f9276 --- /dev/null +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java @@ -0,0 +1,215 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hugegraph.metrics; + +import org.apache.tinkerpop.gremlin.server.util.MetricManager; + +import com.codahale.metrics.Counter; +import com.codahale.metrics.Gauge; +import com.codahale.metrics.Histogram; +import com.codahale.metrics.Meter; +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.Snapshot; +import com.codahale.metrics.Timer; + +public class MetricsUtil { + + public static final String METRICS_PATH_TOTAL_COUNTER = "TOTAL_COUNTER"; + public static final String METRICS_PATH_FAILED_COUNTER = "FAILED_COUNTER"; + public static final String METRICS_PATH_SUCCESS_COUNTER = "SUCCESS_COUNTER"; + public static final String METRICS_PATH_RESPONSE_TIME_HISTOGRAM = + "RESPONSE_TIME_HISTOGRAM"; + public static final String P75_ATTR = "{name=\"p75\",} "; + public static final String P95_ATTR = "{name=\"p95\",} "; + public static final String P98_ATTR = "{name=\"p98\",} "; + public static final String P99_ATTR = "{name=\"p99\",} "; + public static final String P999_ATTR = "{name=\"p999\",} "; + public static final String MEAN_RATE_ATRR = "{name=\"mean_rate\",} "; + public static final String ONE_MIN_RATE_ATRR = "{name=\"m1_rate\",} "; + public static final String FIVE_MIN_RATE_ATRR = "{name=\"m5_rate\",} "; + public static final String FIFT_MIN_RATE_ATRR = "{name=\"m15_rate\",} "; + public static final MetricRegistry REGISTRY = MetricManager.INSTANCE.getRegistry(); + public static final String STR_HELP = "# HELP "; + public static final String STR_TYPE = "# TYPE "; + public static final String HISTOGRAM_TYPE = "histogram"; + public static final String UNTYPED = "untyped"; + public static final String GAUGE_TYPE = "gauge"; + public static final String END_LSTR = "\n"; + public static final String SPACE_STR = " "; + public static final String VERSION_STR = "{version=\""; + public static final String COUNT_ATTR = "{name=\"count\",} "; + public static final String MIN_ATTR = "{name=\"min\",} "; + public static final String MAX_ATTR = "{name=\"max\",} "; + public static final String MEAN_ATTR = "{name=\"mean\",} "; + public static final String STDDEV_ATTR = "{name=\"stddev\",} "; + public static final String P50_ATTR = "{name=\"p50\",} "; + + public static final String LEFT_NAME_STR = "{name="; + public static final String RIGHT_NAME_STR = ",} "; + public static final String PROM_HELP_NAME = "hugegraph_info"; + + + public static Gauge registerGauge(Class clazz, String name, + Gauge gauge) { + return REGISTRY.register(MetricRegistry.name(clazz, name), gauge); + } + + public static Counter registerCounter(Class clazz, String name) { + return REGISTRY.counter(MetricRegistry.name(clazz, name)); + } + + public static Counter registerCounter(String name) { + return REGISTRY.counter(MetricRegistry.name(name)); + } + + public static Histogram registerHistogram(Class clazz, String name) { + return REGISTRY.histogram(MetricRegistry.name(clazz, name)); + } + + public static Histogram registerHistogram(String name) { + return REGISTRY.histogram(name); + } + + public static Meter registerMeter(Class clazz, String name) { + return REGISTRY.meter(MetricRegistry.name(clazz, name)); + } + + public static Timer registerTimer(Class clazz, String name) { + return REGISTRY.timer(MetricRegistry.name(clazz, name)); + } + + public static String replaceDotDashInKey(String orgKey) { + return orgKey.replace(".", "_").replace("-", "_"); + } + + public static String replaceSlashInKey(String orgKey) { + return orgKey.replace("/", "_"); + } + + public static void writePrometheusFormat(StringBuilder promeMetrics, MetricRegistry registry) { + // gauges + registry.getGauges().forEach((key, gauge) -> { + if (gauge != null) { + String helpName = replaceDotDashInKey(key); + promeMetrics.append(STR_HELP) + .append(helpName).append(END_LSTR); + promeMetrics.append(STR_TYPE) + .append(helpName).append(SPACE_STR + GAUGE_TYPE + END_LSTR); + promeMetrics.append(helpName).append(SPACE_STR).append(gauge.getValue()) + .append(END_LSTR); + } + }); + + // histograms + registry.getHistograms().forEach((key, histogram) -> { + if (histogram != null) { + String helpName = replaceDotDashInKey(key); + promeMetrics.append(STR_HELP) + .append(helpName).append(END_LSTR); + promeMetrics.append(STR_TYPE) + .append(helpName) + .append(SPACE_STR + HISTOGRAM_TYPE + END_LSTR); + + promeMetrics.append(helpName) + .append(COUNT_ATTR).append(histogram.getCount()).append(END_LSTR); + promeMetrics.append( + exportSnapshot(helpName, histogram.getSnapshot())); + } + }); + + // meters + registry.getMeters().forEach((key, metric) -> { + if (metric != null) { + String helpName = replaceDotDashInKey(key); + promeMetrics.append(STR_HELP) + .append(helpName).append(END_LSTR); + promeMetrics.append(STR_TYPE) + .append(helpName) + .append(SPACE_STR + HISTOGRAM_TYPE + END_LSTR); + + promeMetrics.append(helpName) + .append(COUNT_ATTR).append(metric.getCount()).append(END_LSTR); + promeMetrics.append(helpName) + .append(MEAN_RATE_ATRR).append(metric.getMeanRate()).append(END_LSTR); + promeMetrics.append(helpName) + .append(ONE_MIN_RATE_ATRR).append(metric.getOneMinuteRate()) + .append(END_LSTR); + promeMetrics.append(helpName) + .append(FIVE_MIN_RATE_ATRR).append(metric.getFiveMinuteRate()) + .append(END_LSTR); + promeMetrics.append(helpName) + .append(FIFT_MIN_RATE_ATRR).append(metric.getFifteenMinuteRate()) + .append(END_LSTR); + } + }); + + // timer + registry.getTimers().forEach((key, timer) -> { + if (timer != null) { + String helpName = replaceDotDashInKey(key); + promeMetrics.append(STR_HELP) + .append(helpName).append(END_LSTR); + promeMetrics.append(STR_TYPE) + .append(helpName) + .append(SPACE_STR + HISTOGRAM_TYPE + END_LSTR); + + promeMetrics.append(helpName) + .append(COUNT_ATTR).append(timer.getCount()).append(END_LSTR); + promeMetrics.append(helpName) + .append(ONE_MIN_RATE_ATRR).append(timer.getOneMinuteRate()) + .append(END_LSTR); + promeMetrics.append(helpName) + .append(FIVE_MIN_RATE_ATRR).append(timer.getFiveMinuteRate()) + .append(END_LSTR); + promeMetrics.append(helpName) + .append(FIFT_MIN_RATE_ATRR).append(timer.getFifteenMinuteRate()) + .append(END_LSTR); + promeMetrics.append( + exportSnapshot(helpName, timer.getSnapshot())); + } + }); + } + + public static String exportSnapshot(final String helpName, final Snapshot snapshot) { + if (snapshot == null) { + return ""; + } + StringBuilder snapMetrics = new StringBuilder(); + snapMetrics.append(helpName) + .append(MIN_ATTR).append(snapshot.getMin()).append(END_LSTR); + snapMetrics.append(helpName) + .append(MAX_ATTR).append(snapshot.getMax()).append(END_LSTR); + snapMetrics.append(helpName) + .append(MEAN_ATTR).append(snapshot.getMean()).append(END_LSTR); + snapMetrics.append(helpName) + .append(STDDEV_ATTR).append(snapshot.getStdDev()).append(END_LSTR); + snapMetrics.append(helpName) + .append(P50_ATTR).append(snapshot.getMedian()).append(END_LSTR); + snapMetrics.append(helpName) + .append(P75_ATTR).append(snapshot.get75thPercentile()).append(END_LSTR); + snapMetrics.append(helpName) + .append(P95_ATTR).append(snapshot.get95thPercentile()).append(END_LSTR); + snapMetrics.append(helpName) + .append(P98_ATTR).append(snapshot.get98thPercentile()).append(END_LSTR); + snapMetrics.append(helpName) + .append(P99_ATTR).append(snapshot.get99thPercentile()).append(END_LSTR); + snapMetrics.append(helpName) + .append(P999_ATTR).append(snapshot.get999thPercentile()).append(END_LSTR); + return snapMetrics.toString(); + } +} diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SlowQueryLog.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SlowQueryLog.java new file mode 100644 index 0000000000..e55316c39e --- /dev/null +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SlowQueryLog.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package org.apache.hugegraph.metrics; + +public class SlowQueryLog { + + public String rawQuery; + + public String method; + + public String path; + + public long executeTime; + + public long startTime; + + public long thresholdTime; + + public SlowQueryLog(String rawQuery, String method, String path, + long executeTime, long startTime, long thresholdTime) { + this.rawQuery = rawQuery; + this.method = method; + this.path = path; + this.executeTime = executeTime; + this.startTime = startTime; + this.thresholdTime = thresholdTime; + } + + @Override + public String toString() { + return "SlowQueryLog{executeTime=" + executeTime + + ", startTime=" + startTime + + ", rawQuery='" + rawQuery + '\'' + + ", method='" + method + '\'' + + ", threshold=" + thresholdTime + + ", path='" + path + '\'' + + '}'; + } +} diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/serializer/JsonSerializer.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/serializer/JsonSerializer.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/serializer/JsonSerializer.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/serializer/JsonSerializer.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/serializer/Serializer.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/serializer/Serializer.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/serializer/Serializer.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/serializer/Serializer.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java similarity index 93% rename from hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java index d70e6e0b29..a60510178c 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java @@ -44,8 +44,21 @@ import io.swagger.v3.oas.annotations.OpenAPIDefinition; import io.swagger.v3.oas.annotations.info.Contact; import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.enums.SecuritySchemeType; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.security.SecurityScheme; import jakarta.ws.rs.ApplicationPath; +@SecurityScheme( + name = "basic", + type = SecuritySchemeType.HTTP, + scheme = "basic" +) +@SecurityScheme( + name = "bearer", + type = SecuritySchemeType.HTTP, + scheme = "bearer" +) @ApplicationPath("/") @OpenAPIDefinition( info = @Info( @@ -53,7 +66,8 @@ version = CoreVersion.DEFAULT_VERSION, description = "All management API for HugeGraph", contact = @Contact(url = "https://github.com/apache/hugegraph", name = "HugeGraph") - ) + ), + security = {@SecurityRequirement(name = "basic"), @SecurityRequirement(name = "bearer")} ) public class ApplicationConfig extends ResourceConfig { diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/server/RestServer.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/RestServer.java similarity index 100% rename from hugegraph-api/src/main/java/org/apache/hugegraph/server/RestServer.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/RestServer.java diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java similarity index 89% rename from hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java rename to hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java index 117795c8d6..c75f65ab82 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java @@ -20,6 +20,11 @@ import org.apache.hugegraph.util.VersionUtil; import org.apache.hugegraph.util.VersionUtil.Version; +/** + * This class represents the API version of the HugeGraph system. + * It contains a version number and a method to check the compatibility + * with the core version of the system. + */ public final class ApiVersion { /* @@ -29,7 +34,7 @@ public final class ApiVersion { * [0.2] HugeGraph-527: First add the version to the hugegraph module * [0.3] HugeGraph-525: Add versions check of components and api * [0.4] HugeGraph-162: Add schema builder to separate client and inner interface. - * [0.5] HugeGraph-498: Support three kind of id strategy + * [0.5] HugeGraph-498: Support three kinds of id strategy *

* version 0.3: *

@@ -41,12 +46,12 @@ public final class ApiVersion { *

* version 0.4: * [0.11] HugeGraph-938: Remove useless index-names field in VL/EL API - * [0.12] HugeGraph-589: Add schema id for all schema element + * [0.12] HugeGraph-589: Add schema id for all schema elements * [0.13] HugeGraph-956: Support customize string/number id strategy *

* version 0.5: * [0.14] HugeGraph-1085: Add enable_label_index to VL/EL - * [0.15] HugeGraph-1105: Support paging for large amounts of records + * [0.15] HugeGraph-1105: Support paging for large numbers of records * [0.16] HugeGraph-944: Support rest shortest path, k-out, k-neighbor * [0.17] HugeGraph-944: Support rest shortest path, k-out, k-neighbor * [0.18] HugeGraph-81: Change argument "checkVertex" to "check_vertex" @@ -75,7 +80,7 @@ public final class ApiVersion { * [0.34] Issue-307: Let VertexAPI use simplified property serializer * [0.35] Issue-287: Support pagination when do index query * [0.36] Issue-360: Support paging for scan api - * [0.37] Issue-391: Add skip_super_node for shortest path + * [0.37] Issue-391: Add skip_super_node for the shortest path * [0.38] Issue-274: Add personal-rank and neighbor-rank RESTful API *

* version 0.10: @@ -114,15 +119,18 @@ public final class ApiVersion { * [0.67] Issue-1065: Support dynamically add/remove graph * [0.68] Issue-1763: Support adamic-adar & resource-allocation API * [0.69] Issue-1748: Support Cypher query RESTful API + * [0.70] PR-2242: Add edge-existence RESTful API + * [0.71] PR-2286: Support Arthas API & Metric API prometheus format */ /** * The second parameter of Version.of() is for IDE running without JAR + * Note: Also update the version number in hugegraph-api/pom.xml */ - public static final Version VERSION = Version.of(ApiVersion.class, "0.69"); + public static final Version VERSION = Version.of(ApiVersion.class, "0.71"); public static void check() { - // Check version of hugegraph-core. Firstly do check from version 0.3 - VersionUtil.check(CoreVersion.VERSION, "1.0", "1.1", CoreVersion.NAME); + // Check the version of hugegraph-core. Do first check from version 0.3 + VersionUtil.check(CoreVersion.VERSION, "1.0", "1.6", CoreVersion.NAME); } } diff --git a/hugegraph-api/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin b/hugegraph-server/hugegraph-api/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin similarity index 100% rename from hugegraph-api/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin rename to hugegraph-server/hugegraph-api/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin diff --git a/hugegraph-api/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.server.OpProcessor b/hugegraph-server/hugegraph-api/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.server.OpProcessor similarity index 100% rename from hugegraph-api/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.server.OpProcessor rename to hugegraph-server/hugegraph-api/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.server.OpProcessor diff --git a/hugegraph-cassandra/pom.xml b/hugegraph-server/hugegraph-cassandra/pom.xml similarity index 97% rename from hugegraph-cassandra/pom.xml rename to hugegraph-server/hugegraph-cassandra/pom.xml index 92ad5f6f56..888f6dd7f8 100644 --- a/hugegraph-cassandra/pom.xml +++ b/hugegraph-server/hugegraph-cassandra/pom.xml @@ -20,7 +20,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.apache.hugegraph - hugegraph + hugegraph-server ${revision} ../pom.xml @@ -37,7 +37,7 @@ org.apache.cassandra cassandra-all - 3.11.12 + 4.0.10 org.slf4j diff --git a/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java b/hugegraph-server/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java similarity index 100% rename from hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java rename to hugegraph-server/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraBackendEntry.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraBackendEntry.java similarity index 100% rename from hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraBackendEntry.java rename to hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraBackendEntry.java diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java similarity index 100% rename from hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java rename to hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraFeatures.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraFeatures.java similarity index 100% rename from hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraFeatures.java rename to hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraFeatures.java diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java similarity index 97% rename from hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java rename to hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java index 8759346764..f2f2931c62 100644 --- a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java +++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java @@ -112,7 +112,7 @@ protected Map getMetricsByHost(String host) { metrics.put(DISK_USAGE, UnitUtil.bytesToGB(diskSize)); metrics.put(DISK_USAGE + READABLE, UnitUtil.bytesToReadableString(diskSize)); - metrics.put(DISK_USAGE + "_details", probe.getLoadMap()); + metrics.put(DISK_USAGE + "_details", probe.getLoadMap(false)); metrics.put(DISK_UNIT, "GB"); // Uptime Metrics @@ -125,11 +125,11 @@ protected Map getMetricsByHost(String host) { this.appendExtraMetrics(metrics, probe); // Nodes Metrics - metrics.put("live_nodes", probe.getLiveNodes()); - metrics.put("joining_nodes", probe.getJoiningNodes()); - metrics.put("moving_nodes", probe.getMovingNodes()); - metrics.put("leaving_nodes", probe.getLeavingNodes()); - metrics.put("unreachable_nodes", probe.getUnreachableNodes()); + metrics.put("live_nodes", probe.getLiveNodes(false)); + metrics.put("joining_nodes", probe.getJoiningNodes(false)); + metrics.put("moving_nodes", probe.getMovingNodes(false)); + metrics.put("leaving_nodes", probe.getLeavingNodes(false)); + metrics.put("unreachable_nodes", probe.getUnreachableNodes(false)); // Others metrics.put("keyspaces", probe.getKeyspaces()); diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraOptions.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraOptions.java similarity index 100% rename from hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraOptions.java rename to hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraOptions.java diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java similarity index 100% rename from hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java rename to hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java similarity index 100% rename from hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java rename to hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java similarity index 99% rename from hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java rename to hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java index c5734f62e7..9bcefb6aa4 100644 --- a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java +++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java @@ -32,7 +32,7 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import org.apache.cassandra.config.SchemaConstants; +import org.apache.cassandra.schema.SchemaConstants; import org.apache.cassandra.db.SystemKeyspace; import org.apache.cassandra.dht.ByteOrderedPartitioner; import org.apache.cassandra.dht.IPartitioner; @@ -222,7 +222,7 @@ private static Map describeSplits( "WHERE keyspace_name = ? AND table_name = ? AND " + "range_start = ? AND range_end = ?", SchemaConstants.SYSTEM_KEYSPACE_NAME, - SystemKeyspace.SIZE_ESTIMATES); + SystemKeyspace.LEGACY_SIZE_ESTIMATES); ResultSet resultSet = session.execute(query, keyspace, table, tokenRange.getStart().toString(), diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java similarity index 100% rename from hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java rename to hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStoreProvider.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStoreProvider.java similarity index 100% rename from hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStoreProvider.java rename to hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStoreProvider.java diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java similarity index 100% rename from hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java rename to hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java similarity index 100% rename from hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java rename to hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java diff --git a/hugegraph-core/pom.xml b/hugegraph-server/hugegraph-core/pom.xml similarity index 92% rename from hugegraph-core/pom.xml rename to hugegraph-server/hugegraph-core/pom.xml index 8a0cb6b210..bdbb2ace43 100644 --- a/hugegraph-core/pom.xml +++ b/hugegraph-server/hugegraph-core/pom.xml @@ -14,13 +14,13 @@ License for the specific language governing permissions and limitations under the License. --> - 4.0.0 org.apache.hugegraph - hugegraph + hugegraph-server ${revision} ../pom.xml @@ -52,6 +52,23 @@ hugegraph-common + + + org.glassfish.jersey.core + jersey-client + ${jersey.version} + + + org.glassfish.jersey.connectors + jersey-apache-connector + ${jersey.version} + + + org.glassfish.jersey.inject + jersey-hk2 + ${jersey.version} + + org.apache.tinkerpop @@ -287,10 +304,13 @@ protobuf-maven-plugin 0.6.1 - com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} + + com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} + protoc-java ${project.basedir}/src/main/resources/proto - ${basedir}/target/generated-sources/protobuf/java + ${basedir}/target/generated-sources/protobuf/java + diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/HugeException.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeException.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/HugeException.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeException.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java similarity index 98% rename from hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java index cd287c47be..85c093e59e 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java @@ -30,6 +30,7 @@ import org.apache.hugegraph.backend.store.raft.RaftGroupManager; import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.config.TypedOption; +import org.apache.hugegraph.masterelection.GlobalMasterInfo; import org.apache.hugegraph.masterelection.RoleElectionStateMachine; import org.apache.hugegraph.rpc.RpcServiceConfig4Client; import org.apache.hugegraph.rpc.RpcServiceConfig4Server; @@ -44,12 +45,11 @@ import org.apache.hugegraph.task.TaskScheduler; import org.apache.hugegraph.traversal.optimize.HugeCountStepStrategy; import org.apache.hugegraph.traversal.optimize.HugeGraphStepStrategy; -import org.apache.hugegraph.traversal.optimize.HugeVertexStepStrategy; import org.apache.hugegraph.traversal.optimize.HugePrimaryKeyStrategy; +import org.apache.hugegraph.traversal.optimize.HugeVertexStepStrategy; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.GraphMode; import org.apache.hugegraph.type.define.GraphReadMode; -import org.apache.hugegraph.type.define.NodeRole; import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Graph; @@ -201,7 +201,7 @@ public interface HugeGraph extends Graph { void waitReady(RpcServer rpcServer); - void serverStarted(Id serverId, NodeRole serverRole); + void serverStarted(GlobalMasterInfo nodeInfo); boolean started(); @@ -221,7 +221,7 @@ public interface HugeGraph extends Graph { void resumeSnapshot(); - void create(String configPath, Id server, NodeRole role); + void create(String configPath, GlobalMasterInfo nodeInfo); void drop(); diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraphParams.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraphParams.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraphParams.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraphParams.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java similarity index 96% rename from hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java index db37d0a4bd..c671056e04 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java @@ -51,7 +51,6 @@ import org.apache.hugegraph.backend.store.raft.RaftBackendStoreProvider; import org.apache.hugegraph.backend.store.raft.RaftGroupManager; import org.apache.hugegraph.backend.store.ram.RamTable; -import org.apache.hugegraph.task.EphemeralJobQueue; import org.apache.hugegraph.backend.tx.GraphTransaction; import org.apache.hugegraph.backend.tx.SchemaTransaction; import org.apache.hugegraph.config.CoreOptions; @@ -64,6 +63,7 @@ import org.apache.hugegraph.job.EphemeralJob; import org.apache.hugegraph.masterelection.ClusterRoleStore; import org.apache.hugegraph.masterelection.Config; +import org.apache.hugegraph.masterelection.GlobalMasterInfo; import org.apache.hugegraph.masterelection.RoleElectionConfig; import org.apache.hugegraph.masterelection.RoleElectionOptions; import org.apache.hugegraph.masterelection.RoleElectionStateMachine; @@ -84,13 +84,13 @@ import org.apache.hugegraph.structure.HugeFeatures; import org.apache.hugegraph.structure.HugeVertex; import org.apache.hugegraph.structure.HugeVertexProperty; +import org.apache.hugegraph.task.EphemeralJobQueue; import org.apache.hugegraph.task.ServerInfoManager; import org.apache.hugegraph.task.TaskManager; import org.apache.hugegraph.task.TaskScheduler; import org.apache.hugegraph.type.HugeType; import org.apache.hugegraph.type.define.GraphMode; import org.apache.hugegraph.type.define.GraphReadMode; -import org.apache.hugegraph.type.define.NodeRole; import org.apache.hugegraph.util.ConfigUtil; import org.apache.hugegraph.util.DateUtil; import org.apache.hugegraph.util.E; @@ -267,15 +267,15 @@ public BackendFeatures backendStoreFeatures() { } @Override - public void serverStarted(Id serverId, NodeRole serverRole) { + public void serverStarted(GlobalMasterInfo nodeInfo) { LOG.info("Init system info for graph '{}'", this.name); this.initSystemInfo(); LOG.info("Init server info [{}-{}] for graph '{}'...", - serverId, serverRole, this.name); - this.serverInfoManager().initServerInfo(serverId, serverRole); + nodeInfo.nodeId(), nodeInfo.nodeRole(), this.name); + this.serverInfoManager().initServerInfo(nodeInfo); - this.initRoleStateWorker(serverId); + this.initRoleStateMachine(nodeInfo.nodeId()); // TODO: check necessary? LOG.info("Check olap property-key tables for graph '{}'", this.name); @@ -291,16 +291,18 @@ public void serverStarted(Id serverId, NodeRole serverRole) { this.started = true; } - private void initRoleStateWorker(Id serverId) { - Config roleStateMachineConfig = new RoleElectionConfig(serverId.toString(), - this.configuration.get(RoleElectionOptions.NODE_EXTERNAL_URL), - this.configuration.get(RoleElectionOptions.EXCEEDS_FAIL_COUNT), - this.configuration.get(RoleElectionOptions.RANDOM_TIMEOUT_MILLISECOND), - this.configuration.get(RoleElectionOptions.HEARTBEAT_INTERVAL_SECOND), - this.configuration.get(RoleElectionOptions.MASTER_DEAD_TIMES), - this.configuration.get(RoleElectionOptions.BASE_TIMEOUT_MILLISECOND)); - ClusterRoleStore clusterRoleStore = new StandardClusterRoleStore(this.params); - this.roleElectionStateMachine = new StandardRoleElectionStateMachine(roleStateMachineConfig, clusterRoleStore); + private void initRoleStateMachine(Id serverId) { + HugeConfig conf = this.configuration; + Config roleConfig = new RoleElectionConfig(serverId.toString(), + conf.get(RoleElectionOptions.NODE_EXTERNAL_URL), + conf.get(RoleElectionOptions.EXCEEDS_FAIL_COUNT), + conf.get(RoleElectionOptions.RANDOM_TIMEOUT_MILLISECOND), + conf.get(RoleElectionOptions.HEARTBEAT_INTERVAL_SECOND), + conf.get(RoleElectionOptions.MASTER_DEAD_TIMES), + conf.get(RoleElectionOptions.BASE_TIMEOUT_MILLISECOND)); + ClusterRoleStore roleStore = new StandardClusterRoleStore(this.params); + this.roleElectionStateMachine = new StandardRoleElectionStateMachine(roleConfig, + roleStore); } @Override @@ -399,8 +401,7 @@ public void truncateBackend() { try { this.storeProvider.truncate(); // TODO: remove this after serverinfo saved in etcd - this.serverStarted(this.serverInfoManager().selfServerId(), - this.serverInfoManager().selfServerRole()); + this.serverStarted(this.serverInfoManager().globalNodeRoleInfo()); } finally { LockUtil.unlock(this.name, LockUtil.GRAPH_LOCK); } @@ -974,9 +975,9 @@ public synchronized void close() throws Exception { } @Override - public void create(String configPath, Id server, NodeRole role) { + public void create(String configPath, GlobalMasterInfo nodeInfo) { this.initBackend(); - this.serverStarted(server, role); + this.serverStarted(nodeInfo); // Write config to disk file String confPath = ConfigUtil.writeToFile(configPath, this.name(), @@ -1052,8 +1053,7 @@ public TaskScheduler taskScheduler() { } private ServerInfoManager serverInfoManager() { - ServerInfoManager manager = this.taskManager - .getServerInfoManager(this.params); + ServerInfoManager manager = this.taskManager.getServerInfoManager(this.params); E.checkState(manager != null, "Can't find server info manager for graph '%s'", this); return manager; diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/Analyzer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/Analyzer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/Analyzer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/Analyzer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnalyzerFactory.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnalyzerFactory.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnalyzerFactory.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnalyzerFactory.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnsjAnalyzer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnsjAnalyzer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnsjAnalyzer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnsjAnalyzer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/HanLPAnalyzer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/HanLPAnalyzer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/HanLPAnalyzer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/HanLPAnalyzer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/IKAnalyzer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/IKAnalyzer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/IKAnalyzer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/IKAnalyzer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JcsegAnalyzer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JcsegAnalyzer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JcsegAnalyzer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JcsegAnalyzer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JiebaAnalyzer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JiebaAnalyzer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JiebaAnalyzer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JiebaAnalyzer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/MMSeg4JAnalyzer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/MMSeg4JAnalyzer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/MMSeg4JAnalyzer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/MMSeg4JAnalyzer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/SmartCNAnalyzer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/SmartCNAnalyzer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/SmartCNAnalyzer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/SmartCNAnalyzer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthConstant.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthConstant.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthConstant.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthConstant.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthManager.java similarity index 95% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthManager.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthManager.java index 2dba7c7a15..908eed01f1 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthManager.java @@ -126,4 +126,12 @@ public interface AuthManager { UserWithRole validateUser(String username, String password); UserWithRole validateUser(String token); + + Set listWhiteIPs(); + + void setWhiteIPs(Set whiteIpList); + + boolean getWhiteIpStatus(); + + void enabledWhiteIpList(boolean status); } diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/EntityManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/EntityManager.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/EntityManager.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/EntityManager.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeAccess.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeAccess.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeAccess.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeAccess.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeBelong.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeBelong.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeBelong.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeBelong.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeGroup.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeGroup.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeGroup.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeGroup.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugePermission.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugePermission.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugePermission.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugePermission.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeProject.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeProject.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeProject.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeProject.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeResource.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeResource.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeResource.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeResource.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeTarget.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeTarget.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeTarget.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeTarget.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeUser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeUser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeUser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeUser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RelationshipManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RelationshipManager.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/RelationshipManager.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RelationshipManager.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceObject.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceObject.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceObject.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceObject.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceType.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceType.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceType.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceType.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RolePermission.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RolePermission.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/RolePermission.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RolePermission.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/SchemaDefine.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/SchemaDefine.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/SchemaDefine.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/SchemaDefine.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java similarity index 97% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java index 910f19cdc5..123c8e9ffd 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java @@ -27,31 +27,30 @@ import javax.security.sasl.AuthenticationException; -import jakarta.ws.rs.ForbiddenException; - import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.HugeGraphParams; +import org.apache.hugegraph.auth.HugeUser.P; +import org.apache.hugegraph.auth.SchemaDefine.AuthElement; import org.apache.hugegraph.backend.cache.Cache; import org.apache.hugegraph.backend.cache.CacheManager; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.config.AuthOptions; +import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.type.define.Directions; +import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.LockUtil; +import org.apache.hugegraph.util.Log; import org.apache.hugegraph.util.StringEncoding; import org.slf4j.Logger; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.HugeGraphParams; -import org.apache.hugegraph.auth.HugeUser.P; -import org.apache.hugegraph.auth.SchemaDefine.AuthElement; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import io.jsonwebtoken.Claims; +import jakarta.ws.rs.ForbiddenException; public class StandardAuthManager implements AuthManager { @@ -77,6 +76,10 @@ public class StandardAuthManager implements AuthManager { private final TokenGenerator tokenGenerator; private final long tokenExpire; + private Set ipWhiteList; + + private Boolean ipWhiteListEnabled; + public StandardAuthManager(HugeGraphParams graph) { E.checkNotNull(graph, "graph"); HugeConfig config = graph.configuration(); @@ -104,6 +107,10 @@ public StandardAuthManager(HugeGraphParams graph) { HugeAccess::fromEdge); this.tokenGenerator = new TokenGenerator(config); + + this.ipWhiteList = new HashSet<>(); + + this.ipWhiteListEnabled = false; } private Cache cache(String prefix, long capacity, @@ -689,6 +696,26 @@ public UserWithRole validateUser(String token) { return new UserWithRole(user.id(), username, this.rolePermission(user)); } + @Override + public Set listWhiteIPs() { + return ipWhiteList; + } + + @Override + public void setWhiteIPs(Set ipWhiteList) { + this.ipWhiteList = ipWhiteList; + } + + @Override + public boolean getWhiteIpStatus() { + return this.ipWhiteListEnabled; + } + + @Override + public void enabledWhiteIpList(boolean status) { + this.ipWhiteListEnabled = status; + } + /** * Maybe can define an proxy class to choose forward or call local */ diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/TokenGenerator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/TokenGenerator.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/TokenGenerator.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/TokenGenerator.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/auth/UserWithRole.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/UserWithRole.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/auth/UserWithRole.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/UserWithRole.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/BackendException.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/BackendException.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/BackendException.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/BackendException.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/LocalCounter.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/LocalCounter.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/LocalCounter.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/LocalCounter.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/Transaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/Transaction.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/Transaction.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/Transaction.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/AbstractCache.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/AbstractCache.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/AbstractCache.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/AbstractCache.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/Cache.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/Cache.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/Cache.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/Cache.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheManager.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheManager.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheManager.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheNotifier.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheNotifier.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheNotifier.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheNotifier.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedBackendStore.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedBackendStore.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedBackendStore.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedBackendStore.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedGraphTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedGraphTransaction.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedGraphTransaction.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedGraphTransaction.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedSchemaTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedSchemaTransaction.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedSchemaTransaction.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedSchemaTransaction.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/LevelCache.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/LevelCache.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/LevelCache.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/LevelCache.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/OffheapCache.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/OffheapCache.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/OffheapCache.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/OffheapCache.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/RamCache.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/RamCache.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/RamCache.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/RamCache.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/EdgeId.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/EdgeId.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/EdgeId.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/EdgeId.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/Id.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/Id.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/Id.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/Id.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/IdGenerator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/IdGenerator.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/IdGenerator.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/IdGenerator.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/IdUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/IdUtil.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/IdUtil.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/IdUtil.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SplicingIdGenerator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SplicingIdGenerator.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SplicingIdGenerator.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SplicingIdGenerator.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/IdHolder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/IdHolder.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/IdHolder.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/IdHolder.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/IdHolderList.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/IdHolderList.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/IdHolderList.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/IdHolderList.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageEntryIterator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageEntryIterator.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageEntryIterator.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageEntryIterator.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageIds.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageIds.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageIds.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageIds.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageInfo.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageInfo.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageInfo.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageInfo.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageState.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageState.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageState.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageState.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/QueryList.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/QueryList.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/QueryList.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/QueryList.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/SortByCountIdHolderList.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/SortByCountIdHolderList.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/SortByCountIdHolderList.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/SortByCountIdHolderList.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Aggregate.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Aggregate.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Aggregate.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Aggregate.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/BatchConditionQuery.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/BatchConditionQuery.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/BatchConditionQuery.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/BatchConditionQuery.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQuery.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQuery.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQuery.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQuery.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQueryFlatten.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQueryFlatten.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQueryFlatten.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQueryFlatten.java diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/EdgesQueryIterator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/EdgesQueryIterator.java new file mode 100644 index 0000000000..4ab9a8859a --- /dev/null +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/EdgesQueryIterator.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hugegraph.backend.query; + +import java.util.Iterator; +import java.util.List; + +import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.backend.tx.GraphTransaction; +import org.apache.hugegraph.type.define.Directions; + +public class EdgesQueryIterator implements Iterator { + + private final List labels; + private final Directions directions; + private final long limit; + private final Iterator sources; + + public EdgesQueryIterator(Iterator sources, + Directions directions, + List labels, + long limit) { + this.sources = sources; + this.labels = labels; + this.directions = directions; + // Traverse NO_LIMIT 和 Query.NO_LIMIT 不同 + this.limit = limit < 0 ? Query.NO_LIMIT : limit; + } + + @Override + public boolean hasNext() { + return sources.hasNext(); + } + + @Override + public Query next() { + Id sourceId = this.sources.next(); + ConditionQuery query = GraphTransaction.constructEdgesQuery(sourceId, + this.directions, + this.labels); + if (this.limit != Query.NO_LIMIT) { + query.limit(this.limit); + query.capacity(this.limit); + } else { + query.capacity(Query.NO_CAPACITY); + } + return query; + } +} diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdPrefixQuery.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdPrefixQuery.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdPrefixQuery.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdPrefixQuery.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdQuery.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdQuery.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdQuery.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdQuery.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdRangeQuery.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdRangeQuery.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdRangeQuery.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdRangeQuery.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Query.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Query.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Query.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Query.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/QueryResults.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/QueryResults.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/QueryResults.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/QueryResults.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/AbstractSerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/AbstractSerializer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/AbstractSerializer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/AbstractSerializer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryBackendEntry.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryBackendEntry.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryBackendEntry.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryBackendEntry.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryEntryIterator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryEntryIterator.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryEntryIterator.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryEntryIterator.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryScatterSerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryScatterSerializer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryScatterSerializer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryScatterSerializer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinarySerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinarySerializer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinarySerializer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinarySerializer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/GraphSerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/GraphSerializer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/GraphSerializer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/GraphSerializer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/MergeIterator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/MergeIterator.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/MergeIterator.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/MergeIterator.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/SchemaSerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/SchemaSerializer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/SchemaSerializer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/SchemaSerializer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/SerializerFactory.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/SerializerFactory.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/SerializerFactory.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/SerializerFactory.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableBackendEntry.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableBackendEntry.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableBackendEntry.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableBackendEntry.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableSerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableSerializer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableSerializer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableSerializer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextBackendEntry.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextBackendEntry.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextBackendEntry.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextBackendEntry.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextSerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextSerializer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextSerializer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TextSerializer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStore.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStore.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStore.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStore.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStoreProvider.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStoreProvider.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStoreProvider.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStoreProvider.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendAction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendAction.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendAction.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendAction.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendEntry.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendEntry.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendEntry.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendEntry.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendEntryIterator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendEntryIterator.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendEntryIterator.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendEntryIterator.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendFeatures.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendFeatures.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendFeatures.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendFeatures.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendMetrics.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendMetrics.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendMetrics.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendMetrics.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendMutation.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendMutation.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendMutation.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendMutation.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendProviderFactory.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendProviderFactory.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendProviderFactory.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendProviderFactory.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendSession.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendSession.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendSession.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendSession.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendSessionPool.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendSessionPool.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendSessionPool.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendSessionPool.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStore.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStore.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStore.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStore.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreInfo.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreInfo.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreInfo.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreInfo.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreProvider.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreProvider.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreProvider.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendStoreProvider.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendTable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendTable.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendTable.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendTable.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/MetaDispatcher.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/MetaDispatcher.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/MetaDispatcher.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/MetaDispatcher.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/MetaHandler.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/MetaHandler.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/MetaHandler.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/MetaHandler.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/Shard.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/Shard.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/Shard.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/Shard.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/SystemSchemaStore.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/SystemSchemaStore.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/SystemSchemaStore.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/SystemSchemaStore.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/TableDefine.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/TableDefine.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/TableDefine.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/TableDefine.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStore.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStore.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStore.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStore.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStoreProvider.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStoreProvider.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStoreProvider.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBStoreProvider.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTable.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTable.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTable.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTables.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTables.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTables.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTables.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryMetrics.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryMetrics.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryMetrics.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryMetrics.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftAddPeerJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftAddPeerJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftAddPeerJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftAddPeerJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStore.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStore.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStore.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStore.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStoreProvider.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStoreProvider.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStoreProvider.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftBackendStoreProvider.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftClosure.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftClosure.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftClosure.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftClosure.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftContext.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftContext.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftContext.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftContext.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftException.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftException.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftException.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftException.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManager.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManager.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManager.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManagerImpl.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManagerImpl.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManagerImpl.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManagerImpl.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftNode.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftNode.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftNode.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftNode.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftRemovePeerJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftRemovePeerJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftRemovePeerJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftRemovePeerJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftResult.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftResult.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftResult.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftResult.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftStoreClosure.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftStoreClosure.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftStoreClosure.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftStoreClosure.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreCommand.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreCommand.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreCommand.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreCommand.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSerializer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSerializer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSerializer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSnapshotFile.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSnapshotFile.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSnapshotFile.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreSnapshotFile.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreStateMachine.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreStateMachine.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreStateMachine.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/StoreStateMachine.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/CompressStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/CompressStrategy.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/CompressStrategy.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/CompressStrategy.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/CompressStrategyManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/CompressStrategyManager.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/CompressStrategyManager.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/CompressStrategyManager.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/ParallelCompressStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/ParallelCompressStrategy.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/ParallelCompressStrategy.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/ParallelCompressStrategy.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/SerialCompressStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/SerialCompressStrategy.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/SerialCompressStrategy.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/compress/SerialCompressStrategy.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/AddPeerProcessor.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/AddPeerProcessor.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/AddPeerProcessor.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/AddPeerProcessor.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/ListPeersProcessor.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/ListPeersProcessor.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/ListPeersProcessor.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/ListPeersProcessor.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RemovePeerProcessor.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RemovePeerProcessor.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RemovePeerProcessor.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RemovePeerProcessor.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RpcForwarder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RpcForwarder.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RpcForwarder.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/RpcForwarder.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/SetLeaderProcessor.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/SetLeaderProcessor.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/SetLeaderProcessor.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/SetLeaderProcessor.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/StoreCommandProcessor.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/StoreCommandProcessor.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/StoreCommandProcessor.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/rpc/StoreCommandProcessor.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/IntIntMap.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/IntIntMap.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/IntIntMap.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/IntIntMap.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/IntLongMap.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/IntLongMap.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/IntLongMap.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/IntLongMap.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/IntObjectMap.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/IntObjectMap.java similarity index 91% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/IntObjectMap.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/IntObjectMap.java index 78af531a07..735f423ce8 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/IntObjectMap.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/IntObjectMap.java @@ -29,8 +29,8 @@ public final class IntObjectMap implements RamMap { private static final float DEFAULT_INITIAL_FACTOR = 0.25f; private final int maxSize; - private int currentSize; - private Object[] array; + private volatile int currentSize; + private volatile Object[] array; public IntObjectMap(int size) { this.maxSize = size; @@ -79,10 +79,11 @@ private synchronized void expandCapacity() { if (this.currentSize == this.maxSize) { return; } - this.currentSize = Math.min(this.currentSize * 2, this.maxSize); - Object[] newArray = new Object[this.currentSize]; + int newSize = Math.min(this.currentSize * 2, this.maxSize); + Object[] newArray = new Object[newSize]; System.arraycopy(this.array, 0, newArray, 0, this.array.length); this.clear(); this.array = newArray; + this.currentSize = newSize; } } diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/RamMap.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/RamMap.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/RamMap.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/RamMap.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/RamTable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/RamTable.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/RamTable.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/ram/RamTable.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/AbstractTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/AbstractTransaction.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/AbstractTransaction.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/AbstractTransaction.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java similarity index 99% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java index 0574318d74..3607129a6c 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java @@ -1712,7 +1712,7 @@ private Iterator filterUnmatchedRecords( Iterator results, Query query) { // Filter unused or incorrect records - return new FilterIterator(results, elem -> { + return new FilterIterator<>(results, elem -> { // TODO: Left vertex/edge should to be auto removed via async task if (elem.schemaLabel().undefined()) { LOG.warn("Left record is found: id={}, label={}, properties={}", @@ -1861,7 +1861,7 @@ private Iterator joinTxEdges(Query query, Iterator edges, return edges; } // Filter edges that belong to deleted vertex - return new FilterIterator(edges, edge -> { + return new FilterIterator<>(edges, edge -> { for (HugeVertex v : removingVertices.values()) { if (edge.belongToVertex(v)) { return false; @@ -1917,7 +1917,7 @@ private Iterator joinTxRecords( !removedTxRecords.containsKey(id); }); - return new ExtendableIterator(txResults.iterator(), backendResults); + return new ExtendableIterator<>(txResults.iterator(), backendResults); } private void checkTxVerticesCapacity() throws LimitExceedException { diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/IndexableTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/IndexableTransaction.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/IndexableTransaction.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/IndexableTransaction.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaIndexTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaIndexTransaction.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaIndexTransaction.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaIndexTransaction.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaTransaction.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaTransaction.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/SchemaTransaction.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/exception/ConnectionException.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/ConnectionException.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/exception/ConnectionException.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/ConnectionException.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/exception/ExistedException.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/ExistedException.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/exception/ExistedException.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/ExistedException.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/exception/HugeGremlinException.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/HugeGremlinException.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/exception/HugeGremlinException.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/HugeGremlinException.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/exception/LimitExceedException.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/LimitExceedException.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/exception/LimitExceedException.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/LimitExceedException.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/exception/NoIndexException.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/NoIndexException.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/exception/NoIndexException.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/NoIndexException.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/exception/NotAllowException.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/NotAllowException.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/exception/NotAllowException.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/NotAllowException.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/exception/NotFoundException.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/NotFoundException.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/exception/NotFoundException.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/NotFoundException.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/exception/NotSupportException.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/NotSupportException.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/exception/NotSupportException.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/exception/NotSupportException.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/io/GraphSONSchemaSerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/GraphSONSchemaSerializer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/io/GraphSONSchemaSerializer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/GraphSONSchemaSerializer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphIoRegistry.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphIoRegistry.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphIoRegistry.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphIoRegistry.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphSONModule.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphSONModule.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphSONModule.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGraphSONModule.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGryoModule.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGryoModule.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGryoModule.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/HugeGryoModule.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/AlgorithmJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/AlgorithmJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/AlgorithmJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/AlgorithmJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/ComputerJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/ComputerJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/ComputerJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/ComputerJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/EphemeralJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/EphemeralJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/EphemeralJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/EphemeralJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/EphemeralJobBuilder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/EphemeralJobBuilder.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/EphemeralJobBuilder.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/EphemeralJobBuilder.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/GremlinJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/GremlinJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/GremlinJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/GremlinJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/Job.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/Job.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/Job.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/Job.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/JobBuilder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/JobBuilder.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/JobBuilder.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/JobBuilder.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/SysJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/SysJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/SysJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/SysJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/UserJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/UserJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/UserJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/UserJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AbstractAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AbstractAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AbstractAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AbstractAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/Algorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/Algorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/Algorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/Algorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AlgorithmPool.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AlgorithmPool.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AlgorithmPool.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/AlgorithmPool.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/BfsTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/BfsTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/BfsTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/BfsTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/Consumers.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/Consumers.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/Consumers.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/Consumers.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountEdgeAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountEdgeAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountEdgeAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountEdgeAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountVertexAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountVertexAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountVertexAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/CountVertexAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/SubgraphStatAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/SubgraphStatAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/SubgraphStatAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/SubgraphStatAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/AbstractCentAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/AbstractCentAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/AbstractCentAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/AbstractCentAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithmV2.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithmV2.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithmV2.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/BetweennessCentralityAlgorithmV2.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithmV2.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithmV2.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithmV2.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/ClosenessCentralityAlgorithmV2.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/DegreeCentralityAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/DegreeCentralityAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/DegreeCentralityAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/DegreeCentralityAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/EigenvectorCentralityAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/EigenvectorCentralityAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/EigenvectorCentralityAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/EigenvectorCentralityAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithmV2.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithmV2.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithmV2.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/cent/StressCentralityAlgorithmV2.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/AbstractCommAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/AbstractCommAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/AbstractCommAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/AbstractCommAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/ClusterCoefficientAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/ClusterCoefficientAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/ClusterCoefficientAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/ClusterCoefficientAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/KCoreAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/KCoreAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/KCoreAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/KCoreAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LouvainTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LpaAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LpaAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LpaAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/LpaAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/TriangleCountAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/TriangleCountAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/TriangleCountAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/TriangleCountAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/WeakConnectedComponent.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/WeakConnectedComponent.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/WeakConnectedComponent.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/comm/WeakConnectedComponent.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/path/RingsDetectAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/path/RingsDetectAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/path/RingsDetectAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/path/RingsDetectAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/rank/PageRankAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/rank/PageRankAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/rank/PageRankAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/rank/PageRankAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/similarity/FusiformSimilarityAlgorithm.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/similarity/FusiformSimilarityAlgorithm.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/similarity/FusiformSimilarityAlgorithm.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/algorithm/similarity/FusiformSimilarityAlgorithm.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/AbstractComputer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/AbstractComputer.java similarity index 99% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/AbstractComputer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/AbstractComputer.java index a40d0001b4..11207ebae5 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/AbstractComputer.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/AbstractComputer.java @@ -32,16 +32,15 @@ import org.apache.commons.configuration2.tree.ImmutableNode; import org.apache.commons.configuration2.tree.NodeHandler; import org.apache.commons.configuration2.tree.NodeModel; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.util.ParameterUtil; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeException; import org.apache.hugegraph.job.ComputerJob; import org.apache.hugegraph.job.Job; import org.apache.hugegraph.traversal.algorithm.HugeTraverser; +import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.Log; +import org.apache.hugegraph.util.ParameterUtil; +import org.slf4j.Logger; public abstract class AbstractComputer implements Computer { @@ -85,7 +84,6 @@ public void checkParameters(Map parameters) { @Override public Object call(Job job, Map parameters) { - this.checkAndCollectParameters(parameters); // Read configuration try { diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/Computer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/Computer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/Computer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/Computer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/ComputerPool.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/ComputerPool.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/ComputerPool.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/ComputerPool.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LouvainComputer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LouvainComputer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LouvainComputer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LouvainComputer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LpaComputer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LpaComputer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LpaComputer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/LpaComputer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/PageRankComputer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/PageRankComputer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/PageRankComputer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/PageRankComputer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/TriangleCountComputer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/TriangleCountComputer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/TriangleCountComputer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/TriangleCountComputer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/WeakConnectedComponentComputer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/WeakConnectedComponentComputer.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/WeakConnectedComponentComputer.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/computer/WeakConnectedComponentComputer.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/EdgeLabelRemoveJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/EdgeLabelRemoveJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/EdgeLabelRemoveJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/EdgeLabelRemoveJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRebuildJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRebuildJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRebuildJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRebuildJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRemoveJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRemoveJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRemoveJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/IndexLabelRemoveJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyClearJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyClearJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyClearJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyClearJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyCreateJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyCreateJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyCreateJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyCreateJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyRemoveJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyRemoveJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyRemoveJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/OlapPropertyKeyRemoveJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/SchemaJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/SchemaJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/SchemaJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/SchemaJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/VertexLabelRemoveJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/VertexLabelRemoveJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/VertexLabelRemoveJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/schema/VertexLabelRemoveJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredElementJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredElementJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredElementJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredElementJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredIndexJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredIndexJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredIndexJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredIndexJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredJob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredJob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredJob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/DeleteExpiredJob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/JobCounters.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/JobCounters.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/job/system/JobCounters.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/job/system/JobCounters.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/ClusterRole.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/ClusterRole.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/ClusterRole.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/ClusterRole.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/ClusterRoleStore.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/ClusterRoleStore.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/ClusterRoleStore.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/ClusterRoleStore.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/Config.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/Config.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/Config.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/Config.java diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/GlobalMasterInfo.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/GlobalMasterInfo.java new file mode 100644 index 0000000000..9124fcd0b6 --- /dev/null +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/GlobalMasterInfo.java @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hugegraph.masterelection; + +import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.backend.id.IdGenerator; +import org.apache.hugegraph.type.define.NodeRole; +import org.apache.hugegraph.util.E; + +// TODO: rename to GlobalNodeRoleInfo +public final class GlobalMasterInfo { + + private final static NodeInfo NO_MASTER = new NodeInfo(false, ""); + + private volatile boolean supportElection; + private volatile NodeInfo masterNodeInfo; + + private volatile Id nodeId; + private volatile NodeRole nodeRole; + + public GlobalMasterInfo() { + this(NO_MASTER); + } + + public GlobalMasterInfo(NodeInfo masterInfo) { + this.supportElection = false; + this.masterNodeInfo = masterInfo; + + this.nodeId = null; + this.nodeRole = null; + } + + public void supportElection(boolean featureSupport) { + this.supportElection = featureSupport; + } + + public boolean supportElection() { + return this.supportElection; + } + + public void resetMasterInfo() { + this.masterNodeInfo = NO_MASTER; + } + + public void masterInfo(boolean isMaster, String nodeUrl) { + // final can avoid instruction rearrangement, visibility can be ignored + this.masterNodeInfo = new NodeInfo(isMaster, nodeUrl); + } + + public NodeInfo masterInfo() { + return this.masterNodeInfo; + } + + public Id nodeId() { + return this.nodeId; + } + + public NodeRole nodeRole() { + return this.nodeRole; + } + + public void initNodeId(Id id) { + this.nodeId = id; + } + + public void initNodeRole(NodeRole role) { + E.checkArgument(role != null, "The server role can't be null"); + E.checkArgument(this.nodeRole == null, + "The server role can't be init twice"); + this.nodeRole = role; + } + + public void changeNodeRole(NodeRole role) { + E.checkArgument(role != null, "The server role can't be null"); + this.nodeRole = role; + } + + public static GlobalMasterInfo master(String nodeId) { + NodeInfo masterInfo = new NodeInfo(true, nodeId); + GlobalMasterInfo nodeInfo = new GlobalMasterInfo(masterInfo); + nodeInfo.nodeId = IdGenerator.of(nodeId); + nodeInfo.nodeRole = NodeRole.MASTER; + return nodeInfo; + } + + public static class NodeInfo { + + private final boolean isMaster; + private final String nodeUrl; + + public NodeInfo(boolean isMaster, String url) { + this.isMaster = isMaster; + this.nodeUrl = url; + } + + public boolean isMaster() { + return this.isMaster; + } + + public String nodeUrl() { + return this.nodeUrl; + } + } +} diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionConfig.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionConfig.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionConfig.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionConfig.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionOptions.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionOptions.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionOptions.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionOptions.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionStateMachine.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionStateMachine.java similarity index 93% rename from hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionStateMachine.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionStateMachine.java index 920bc104f1..2a33d1bf6c 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionStateMachine.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleElectionStateMachine.java @@ -21,5 +21,5 @@ public interface RoleElectionStateMachine { void shutdown(); - void apply(StateMachineCallback stateMachineCallback); + void start(RoleListener callback); } diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StateMachineCallback.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleListener.java similarity index 96% rename from hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StateMachineCallback.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleListener.java index 35abbe3402..e99db4c16f 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StateMachineCallback.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/RoleListener.java @@ -17,7 +17,7 @@ package org.apache.hugegraph.masterelection; -public interface StateMachineCallback { +public interface RoleListener { void onAsRoleMaster(StateMachineContext context); diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardClusterRoleStore.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardClusterRoleStore.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardClusterRoleStore.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardClusterRoleStore.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardRoleElectionStateMachine.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardRoleElectionStateMachine.java similarity index 89% rename from hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardRoleElectionStateMachine.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardRoleElectionStateMachine.java index aa284def60..a0e2601d49 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardRoleElectionStateMachine.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardRoleElectionStateMachine.java @@ -19,6 +19,8 @@ import java.security.SecureRandom; import java.util.Optional; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.concurrent.locks.LockSupport; import org.apache.hugegraph.util.E; @@ -29,25 +31,36 @@ public class StandardRoleElectionStateMachine implements RoleElectionStateMachin private static final Logger LOG = Log.logger(StandardRoleElectionStateMachine.class); - private volatile boolean shutdown; private final Config config; + private final ClusterRoleStore roleStore; + private final ExecutorService applyThread; + + private volatile boolean shutdown; private volatile RoleState state; - private final ClusterRoleStore clusterRoleStore; - public StandardRoleElectionStateMachine(Config config, ClusterRoleStore clusterRoleStore) { + public StandardRoleElectionStateMachine(Config config, ClusterRoleStore roleStore) { this.config = config; - this.clusterRoleStore = clusterRoleStore; + this.roleStore = roleStore; + this.applyThread = Executors.newSingleThreadExecutor(); this.state = new UnknownState(null); this.shutdown = false; } @Override public void shutdown() { + if (this.shutdown) { + return; + } this.shutdown = true; + this.applyThread.shutdown(); } @Override - public void apply(StateMachineCallback stateMachineCallback) { + public void start(RoleListener stateMachineCallback) { + this.applyThread.execute(() -> this.apply(stateMachineCallback)); + } + + private void apply(RoleListener stateMachineCallback) { int failCount = 0; StateMachineContextImpl context = new StateMachineContextImpl(this); while (!this.shutdown) { @@ -73,13 +86,17 @@ public void apply(StateMachineCallback stateMachineCallback) { } } + protected ClusterRoleStore roleStore() { + return this.roleStore; + } + private interface RoleState { SecureRandom SECURE_RANDOM = new SecureRandom(); RoleState transform(StateMachineContext context); - Callback callback(StateMachineCallback callback); + Callback callback(RoleListener callback); static void heartBeatPark(StateMachineContext context) { long heartBeatIntervalSecond = context.config().heartBeatIntervalSecond(); @@ -110,7 +127,7 @@ public UnknownState(Integer epoch) { @Override public RoleState transform(StateMachineContext context) { - ClusterRoleStore adapter = context.adapter(); + ClusterRoleStore adapter = context.roleStore(); Optional clusterRoleOpt = adapter.query(); if (!clusterRoleOpt.isPresent()) { context.reset(); @@ -137,7 +154,7 @@ public RoleState transform(StateMachineContext context) { } @Override - public Callback callback(StateMachineCallback callback) { + public Callback callback(RoleListener callback) { return callback::unknown; } } @@ -158,7 +175,7 @@ public RoleState transform(StateMachineContext context) { } @Override - public Callback callback(StateMachineCallback callback) { + public Callback callback(RoleListener callback) { return callback::onAsRoleAbdication; } } @@ -175,7 +192,7 @@ public MasterState(ClusterRole clusterRole) { public RoleState transform(StateMachineContext context) { this.clusterRole.increaseClock(); RoleState.heartBeatPark(context); - if (context.adapter().updateIfNodePresent(this.clusterRole)) { + if (context.roleStore().updateIfNodePresent(this.clusterRole)) { return this; } context.reset(); @@ -184,7 +201,7 @@ public RoleState transform(StateMachineContext context) { } @Override - public Callback callback(StateMachineCallback callback) { + public Callback callback(RoleListener callback) { return callback::onAsRoleMaster; } } @@ -216,7 +233,7 @@ public RoleState transform(StateMachineContext context) { } @Override - public Callback callback(StateMachineCallback callback) { + public Callback callback(RoleListener callback) { return callback::onAsRoleWorker; } @@ -255,7 +272,7 @@ public RoleState transform(StateMachineContext context) { context.config().url(), epoch); // The master failover completed context.epoch(clusterRole.epoch()); - if (context.adapter().updateIfNodePresent(clusterRole)) { + if (context.roleStore().updateIfNodePresent(clusterRole)) { context.master(new MasterServerInfoImpl(clusterRole.node(), clusterRole.url())); return new MasterState(clusterRole); } else { @@ -264,7 +281,7 @@ public RoleState transform(StateMachineContext context) { } @Override - public Callback callback(StateMachineCallback callback) { + public Callback callback(RoleListener callback) { return callback::onAsRoleCandidate; } } @@ -303,8 +320,8 @@ public void epoch(Integer epoch) { } @Override - public ClusterRoleStore adapter() { - return this.machine.adapter(); + public ClusterRoleStore roleStore() { + return this.machine.roleStore(); } @Override @@ -348,8 +365,4 @@ public String node() { return this.node; } } - - protected ClusterRoleStore adapter() { - return this.clusterRoleStore; - } } diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardStateMachineCallback.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardRoleListener.java similarity index 67% rename from hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardStateMachineCallback.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardRoleListener.java index 28e01d2913..f2bb94f521 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardStateMachineCallback.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardRoleListener.java @@ -23,84 +23,83 @@ import org.apache.hugegraph.util.Log; import org.slf4j.Logger; -public class StandardStateMachineCallback implements StateMachineCallback { +public class StandardRoleListener implements RoleListener { - private static final Logger LOG = Log.logger(StandardStateMachineCallback.class); + private static final Logger LOG = Log.logger(StandardRoleListener.class); private final TaskManager taskManager; - private final GlobalMasterInfo globalMasterInfo; + private final GlobalMasterInfo roleInfo; - private boolean isMaster = false; + private volatile boolean selfIsMaster; - public StandardStateMachineCallback(TaskManager taskManager, - GlobalMasterInfo globalMasterInfo) { + public StandardRoleListener(TaskManager taskManager, + GlobalMasterInfo roleInfo) { this.taskManager = taskManager; - this.taskManager.enableRoleElected(true); - this.globalMasterInfo = globalMasterInfo; - this.globalMasterInfo.isFeatureSupport(true); + this.taskManager.enableRoleElection(); + this.roleInfo = roleInfo; + this.selfIsMaster = false; } @Override public void onAsRoleMaster(StateMachineContext context) { - if (!isMaster) { + if (!selfIsMaster) { this.taskManager.onAsRoleMaster(); LOG.info("Server {} change to master role", context.config().node()); } - this.initGlobalMasterInfo(context); - this.isMaster = true; + this.updateMasterInfo(context); + this.selfIsMaster = true; } @Override public void onAsRoleWorker(StateMachineContext context) { - if (isMaster) { + if (this.selfIsMaster) { this.taskManager.onAsRoleWorker(); LOG.info("Server {} change to worker role", context.config().node()); } - this.initGlobalMasterInfo(context); - this.isMaster = false; + this.updateMasterInfo(context); + this.selfIsMaster = false; } @Override public void onAsRoleCandidate(StateMachineContext context) { + // pass } @Override - public void unknown(StateMachineContext context) { - if (isMaster) { + public void onAsRoleAbdication(StateMachineContext context) { + if (this.selfIsMaster) { this.taskManager.onAsRoleWorker(); LOG.info("Server {} change to worker role", context.config().node()); } - this.initGlobalMasterInfo(context); + this.updateMasterInfo(context); + this.selfIsMaster = false; + } - isMaster = false; + @Override + public void error(StateMachineContext context, Throwable e) { + LOG.error("Server {} exception occurred", context.config().node(), e); } @Override - public void onAsRoleAbdication(StateMachineContext context) { - if (isMaster) { + public void unknown(StateMachineContext context) { + if (this.selfIsMaster) { this.taskManager.onAsRoleWorker(); LOG.info("Server {} change to worker role", context.config().node()); } - this.initGlobalMasterInfo(context); - - isMaster = false; - } + this.updateMasterInfo(context); - @Override - public void error(StateMachineContext context, Throwable e) { - LOG.error("Server {} exception occurred", context.config().node(), e); + this.selfIsMaster = false; } - public void initGlobalMasterInfo(StateMachineContext context) { + public void updateMasterInfo(StateMachineContext context) { StateMachineContext.MasterServerInfo master = context.master(); if (master == null) { - this.globalMasterInfo.nodeInfo(false, ""); + this.roleInfo.resetMasterInfo(); return; } boolean isMaster = Objects.equals(context.node(), master.node()); - String url = master.url(); - this.globalMasterInfo.nodeInfo(isMaster, url); + this.roleInfo.masterInfo(isMaster, master.url()); } } diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StateMachineContext.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StateMachineContext.java similarity index 97% rename from hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StateMachineContext.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StateMachineContext.java index a3eaf89626..587cd417fc 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StateMachineContext.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StateMachineContext.java @@ -33,7 +33,7 @@ public interface StateMachineContext { void master(MasterServerInfo info); - ClusterRoleStore adapter(); + ClusterRoleStore roleStore(); void reset(); diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphGremlinPlugin.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphGremlinPlugin.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphGremlinPlugin.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphGremlinPlugin.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphPlugin.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphPlugin.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphPlugin.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/plugin/HugeGraphPlugin.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Client.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/rpc/RpcServiceConfig4Server.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/schema/EdgeLabel.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/EdgeLabel.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/schema/EdgeLabel.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/EdgeLabel.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/schema/IndexLabel.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/IndexLabel.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/schema/IndexLabel.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/IndexLabel.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/schema/PropertyKey.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/PropertyKey.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/schema/PropertyKey.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/PropertyKey.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaElement.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaElement.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaElement.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaElement.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaLabel.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaLabel.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaLabel.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaLabel.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaManager.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaManager.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/SchemaManager.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/schema/Userdata.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/Userdata.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/schema/Userdata.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/Userdata.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/schema/VertexLabel.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/VertexLabel.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/schema/VertexLabel.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/VertexLabel.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/AbstractBuilder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/AbstractBuilder.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/AbstractBuilder.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/AbstractBuilder.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/EdgeLabelBuilder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/EdgeLabelBuilder.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/EdgeLabelBuilder.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/EdgeLabelBuilder.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/IndexLabelBuilder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/IndexLabelBuilder.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/IndexLabelBuilder.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/IndexLabelBuilder.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/PropertyKeyBuilder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/PropertyKeyBuilder.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/PropertyKeyBuilder.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/PropertyKeyBuilder.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/SchemaBuilder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/SchemaBuilder.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/SchemaBuilder.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/SchemaBuilder.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/VertexLabelBuilder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/VertexLabelBuilder.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/VertexLabelBuilder.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/VertexLabelBuilder.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/structure/GraphType.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/GraphType.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/structure/GraphType.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/GraphType.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdge.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdge.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdge.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdge.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdgeProperty.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdgeProperty.java similarity index 94% rename from hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdgeProperty.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdgeProperty.java index 3f1f021535..787c66f448 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdgeProperty.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeEdgeProperty.java @@ -20,11 +20,10 @@ import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.type.HugeType; +import org.apache.hugegraph.util.E; import org.apache.tinkerpop.gremlin.structure.Property; import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; -import org.apache.hugegraph.util.E; - public class HugeEdgeProperty extends HugeProperty { public HugeEdgeProperty(HugeElement owner, PropertyKey key, V value) { @@ -67,7 +66,7 @@ public int hashCode() { public HugeEdgeProperty switchEdgeOwner() { assert this.owner instanceof HugeEdge; - return new HugeEdgeProperty(((HugeEdge) this.owner).switchOwner(), - this.pkey, this.value); + return new HugeEdgeProperty<>(((HugeEdge) this.owner).switchOwner(), + this.pkey, this.value); } } diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeElement.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeElement.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeElement.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeElement.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeFeatures.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeFeatures.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeFeatures.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeFeatures.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeIndex.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeIndex.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeIndex.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeIndex.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeProperty.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeProperty.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeProperty.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeProperty.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertexProperty.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertexProperty.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertexProperty.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertexProperty.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/task/EphemeralJobQueue.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/EphemeralJobQueue.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/task/EphemeralJobQueue.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/EphemeralJobQueue.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeServerInfo.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeServerInfo.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeServerInfo.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeServerInfo.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeTask.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeTask.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeTask.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeTask.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java similarity index 78% rename from hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java index e8cccf88e3..ee14b4ceb2 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java @@ -37,6 +37,7 @@ import org.apache.hugegraph.exception.ConnectionException; import org.apache.hugegraph.iterator.ListIterator; import org.apache.hugegraph.iterator.MapperIterator; +import org.apache.hugegraph.masterelection.GlobalMasterInfo; import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.schema.VertexLabel; import org.apache.hugegraph.structure.HugeVertex; @@ -61,8 +62,7 @@ public class ServerInfoManager { private final HugeGraphParams graph; private final ExecutorService dbExecutor; - private Id selfServerId; - private NodeRole selfServerRole; + private volatile GlobalMasterInfo globalNodeInfo; private volatile boolean onlySingleNode; private volatile boolean closed; @@ -75,8 +75,7 @@ public ServerInfoManager(HugeGraphParams graph, this.graph = graph; this.dbExecutor = dbExecutor; - this.selfServerId = null; - this.selfServerRole = NodeRole.MASTER; + this.globalNodeInfo = null; this.onlySingleNode = false; this.closed = false; @@ -86,7 +85,7 @@ public void init() { HugeServerInfo.schema(this.graph).initSchemaIfNeeded(); } - public boolean close() { + public synchronized boolean close() { this.closed = true; if (!this.dbExecutor.isShutdown()) { this.removeSelfServerInfo(); @@ -103,40 +102,24 @@ public boolean close() { return true; } - public synchronized void forceInitServerInfo(Id server, NodeRole role) { - if (this.closed) { - return; - } - - E.checkArgument(server != null && role != null, - "The server id or role can't be null"); - this.selfServerId = server; - this.selfServerRole = role; + public synchronized void initServerInfo(GlobalMasterInfo nodeInfo) { + E.checkArgument(nodeInfo != null, "The global node info can't be null"); - this.saveServerInfo(this.selfServerId, this.selfServerRole); - } - - public synchronized void initServerInfo(Id server, NodeRole role) { - E.checkArgument(server != null && role != null, - "The server id or role can't be null"); - this.selfServerId = server; - this.selfServerRole = role; - - HugeServerInfo existed = this.serverInfo(server); + Id serverId = nodeInfo.nodeId(); + HugeServerInfo existed = this.serverInfo(serverId); E.checkArgument(existed == null || !existed.alive(), "The server with name '%s' already in cluster", - server); - if (role.master()) { + serverId); + + if (nodeInfo.nodeRole().master()) { String page = this.supportsPaging() ? PageInfo.PAGE_NONE : null; do { - Iterator servers = this.serverInfos(PAGE_SIZE, - page); + Iterator servers = this.serverInfos(PAGE_SIZE, page); while (servers.hasNext()) { existed = servers.next(); - E.checkArgument(!existed.role().master() || - !existed.alive(), - "Already existed master '%s' in current " + - "cluster", existed.id()); + E.checkArgument(!existed.role().master() || !existed.alive(), + "Already existed master '%s' in current cluster", + existed.id()); } if (page != null) { page = PageInfo.pageInfo(servers); @@ -144,36 +127,80 @@ public synchronized void initServerInfo(Id server, NodeRole role) { } while (page != null); } - // TODO: save ServerInfo at AuthServer - this.saveServerInfo(this.selfServerId, this.selfServerRole); + this.globalNodeInfo = nodeInfo; + + // TODO: save ServerInfo to AuthServer + this.saveServerInfo(this.selfNodeId(), this.selfNodeRole()); + } + + public synchronized void changeServerRole(NodeRole nodeRole) { + if (this.closed) { + return; + } + + this.globalNodeInfo.changeNodeRole(nodeRole); + + // TODO: save ServerInfo to AuthServer + this.saveServerInfo(this.selfNodeId(), this.selfNodeRole()); } - public Id selfServerId() { - return this.selfServerId; + public GlobalMasterInfo globalNodeRoleInfo() { + return this.globalNodeInfo; } - public NodeRole selfServerRole() { - return this.selfServerRole; + public Id selfNodeId() { + if (this.globalNodeInfo == null) { + return null; + } + return this.globalNodeInfo.nodeId(); + } + + public NodeRole selfNodeRole() { + if (this.globalNodeInfo == null) { + return null; + } + return this.globalNodeInfo.nodeRole(); } - public boolean master() { - return this.selfServerRole != null && this.selfServerRole.master(); + public boolean selfIsMaster() { + return this.selfNodeRole() != null && this.selfNodeRole().master(); } public boolean onlySingleNode() { - // Only has one master node + // Only exists one node in the whole master return this.onlySingleNode; } - public void heartbeat() { + public synchronized void heartbeat() { + assert this.graphIsReady(); + HugeServerInfo serverInfo = this.selfServerInfo(); - if (serverInfo == null && this.selfServerId != null && - this.selfServerRole != NodeRole.MASTER) { - serverInfo = this.saveServerInfo(this.selfServerId, - this.selfServerRole); + if (serverInfo != null) { + // Update heartbeat time for this server + serverInfo.updateTime(DateUtil.now()); + this.save(serverInfo); + return; } - serverInfo.updateTime(DateUtil.now()); - this.save(serverInfo); + + /* ServerInfo is missing */ + if (this.selfNodeId() == null) { + // Ignore if ServerInfo is not initialized + LOG.info("ServerInfo is missing: {}, may not be initialized yet"); + return; + } + if (this.selfIsMaster()) { + // On master node, just wait for ServerInfo re-init + LOG.warn("ServerInfo is missing: {}, may be cleared before", + this.selfNodeId()); + return; + } + /* + * Missing server info on non-master node, may be caused by graph + * truncated on master node then synced by raft. + * TODO: we just patch it here currently, to be improved. + */ + serverInfo = this.saveServerInfo(this.selfNodeId(), this.selfNodeRole()); + assert serverInfo != null; } public synchronized void decreaseLoad(int load) { @@ -188,7 +215,7 @@ public int calcMaxLoad() { return 10000; } - protected boolean graphReady() { + protected boolean graphIsReady() { return !this.closed && this.graph.started() && this.graph.initialized(); } @@ -242,8 +269,8 @@ private GraphTransaction tx() { return this.graph.systemTransaction(); } - private HugeServerInfo saveServerInfo(Id server, NodeRole role) { - HugeServerInfo serverInfo = new HugeServerInfo(server, role); + private HugeServerInfo saveServerInfo(Id serverId, NodeRole serverRole) { + HugeServerInfo serverInfo = new HugeServerInfo(serverId, serverRole); serverInfo.maxLoad(this.calcMaxLoad()); this.save(serverInfo); @@ -310,16 +337,16 @@ private V call(Callable callable) { } private HugeServerInfo selfServerInfo() { - HugeServerInfo selfServerInfo = this.serverInfo(this.selfServerId); - if (selfServerInfo == null) { - LOG.warn("ServerInfo is missing: {}", this.selfServerId); + HugeServerInfo selfServerInfo = this.serverInfo(this.selfNodeId()); + if (selfServerInfo == null && this.selfNodeId() != null) { + LOG.warn("ServerInfo is missing: {}", this.selfNodeId()); } return selfServerInfo; } - private HugeServerInfo serverInfo(Id server) { + private HugeServerInfo serverInfo(Id serverId) { return this.call(() -> { - Iterator vertices = this.tx().queryVertices(server); + Iterator vertices = this.tx().queryVertices(serverId); Vertex vertex = QueryResults.one(vertices); if (vertex == null) { return null; @@ -335,19 +362,19 @@ private HugeServerInfo removeSelfServerInfo() { * backend store, initServerInfo() is not called in this case, so * this.selfServerId is null at this time. */ - if (this.selfServerId != null && this.graph.initialized()) { - return this.removeServerInfo(this.selfServerId); + if (this.selfNodeId() != null && this.graph.initialized()) { + return this.removeServerInfo(this.selfNodeId()); } return null; } - private HugeServerInfo removeServerInfo(Id server) { - if (server == null) { + private HugeServerInfo removeServerInfo(Id serverId) { + if (serverId == null) { return null; } - LOG.info("Remove server info: {}", server); + LOG.info("Remove server info: {}", serverId); return this.call(() -> { - Iterator vertices = this.tx().queryVertices(server); + Iterator vertices = this.tx().queryVertices(serverId); Vertex vertex = QueryResults.one(vertices); if (vertex == null) { return null; diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/task/StandardTaskScheduler.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/StandardTaskScheduler.java similarity index 96% rename from hugegraph-core/src/main/java/org/apache/hugegraph/task/StandardTaskScheduler.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/StandardTaskScheduler.java index 9eda3f6b02..120aeb0d66 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/task/StandardTaskScheduler.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/StandardTaskScheduler.java @@ -141,7 +141,7 @@ private TaskTransaction tx() { @Override public void restoreTasks() { - Id selfServer = this.serverManager().selfServerId(); + Id selfServer = this.serverManager().selfNodeId(); // Restore 'RESTORING', 'RUNNING' and 'QUEUED' tasks in order. for (TaskStatus status : TaskStatus.PENDING_STATUSES) { String page = this.supportsPaging() ? PageInfo.PAGE_NONE : null; @@ -177,35 +177,35 @@ private Future restore(HugeTask task) { public Future schedule(HugeTask task) { E.checkArgumentNotNull(task, "Task can't be null"); + /* + * Just submit to queue if status=QUEUED (means re-schedule task) + * NOTE: schedule() method may be called multi times by + * HugeTask.checkDependenciesSuccess() method + */ if (task.status() == TaskStatus.QUEUED) { - /* - * Just submit to queue if status=QUEUED (means re-schedule task) - * NOTE: schedule() method may be called multi times by - * HugeTask.checkDependenciesSuccess() method - */ return this.resubmitTask(task); } + /* + * Due to EphemeralJob won't be serialized and deserialized through + * shared storage, submit EphemeralJob immediately on any node + */ if (task.callable() instanceof EphemeralJob) { - /* - * Due to EphemeralJob won't be serialized and deserialized through - * shared storage, submit EphemeralJob immediately on master - * NOTE: don't need to save EphemeralJob task - */ + // NOTE: we don't need to save EphemeralJob task task.status(TaskStatus.QUEUED); return this.submitTask(task); } - // Only check if not EphemeralJob + // Check this is on master for normal task schedule this.checkOnMasterNode("schedule"); if (this.serverManager().onlySingleNode() && !task.computer()) { /* * Speed up for single node, submit task immediately, - * this code can be removed without affecting logic + * this code can be removed without affecting code logic */ task.status(TaskStatus.QUEUED); - task.server(this.serverManager().selfServerId()); + task.server(this.serverManager().selfNodeId()); this.save(task); return this.submitTask(task); } else { @@ -278,8 +278,8 @@ public synchronized void cancel(HugeTask task) { // The task scheduled to workers, let the worker node to cancel this.save(task); assert task.server() != null : task; - assert this.serverManager().master(); - if (!task.server().equals(this.serverManager().selfServerId())) { + assert this.serverManager().selfIsMaster(); + if (!task.server().equals(this.serverManager().selfNodeId())) { /* * Remove task from memory if it's running on worker node, * but keep task in memory if it's running on master node. @@ -303,10 +303,10 @@ protected ServerInfoManager serverManager() { return this.serverManager; } - protected synchronized void scheduleTasks() { + protected synchronized void scheduleTasksOnMaster() { // Master server schedule all scheduling tasks to suitable worker nodes - Collection scheduleInfos = this.serverManager() - .allServerInfos(); + Collection serverInfos = this.serverManager() + .allServerInfos(); String page = this.supportsPaging() ? PageInfo.PAGE_NONE : null; do { Iterator> tasks = this.tasks(TaskStatus.SCHEDULING, @@ -318,12 +318,12 @@ protected synchronized void scheduleTasks() { continue; } - if (!this.serverManager.master()) { + if (!this.serverManager.selfIsMaster()) { return; } HugeServerInfo server = this.serverManager().pickWorkerNode( - scheduleInfos, task); + serverInfos, task); if (server == null) { LOG.info("The master can't find suitable servers to " + "execute task '{}', wait for next schedule", @@ -348,7 +348,8 @@ protected synchronized void scheduleTasks() { } } while (page != null); - this.serverManager().updateServerInfos(scheduleInfos); + // Save to store + this.serverManager().updateServerInfos(serverInfos); } protected void executeTasksOnWorker(Id server) { @@ -422,7 +423,7 @@ protected void cancelTasksOnWorker(Id server) { protected void taskDone(HugeTask task) { this.remove(task); - Id selfServerId = this.serverManager().selfServerId(); + Id selfServerId = this.serverManager().selfNodeId(); try { this.serverManager().decreaseLoad(task.load()); } catch (Throwable e) { @@ -718,7 +719,7 @@ private V call(Callable callable) { } private void checkOnMasterNode(String op) { - if (!this.serverManager().master()) { + if (!this.serverManager().selfIsMaster()) { throw new HugeException("Can't %s task on non-master server", op); } } diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskManager.java similarity index 91% rename from hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskManager.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskManager.java index 524a1f7593..b3726d3830 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskManager.java @@ -26,16 +26,17 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.HugeGraphParams; +import org.apache.hugegraph.concurrent.PausableScheduledThreadPool; import org.apache.hugegraph.type.define.NodeRole; -import org.apache.hugegraph.util.*; import org.apache.hugegraph.util.Consumers; +import org.apache.hugegraph.util.E; +import org.apache.hugegraph.util.ExecutorUtil; import org.apache.hugegraph.util.LockUtil; +import org.apache.hugegraph.util.Log; import org.slf4j.Logger; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.HugeGraphParams; -import org.apache.hugegraph.concurrent.PausableScheduledThreadPool; - public final class TaskManager { private static final Logger LOG = Log.logger(TaskManager.class); @@ -48,7 +49,7 @@ public final class TaskManager { public static final String TASK_SCHEDULER = "task-scheduler-%d"; protected static final long SCHEDULE_PERIOD = 1000L; // unit ms - + private static final long TX_CLOSE_TIMEOUT = 30L; // unit s private static final int THREADS = 4; private static final TaskManager MANAGER = new TaskManager(THREADS); @@ -134,7 +135,7 @@ private void closeTaskTx(HugeGraphParams graph) { graph.closeTx(); } else { Consumers.executeOncePerThread(this.taskExecutor, totalThreads, - graph::closeTx); + graph::closeTx, TX_CLOSE_TIMEOUT); } } catch (Exception e) { throw new HugeException("Exception when closing task tx", e); @@ -242,19 +243,8 @@ public int pendingTasks() { return size; } - protected void notifyNewTask(HugeTask task) { - Queue queue = ((ThreadPoolExecutor) this.schedulerExecutor) - .getQueue(); - if (queue.size() <= 1) { - /* - * Notify to schedule tasks initiatively when have new task - * It's OK to not notify again if there are more than one task in - * queue(like two, one is timer task, one is immediate task), - * we don't want too many immediate tasks to be inserted into queue, - * one notify will cause all the tasks to be processed. - */ - this.schedulerExecutor.submit(this::scheduleOrExecuteJob); - } + public void enableRoleElection() { + this.enableRoleElected = true; } public void onAsRoleMaster() { @@ -262,7 +252,7 @@ public void onAsRoleMaster() { for (TaskScheduler entry : this.schedulers.values()) { StandardTaskScheduler scheduler = (StandardTaskScheduler) entry; ServerInfoManager serverInfoManager = scheduler.serverManager(); - serverInfoManager.forceInitServerInfo(serverInfoManager.selfServerId(), NodeRole.MASTER); + serverInfoManager.changeServerRole(NodeRole.MASTER); } } catch (Throwable e) { LOG.error("Exception occurred when change to master role", e); @@ -275,7 +265,7 @@ public void onAsRoleWorker() { for (TaskScheduler entry : this.schedulers.values()) { StandardTaskScheduler scheduler = (StandardTaskScheduler) entry; ServerInfoManager serverInfoManager = scheduler.serverManager(); - serverInfoManager.forceInitServerInfo(serverInfoManager.selfServerId(), NodeRole.WORKER); + serverInfoManager.changeServerRole(NodeRole.WORKER); } } catch (Throwable e) { LOG.error("Exception occurred when change to worker role", e); @@ -283,8 +273,19 @@ public void onAsRoleWorker() { } } - public void enableRoleElected(boolean enableRoleElected) { - this.enableRoleElected = enableRoleElected; + protected void notifyNewTask(HugeTask task) { + Queue queue = ((ThreadPoolExecutor) this.schedulerExecutor) + .getQueue(); + if (queue.size() <= 1) { + /* + * Notify to schedule tasks initiatively when have new task + * It's OK to not notify again if there are more than one task in + * queue(like two, one is timer task, one is immediate task), + * we don't want too many immediate tasks to be inserted into queue, + * one notify will cause all the tasks to be processed. + */ + this.schedulerExecutor.submit(this::scheduleOrExecuteJob); + } } private void scheduleOrExecuteJob() { @@ -323,7 +324,7 @@ private void scheduleOrExecuteJobForGraph(StandardTaskScheduler scheduler) { * If graph is closed, don't call serverManager.initialized() * due to it will reopen graph tx. */ - if (!serverManager.graphReady()) { + if (!serverManager.graphIsReady()) { return; } @@ -331,25 +332,25 @@ private void scheduleOrExecuteJobForGraph(StandardTaskScheduler scheduler) { serverManager.heartbeat(); /* - * Master schedule tasks to suitable servers. - * Worker maybe become Master, so Master also need perform tasks assigned by - * previous Master when enableRoleElected is true. - * However, the master only needs to take the assignment, - * because the master stays the same when enableRoleElected is false. - * There is no suitable server when these tasks are created + * Master will schedule tasks to suitable servers. + * Note a Worker may become to a Master, so elected-Master also needs to + * execute tasks assigned by previous Master when enableRoleElected=true. + * However, when enableRoleElected=false, a Master is only set by the + * config assignment, assigned-Master always stays the same state. */ - if (serverManager.master()) { - scheduler.scheduleTasks(); + if (serverManager.selfIsMaster()) { + scheduler.scheduleTasksOnMaster(); if (!this.enableRoleElected && !serverManager.onlySingleNode()) { + // assigned-Master + non-single-node don't need to execute tasks return; } } - // Schedule queued tasks scheduled to current server - scheduler.executeTasksOnWorker(serverManager.selfServerId()); + // Execute queued tasks scheduled to current server + scheduler.executeTasksOnWorker(serverManager.selfNodeId()); // Cancel tasks scheduled to current server - scheduler.cancelTasksOnWorker(serverManager.selfServerId()); + scheduler.cancelTasksOnWorker(serverManager.selfNodeId()); } finally { LockUtil.unlock(graph, LockUtil.GRAPH_LOCK); } diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskScheduler.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskScheduler.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskScheduler.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskScheduler.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskStatus.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskStatus.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskStatus.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskStatus.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CollectionPathsTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CollectionPathsTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CollectionPathsTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CollectionPathsTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CountTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CountTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CountTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CountTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CustomizePathsTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CustomizePathsTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CustomizePathsTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CustomizePathsTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CustomizedCrosspointsTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CustomizedCrosspointsTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CustomizedCrosspointsTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CustomizedCrosspointsTraverser.java diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/EdgeExistenceTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/EdgeExistenceTraverser.java new file mode 100644 index 0000000000..38f92daa30 --- /dev/null +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/EdgeExistenceTraverser.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hugegraph.traversal.algorithm; + +import java.util.Iterator; + +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.backend.query.ConditionQuery; +import org.apache.hugegraph.iterator.FilterIterator; +import org.apache.hugegraph.schema.EdgeLabel; +import org.apache.hugegraph.type.HugeType; +import org.apache.hugegraph.type.define.Directions; +import org.apache.hugegraph.type.define.HugeKeys; +import org.apache.tinkerpop.gremlin.structure.Edge; + +public class EdgeExistenceTraverser extends HugeTraverser { + + public EdgeExistenceTraverser(HugeGraph graph) { + super(graph); + } + + public Iterator queryEdgeExistence(Id sourceId, Id targetId, String label, + String sortValues, long limit) { + // If no label provided, fallback to a slow query by filtering + if (label == null || label.isEmpty()) { + return queryByNeighbors(sourceId, targetId, limit); + } + + EdgeLabel edgeLabel = graph().edgeLabel(label); + ConditionQuery conditionQuery = new ConditionQuery(HugeType.EDGE); + conditionQuery.eq(HugeKeys.OWNER_VERTEX, sourceId); + conditionQuery.eq(HugeKeys.OTHER_VERTEX, targetId); + conditionQuery.eq(HugeKeys.LABEL, edgeLabel.id()); + conditionQuery.eq(HugeKeys.DIRECTION, Directions.OUT); + conditionQuery.limit(limit); + + if (edgeLabel.existSortKeys() && !sortValues.isEmpty()) { + conditionQuery.eq(HugeKeys.SORT_VALUES, sortValues); + } else { + conditionQuery.eq(HugeKeys.SORT_VALUES, ""); + } + return graph().edges(conditionQuery); + } + + private Iterator queryByNeighbors(Id sourceId, Id targetId, long limit) { + return new FilterIterator<>(edgesOfVertex(sourceId, Directions.OUT, (Id) null, limit), + edge -> targetId.equals(edge.inVertex().id())); + } +} diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/FusiformSimilarityTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/FusiformSimilarityTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/FusiformSimilarityTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/FusiformSimilarityTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java similarity index 95% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java index f5415d9c51..194576e857 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/HugeTraverser.java @@ -17,6 +17,8 @@ package org.apache.hugegraph.traversal.algorithm; +import java.io.Closeable; +import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -37,6 +39,7 @@ import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.backend.query.Aggregate; import org.apache.hugegraph.backend.query.ConditionQuery; +import org.apache.hugegraph.backend.query.EdgesQueryIterator; import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.query.QueryResults; import org.apache.hugegraph.backend.tx.GraphTransaction; @@ -66,6 +69,7 @@ import org.apache.hugegraph.util.collection.ObjectIntMapping; import org.apache.hugegraph.util.collection.ObjectIntMappingFactory; import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; import org.slf4j.Logger; import com.google.common.collect.ImmutableList; @@ -465,6 +469,13 @@ private Iterator edgesOfVertex(Id source, EdgeStep edgeStep, return edgeStep.skipSuperNodeIfNeeded(edges); } + public EdgesIterator edgesOfVertices(Iterator sources, + Directions dir, + List labelIds, + long degree) { + return new EdgesIterator(new EdgesQueryIterator(sources, dir, labelIds, degree)); + } + public Iterator edgesOfVertex(Id source, Steps steps) { List edgeLabels = steps.edgeLabels(); ConditionQuery cq = GraphTransaction.constructEdgesQuery( @@ -474,6 +485,11 @@ public Iterator edgesOfVertex(Id source, Steps steps) { cq.limit(steps.limit()); } + if (steps.isEdgeEmpty()) { + Iterator edges = this.graph().edges(cq); + return edgesOfVertexStep(edges, steps); + } + Map edgeConditions = getFilterQueryConditions(steps.edgeSteps(), HugeType.EDGE); @@ -1004,4 +1020,33 @@ public Set getEdges(Iterator vertexIter) { return edges; } } + + public class EdgesIterator implements Iterator>, Closeable { + + private final Iterator> currentIter; + + public EdgesIterator(EdgesQueryIterator queries) { + List> iteratorList = new ArrayList<>(); + while (queries.hasNext()) { + Iterator edges = graph.edges(queries.next()); + iteratorList.add(edges); + } + this.currentIter = iteratorList.iterator(); + } + + @Override + public boolean hasNext() { + return this.currentIter.hasNext(); + } + + @Override + public Iterator next() { + return this.currentIter.next(); + } + + @Override + public void close() throws IOException { + CloseableIterator.closeIterator(currentIter); + } + } } diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/JaccardSimilarTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/JaccardSimilarTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/JaccardSimilarTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/JaccardSimilarTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KneighborTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KneighborTraverser.java similarity index 68% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KneighborTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KneighborTraverser.java index 9f16f480b2..565d0af5f6 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KneighborTraverser.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KneighborTraverser.java @@ -17,11 +17,11 @@ package org.apache.hugegraph.traversal.algorithm; -import java.util.Iterator; import java.util.Set; import java.util.function.Consumer; import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.backend.id.EdgeId; import org.apache.hugegraph.backend.id.Id; import org.apache.hugegraph.structure.HugeEdge; import org.apache.hugegraph.traversal.algorithm.records.KneighborRecords; @@ -48,25 +48,27 @@ public Set kneighbor(Id sourceV, Directions dir, Id labelId = this.getEdgeLabelId(label); - Set latest = newSet(); - Set all = newSet(); + KneighborRecords records = new KneighborRecords(true, sourceV, true); - latest.add(sourceV); - this.vertexIterCounter.addAndGet(1L); + Consumer consumer = edgeId -> { + if (this.reachLimit(limit, records.size())) { + return; + } + records.addPath(edgeId.ownerVertexId(), edgeId.otherVertexId()); + }; while (depth-- > 0) { - long remaining = limit == NO_LIMIT ? NO_LIMIT : limit - all.size(); - latest = this.adjacentVertices(sourceV, latest, dir, labelId, - all, degree, remaining); - all.addAll(latest); - this.vertexIterCounter.addAndGet(1L); - this.edgeIterCounter.addAndGet(latest.size()); - if (reachLimit(limit, all.size())) { + records.startOneLayer(true); + traverseIdsByBfs(records.keys(), dir, labelId, degree, NO_LIMIT, consumer); + records.finishOneLayer(); + if (reachLimit(limit, records.size())) { break; } } - return all; + this.vertexIterCounter.addAndGet(records.size()); + + return records.idsBySet(limit); } public KneighborRecords customizedKneighbor(Id source, Steps steps, @@ -76,33 +78,29 @@ public KneighborRecords customizedKneighbor(Id source, Steps steps, checkPositive(maxDepth, "k-neighbor max_depth"); checkLimit(limit); - boolean concurrent = maxDepth >= this.concurrentDepth(); - - KneighborRecords records = new KneighborRecords(concurrent, + KneighborRecords records = new KneighborRecords(true, source, true); - Consumer consumer = v -> { + Consumer consumer = edge -> { if (this.reachLimit(limit, records.size())) { return; } - Iterator edges = edgesOfVertex(v, steps); - this.vertexIterCounter.addAndGet(1L); - while (!this.reachLimit(limit, records.size()) && edges.hasNext()) { - HugeEdge edge = (HugeEdge) edges.next(); - Id target = edge.id().otherVertexId(); - records.addPath(v, target); - - records.edgeResults().addEdge(v, target, edge); - - this.edgeIterCounter.addAndGet(1L); - } + EdgeId edgeId = ((HugeEdge) edge).id(); + records.addPath(edgeId.ownerVertexId(), edgeId.otherVertexId()); + records.edgeResults().addEdge(edgeId.ownerVertexId(), edgeId.otherVertexId(), edge); }; while (maxDepth-- > 0) { records.startOneLayer(true); - traverseIds(records.keys(), consumer, concurrent); + traverseIdsByBfs(records.keys(), steps, NO_LIMIT, consumer); records.finishOneLayer(); + if (this.reachLimit(limit, records.size())) { + break; + } } + + this.vertexIterCounter.addAndGet(records.size()); + return records; } diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KoutTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KoutTraverser.java similarity index 76% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KoutTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KoutTraverser.java index 9924c766c5..c683694c14 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KoutTraverser.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/KoutTraverser.java @@ -18,12 +18,15 @@ package org.apache.hugegraph.traversal.algorithm; import java.util.Iterator; +import java.util.List; import java.util.Set; import java.util.function.Consumer; import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.backend.id.EdgeId; import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.structure.HugeEdge; import org.apache.hugegraph.traversal.algorithm.records.KoutRecords; import org.apache.hugegraph.traversal.algorithm.steps.Steps; @@ -57,34 +60,45 @@ public Set kout(Id sourceV, Directions dir, String label, Id labelId = this.getEdgeLabelId(label); - Set latest = newIdSet(); - latest.add(sourceV); + Set sources = newIdSet(); + Set neighbors = newIdSet(); + Set visited = nearest ? newIdSet() : null; - Set all = newIdSet(); - all.add(sourceV); + neighbors.add(sourceV); + + ConcurrentVerticesConsumer consumer; + + long remaining = capacity == NO_LIMIT ? NO_LIMIT : capacity - 1; - long remaining = capacity == NO_LIMIT ? - NO_LIMIT : capacity - latest.size(); - this.vertexIterCounter.addAndGet(1L); while (depth-- > 0) { // Just get limit nodes in last layer if limit < remaining capacity if (depth == 0 && limit != NO_LIMIT && (limit < remaining || remaining == NO_LIMIT)) { remaining = limit; } - if (nearest) { - latest = this.adjacentVertices(sourceV, latest, dir, labelId, - all, degree, remaining); - all.addAll(latest); - } else { - latest = this.adjacentVertices(sourceV, latest, dir, labelId, - null, degree, remaining); + + if (visited != null) { + visited.addAll(neighbors); } - this.vertexIterCounter.addAndGet(1L); - this.edgeIterCounter.addAndGet(latest.size()); + + // swap sources and neighbors + Set tmp = neighbors; + neighbors = sources; + sources = tmp; + + // start + consumer = new ConcurrentVerticesConsumer(sourceV, visited, remaining, neighbors); + + this.vertexIterCounter.addAndGet(sources.size()); + this.edgeIterCounter.addAndGet(neighbors.size()); + + traverseIdsByBfs(sources.iterator(), dir, labelId, degree, capacity, consumer); + + sources.clear(); + if (capacity != NO_LIMIT) { // Update 'remaining' value to record remaining capacity - remaining -= latest.size(); + remaining -= neighbors.size(); if (remaining <= 0 && depth > 0) { throw new HugeException( @@ -94,7 +108,7 @@ public Set kout(Id sourceV, Directions dir, String label, } } - return latest; + return neighbors; } public KoutRecords customizedKout(Id source, Steps steps, @@ -107,33 +121,25 @@ public KoutRecords customizedKout(Id source, Steps steps, checkLimit(limit); long[] depth = new long[1]; depth[0] = maxDepth; - boolean concurrent = maxDepth >= this.concurrentDepth(); - KoutRecords records = new KoutRecords(concurrent, source, nearest, 0); + KoutRecords records = new KoutRecords(true, source, nearest, 0); - Consumer consumer = v -> { + Consumer consumer = edge -> { if (this.reachLimit(limit, depth[0], records.size())) { return; } - Iterator edges = edgesOfVertex(v, steps); - this.vertexIterCounter.addAndGet(1L); - while (!this.reachLimit(limit, depth[0], records.size()) && - edges.hasNext()) { - HugeEdge edge = (HugeEdge) edges.next(); - Id target = edge.id().otherVertexId(); - records.addPath(v, target); - this.checkCapacity(capacity, records.accessed(), depth[0]); - - records.edgeResults().addEdge(v, target, edge); - - this.edgeIterCounter.addAndGet(1L); - } + EdgeId edgeId = ((HugeEdge) edge).id(); + records.addPath(edgeId.ownerVertexId(), edgeId.otherVertexId()); + records.edgeResults().addEdge(edgeId.ownerVertexId(), edgeId.otherVertexId(), edge); }; while (depth[0]-- > 0) { + List sources = records.ids(Query.NO_LIMIT); records.startOneLayer(true); - this.traverseIds(records.keys(), consumer, concurrent); + traverseIdsByBfs(sources.iterator(), steps, capacity, consumer); + this.vertexIterCounter.addAndGet(sources.size()); records.finishOneLayer(); + checkCapacity(capacity, records.accessed(), depth[0]); } return records; } diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/MultiNodeShortestPathTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/MultiNodeShortestPathTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/MultiNodeShortestPathTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/MultiNodeShortestPathTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/NeighborRankTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/NeighborRankTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/NeighborRankTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/NeighborRankTraverser.java diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/OltpTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/OltpTraverser.java new file mode 100644 index 0000000000..c05d8f89f4 --- /dev/null +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/OltpTraverser.java @@ -0,0 +1,381 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hugegraph.traversal.algorithm; + +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; + +import org.apache.commons.lang3.tuple.Pair; +import org.apache.hugegraph.HugeGraph; +import org.apache.hugegraph.backend.id.EdgeId; +import org.apache.hugegraph.backend.id.Id; +import org.apache.hugegraph.backend.query.EdgesQueryIterator; +import org.apache.hugegraph.config.CoreOptions; +import org.apache.hugegraph.iterator.FilterIterator; +import org.apache.hugegraph.iterator.MapperIterator; +import org.apache.hugegraph.structure.HugeEdge; +import org.apache.hugegraph.traversal.algorithm.steps.Steps; +import org.apache.hugegraph.type.define.Directions; +import org.apache.hugegraph.util.Consumers; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.tinkerpop.gremlin.structure.Property; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; + +import com.google.common.base.Objects; + +public abstract class OltpTraverser extends HugeTraverser + implements AutoCloseable { + + private static final String EXECUTOR_NAME = "oltp"; + private static Consumers.ExecutorPool executors; + + protected OltpTraverser(HugeGraph graph) { + super(graph); + if (executors != null) { + return; + } + synchronized (OltpTraverser.class) { + if (executors != null) { + return; + } + int workers = this.graph() + .option(CoreOptions.OLTP_CONCURRENT_THREADS); + if (workers > 0) { + executors = new Consumers.ExecutorPool(EXECUTOR_NAME, workers); + } + } + } + + @Override + public void close() { + // pass + } + + public static void destroy() { + synchronized (OltpTraverser.class) { + if (executors != null) { + executors.destroy(); + executors = null; + } + } + } + + protected long traversePairs(Iterator> pairs, + Consumer> consumer) { + return this.traverseByOne(pairs, consumer, "traverse-pairs"); + } + + protected long traverseIds(Iterator ids, Consumer consumer, + boolean concurrent) { + if (concurrent) { + return this.traverseIds(ids, consumer); + } else { + long count = 0L; + while (ids.hasNext()) { + count++; + consumer.accept(ids.next()); + } + return count; + } + } + + protected long traverseIds(Iterator ids, Consumer consumer) { + return this.traverseByOne(ids, consumer, "traverse-ids"); + } + + protected long traverseByOne(Iterator iterator, + Consumer consumer, + String taskName) { + if (!iterator.hasNext()) { + return 0L; + } + + Consumers consumers = new Consumers<>(executors.getExecutor(), + consumer, null); + consumers.start(taskName); + long total = 0L; + try { + while (iterator.hasNext()) { + total++; + K v = iterator.next(); + consumers.provide(v); + } + } catch (Consumers.StopExecution e) { + // pass + } catch (Throwable e) { + throw Consumers.wrapException(e); + } finally { + try { + consumers.await(); + } catch (Throwable e) { + throw Consumers.wrapException(e); + } finally { + executors.returnExecutor(consumers.executor()); + CloseableIterator.closeIterator(iterator); + } + } + return total; + } + + protected void traverseIdsByBfs(Iterator vertices, + Directions dir, + Id label, + long degree, + long capacity, + Consumer consumer) { + List labels = label == null ? Collections.emptyList() : + Collections.singletonList(label); + OneStepEdgeIterConsumer edgeIterConsumer = new OneStepEdgeIterConsumer(consumer, capacity); + + EdgesIterator edgeIter = edgesOfVertices(vertices, dir, labels, degree); + + // parallel out-of-order execution + this.traverseByBatch(edgeIter, edgeIterConsumer, "traverse-bfs-step", 1); + } + + protected void traverseIdsByBfs(Iterator vertices, + Steps steps, + long capacity, + Consumer consumer) { + StepsEdgeIterConsumer edgeIterConsumer = + new StepsEdgeIterConsumer(consumer, capacity, steps); + + EdgesQueryIterator queryIterator = new EdgesQueryIterator(vertices, + steps.direction(), + steps.edgeLabels(), + steps.degree()); + + // get Iterator> from Iterator + EdgesIterator edgeIter = new EdgesIterator(queryIterator); + + // parallel out-of-order execution + this.traverseByBatch(edgeIter, edgeIterConsumer, "traverse-bfs-steps", 1); + } + + protected long traverseByBatch(Iterator> sources, + Consumer> consumer, + String taskName, int concurrentWorkers) { + if (!sources.hasNext()) { + return 0L; + } + AtomicBoolean done = new AtomicBoolean(false); + Consumers> consumers = null; + try { + consumers = buildConsumers(consumer, concurrentWorkers, done, + executors.getExecutor()); + return startConsumers(sources, taskName, done, consumers); + } finally { + assert consumers != null; + executors.returnExecutor(consumers.executor()); + } + } + + private long startConsumers(Iterator> sources, + String taskName, + AtomicBoolean done, + Consumers> consumers) { + long total = 0L; + try { + consumers.start(taskName); + while (sources.hasNext() && !done.get()) { + total++; + Iterator v = sources.next(); + consumers.provide(v); + } + } catch (Consumers.StopExecution e) { + // pass + } catch (Throwable e) { + throw Consumers.wrapException(e); + } finally { + try { + consumers.await(); + } catch (Throwable e) { + throw Consumers.wrapException(e); + } finally { + CloseableIterator.closeIterator(sources); + } + } + return total; + } + + private Consumers> buildConsumers(Consumer> consumer, + int queueSizePerWorker, + AtomicBoolean done, + ExecutorService executor) { + return new Consumers<>(executor, + consumer, + null, + e -> done.set(true), + queueSizePerWorker); + } + + protected Iterator filter(Iterator vertices, + String key, Object value) { + return new FilterIterator<>(vertices, vertex -> match(vertex, key, value)); + } + + protected boolean match(Element elem, String key, Object value) { + // check property key exists + this.graph().propertyKey(key); + // return true if property value exists & equals to specified value + Property p = elem.property(key); + return p.isPresent() && Objects.equal(p.value(), value); + } + + public static class ConcurrentMultiValuedMap + extends ConcurrentHashMap> { + + private static final long serialVersionUID = -7249946839643493614L; + + public ConcurrentMultiValuedMap() { + super(); + } + + public void add(K key, V value) { + List values = this.getValues(key); + values.add(value); + } + + public void addAll(K key, List value) { + List values = this.getValues(key); + values.addAll(value); + } + + public List getValues(K key) { + List values = this.get(key); + if (values == null) { + values = new CopyOnWriteArrayList<>(); + List old = this.putIfAbsent(key, values); + if (old != null) { + values = old; + } + } + return values; + } + } + + public static class ConcurrentVerticesConsumer implements Consumer { + + private final Id sourceV; + private final Set excluded; + private final Set neighbors; + private final long limit; + private final AtomicInteger count; + + public ConcurrentVerticesConsumer(Id sourceV, Set excluded, long limit, + Set neighbors) { + this.sourceV = sourceV; + this.excluded = excluded; + this.limit = limit; + this.neighbors = neighbors; + this.count = new AtomicInteger(0); + } + + @Override + public void accept(EdgeId edgeId) { + if (this.limit != NO_LIMIT && count.get() >= this.limit) { + throw new Consumers.StopExecution("reach limit"); + } + + Id targetV = edgeId.otherVertexId(); + if (this.sourceV.equals(targetV)) { + return; + } + + if (this.excluded != null && this.excluded.contains(targetV)) { + return; + } + + if (this.neighbors.add(targetV)) { + if (this.limit != NO_LIMIT) { + this.count.getAndIncrement(); + } + } + } + } + + public abstract class EdgesConsumer implements Consumer> { + + private final Consumer consumer; + private final long capacity; + + public EdgesConsumer(Consumer consumer, long capacity) { + this.consumer = consumer; + this.capacity = capacity; + } + + protected abstract Iterator prepare(Iterator iter); + + @Override + public void accept(Iterator edgeIter) { + Iterator ids = prepare(edgeIter); + long counter = 0; + while (ids.hasNext()) { + if (Thread.currentThread().isInterrupted()) { + LOG.warn("Consumer is Interrupted"); + break; + } + counter++; + this.consumer.accept(ids.next()); + } + long total = edgeIterCounter.addAndGet(counter); + // traverse by batch & improve performance + if (this.capacity != NO_LIMIT && total >= this.capacity) { + throw new Consumers.StopExecution("reach capacity"); + } + } + } + + public class OneStepEdgeIterConsumer extends EdgesConsumer { + + public OneStepEdgeIterConsumer(Consumer consumer, long capacity) { + super(consumer, capacity); + } + + @Override + protected Iterator prepare(Iterator edgeIter) { + return new MapperIterator<>(edgeIter, (e) -> ((HugeEdge) e).id()); + } + } + + public class StepsEdgeIterConsumer extends EdgesConsumer { + + private final Steps steps; + + public StepsEdgeIterConsumer(Consumer consumer, long capacity, + Steps steps) { + super(consumer, capacity); + this.steps = steps; + } + + @Override + protected Iterator prepare(Iterator edgeIter) { + return edgesOfVertexStep(edgeIter, this.steps); + } + } +} diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PathTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PathTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PathTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PathTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PathsTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PathsTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PathsTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PathsTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PersonalRankTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PersonalRankTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PersonalRankTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PersonalRankTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PredictionTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PredictionTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PredictionTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/PredictionTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/SameNeighborTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/SameNeighborTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/SameNeighborTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/SameNeighborTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/ShortestPathTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/ShortestPathTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/ShortestPathTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/ShortestPathTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/SingleSourceShortestPathTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/SingleSourceShortestPathTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/SingleSourceShortestPathTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/SingleSourceShortestPathTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/SubGraphTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/SubGraphTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/SubGraphTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/SubGraphTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/TemplatePathsTraverser.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/TemplatePathsTraverser.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/TemplatePathsTraverser.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/TemplatePathsTraverser.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/iterator/NestedIterator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/iterator/NestedIterator.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/iterator/NestedIterator.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/iterator/NestedIterator.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/AbstractRecords.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/AbstractRecords.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/AbstractRecords.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/AbstractRecords.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/DoubleWayMultiPathsRecords.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/DoubleWayMultiPathsRecords.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/DoubleWayMultiPathsRecords.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/DoubleWayMultiPathsRecords.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KneighborRecords.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KneighborRecords.java similarity index 89% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KneighborRecords.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KneighborRecords.java index 7e04a286c3..649b1c2116 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KneighborRecords.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KneighborRecords.java @@ -19,7 +19,9 @@ import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.NO_LIMIT; +import java.util.Collection; import java.util.List; +import java.util.Set; import java.util.Stack; import org.apache.hugegraph.backend.id.Id; @@ -45,6 +47,17 @@ public int size() { @Override public List ids(long limit) { List ids = CollectionFactory.newList(CollectionType.EC); + this.getRecords(limit, ids); + return ids; + } + + public Set idsBySet(long limit) { + Set ids = CollectionFactory.newSet(CollectionType.EC); + this.getRecords(limit, ids); + return ids; + } + + private void getRecords(long limit, Collection ids) { Stack records = this.records(); // Not include record(i=0) to ignore source vertex for (int i = 1; i < records.size(); i++) { @@ -54,7 +67,6 @@ public List ids(long limit) { limit--; } } - return ids; } @Override diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KoutRecords.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KoutRecords.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KoutRecords.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/KoutRecords.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/PathsRecords.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/PathsRecords.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/PathsRecords.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/PathsRecords.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/Records.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/Records.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/Records.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/Records.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/ShortestPathRecords.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/ShortestPathRecords.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/ShortestPathRecords.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/ShortestPathRecords.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/SingleWayMultiPathsRecords.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/SingleWayMultiPathsRecords.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/SingleWayMultiPathsRecords.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/SingleWayMultiPathsRecords.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Int2ArrayRecord.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Int2ArrayRecord.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Int2ArrayRecord.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Int2ArrayRecord.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Int2IntRecord.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Int2IntRecord.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Int2IntRecord.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Int2IntRecord.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Int2SetRecord.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Int2SetRecord.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Int2SetRecord.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Int2SetRecord.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Record.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Record.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Record.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/Record.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/RecordFactory.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/RecordFactory.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/RecordFactory.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/RecordFactory.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/RecordType.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/RecordType.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/RecordType.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/RecordType.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/SyncRecord.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/SyncRecord.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/SyncRecord.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/records/record/SyncRecord.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/EdgeStep.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/EdgeStep.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/EdgeStep.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/EdgeStep.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/RepeatEdgeStep.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/RepeatEdgeStep.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/RepeatEdgeStep.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/RepeatEdgeStep.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/Steps.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/Steps.java similarity index 98% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/Steps.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/Steps.java index d1a9238be1..c2a1a7e1e1 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/Steps.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/Steps.java @@ -138,6 +138,10 @@ public List edgeLabels() { return new ArrayList<>(this.edgeSteps.keySet()); } + public boolean isEdgeEmpty() { + return this.edgeSteps.isEmpty(); + } + public boolean isVertexEmpty() { return this.vertexSteps.isEmpty(); } diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/WeightedEdgeStep.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/WeightedEdgeStep.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/WeightedEdgeStep.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/steps/WeightedEdgeStep.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/ConcurrentTraverseStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/ConcurrentTraverseStrategy.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/ConcurrentTraverseStrategy.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/ConcurrentTraverseStrategy.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/SingleTraverseStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/SingleTraverseStrategy.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/SingleTraverseStrategy.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/SingleTraverseStrategy.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/TraverseStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/TraverseStrategy.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/TraverseStrategy.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/strategy/TraverseStrategy.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/ConditionP.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/ConditionP.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/ConditionP.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/ConditionP.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStep.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStep.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStep.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStep.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStepStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStepStrategy.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStepStrategy.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeCountStepStrategy.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStep.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStep.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStep.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStep.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStepStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStepStrategy.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStepStrategy.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeGraphStepStrategy.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugePrimaryKeyStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugePrimaryKeyStrategy.java similarity index 92% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugePrimaryKeyStrategy.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugePrimaryKeyStrategy.java index e00e4caf80..d9f6654a52 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugePrimaryKeyStrategy.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugePrimaryKeyStrategy.java @@ -17,21 +17,21 @@ package org.apache.hugegraph.traversal.optimize; +import java.util.LinkedList; +import java.util.List; + import org.apache.tinkerpop.gremlin.process.traversal.Step; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy; import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy.ProviderOptimizationStrategy; import org.apache.tinkerpop.gremlin.process.traversal.step.Mutating; import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStartStep; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStep; import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AddPropertyStep; import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy; import org.apache.tinkerpop.gremlin.structure.T; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStep; import org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality; -import java.util.LinkedList; -import java.util.List; - public class HugePrimaryKeyStrategy extends AbstractTraversalStrategy implements ProviderOptimizationStrategy { @@ -53,17 +53,19 @@ public void apply(Traversal.Admin traversal) { for (int i = 0, s = stepList.size(); i < s; i++) { Step step = stepList.get(i); - if (i == 0 && AddVertexStartStep.class.isInstance(step)) { + if (i == 0 && step instanceof AddVertexStartStep) { curAddStep = (Mutating) step; continue; - } else if (curAddStep == null && AddVertexStep.class.isInstance((step))) { + } else if (curAddStep == null && (step) instanceof AddVertexStep) { curAddStep = (Mutating) step; continue; } - if (curAddStep == null) continue; + if (curAddStep == null) { + continue; + } - if (!AddPropertyStep.class.isInstance(step)) { + if (!(step instanceof AddPropertyStep)) { curAddStep = null; continue; } @@ -89,8 +91,8 @@ public void apply(Traversal.Admin traversal) { curAddStep.configure(kvs); - if (kvList.size() > 0) { - curAddStep.configure(kvList.toArray(new Object[kvList.size()])); + if (!kvList.isEmpty()) { + curAddStep.configure(kvList.toArray(new Object[0])); } removeSteps.add(step); diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStep.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStep.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStep.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStep.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepByBatch.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepByBatch.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepByBatch.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepByBatch.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepStrategy.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepStrategy.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepStrategy.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/QueryHolder.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/QueryHolder.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/QueryHolder.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/QueryHolder.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/Text.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/Text.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/Text.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/Text.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/HugeType.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/HugeType.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/HugeType.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/HugeType.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/Idfiable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Idfiable.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/Idfiable.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Idfiable.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/Indexable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Indexable.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/Indexable.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Indexable.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/Nameable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Nameable.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/Nameable.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Nameable.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/Propertiable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Propertiable.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/Propertiable.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Propertiable.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/Typeable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Typeable.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/Typeable.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Typeable.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Action.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Action.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Action.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Action.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/AggregateType.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/AggregateType.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/AggregateType.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/AggregateType.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Cardinality.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Cardinality.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Cardinality.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Cardinality.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/CollectionType.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/CollectionType.java similarity index 99% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/CollectionType.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/CollectionType.java index 3de1c850a6..3b011a0ba1 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/CollectionType.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/CollectionType.java @@ -41,6 +41,7 @@ public enum CollectionType implements SerialEnum { this.name = name; } + @Override public byte code() { return this.code; } diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/DataType.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/DataType.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/DataType.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/DataType.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Directions.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Directions.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Directions.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Directions.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Frequency.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Frequency.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Frequency.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Frequency.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/GraphMode.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/GraphMode.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/GraphMode.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/GraphMode.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/GraphReadMode.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/GraphReadMode.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/GraphReadMode.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/GraphReadMode.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/HugeKeys.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/HugeKeys.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/HugeKeys.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/HugeKeys.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/IdStrategy.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/IdStrategy.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/IdStrategy.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/IdStrategy.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/IndexType.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/IndexType.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/IndexType.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/IndexType.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/NodeRole.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/NodeRole.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/NodeRole.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/NodeRole.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/SchemaStatus.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/SchemaStatus.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/SchemaStatus.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/SchemaStatus.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/SerialEnum.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/SerialEnum.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/SerialEnum.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/SerialEnum.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/WriteType.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/WriteType.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/type/define/WriteType.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/WriteType.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/Blob.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Blob.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/Blob.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Blob.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/CompressUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/CompressUtil.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/CompressUtil.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/CompressUtil.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/ConfigUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/ConfigUtil.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/ConfigUtil.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/ConfigUtil.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/Consumers.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Consumers.java similarity index 73% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/Consumers.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Consumers.java index 00689e0c5e..06e678fd98 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/util/Consumers.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Consumers.java @@ -27,16 +27,16 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; -import org.apache.hugegraph.config.CoreOptions; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.config.CoreOptions; import org.apache.hugegraph.task.TaskManager.ContextCallable; +import org.slf4j.Logger; public final class Consumers { @@ -46,16 +46,16 @@ public final class Consumers { private static final Logger LOG = Log.logger(Consumers.class); + private final V QUEUE_END = (V) new Object(); private final ExecutorService executor; private final Consumer consumer; - private final Runnable done; - + private final Runnable doneHandle; + private final Consumer exceptionHandle; private final int workers; + private final List runningFutures; private final int queueSize; private final CountDownLatch latch; private final BlockingQueue queue; - - private volatile boolean ending = false; private volatile Throwable exception = null; public Consumers(ExecutorService executor, Consumer consumer) { @@ -63,23 +63,40 @@ public Consumers(ExecutorService executor, Consumer consumer) { } public Consumers(ExecutorService executor, - Consumer consumer, Runnable done) { + Consumer consumer, Runnable doneHandle) { + this(executor, consumer, doneHandle, QUEUE_WORKER_SIZE); + } + + public Consumers(ExecutorService executor, + Consumer consumer, + Runnable doneHandle, + int queueSizePerWorker) { + this(executor, consumer, doneHandle, null, queueSizePerWorker); + } + + public Consumers(ExecutorService executor, + Consumer consumer, + Runnable doneHandle, + Consumer exceptionHandle, + int queueSizePerWorker) { this.executor = executor; this.consumer = consumer; - this.done = done; + this.doneHandle = doneHandle; + this.exceptionHandle = exceptionHandle; int workers = THREADS; if (this.executor instanceof ThreadPoolExecutor) { workers = ((ThreadPoolExecutor) this.executor).getCorePoolSize(); } this.workers = workers; - this.queueSize = QUEUE_WORKER_SIZE * workers; + + this.runningFutures = new ArrayList<>(workers); + this.queueSize = queueSizePerWorker * workers + 1; this.latch = new CountDownLatch(workers); this.queue = new ArrayBlockingQueue<>(this.queueSize); } public void start(String name) { - this.ending = false; this.exception = null; if (this.executor == null) { return; @@ -87,7 +104,8 @@ public void start(String name) { LOG.info("Starting {} workers[{}] with queue size {}...", this.workers, name, this.queueSize); for (int i = 0; i < this.workers; i++) { - this.executor.submit(new ContextCallable<>(this::runAndDone)); + this.runningFutures.add( + this.executor.submit(new ContextCallable<>(this::runAndDone))); } } @@ -95,11 +113,15 @@ private Void runAndDone() { try { this.run(); } catch (Throwable e) { - // Only the first exception of one thread can be stored - this.exception = e; - if (!(e instanceof StopExecution)) { + if (e instanceof StopExecution) { + this.queue.clear(); + putQueueEnd(); + } else { + // Only the first exception to one thread can be stored + this.exception = e; LOG.error("Error when running task", e); } + exceptionHandle(e); } finally { this.done(); this.latch.countDown(); @@ -109,11 +131,7 @@ private Void runAndDone() { private void run() { LOG.debug("Start to work..."); - while (!this.ending) { - this.consume(); - } - assert this.ending; - while (this.consume()){ + while (this.consume()) { // ignore } @@ -121,14 +139,18 @@ private void run() { } private boolean consume() { - V elem; - try { - elem = this.queue.poll(CONSUMER_WAKE_PERIOD, TimeUnit.MILLISECONDS); - } catch (InterruptedException e) { - // ignore - return true; + V elem = null; + while (elem == null) { + try { + elem = this.queue.poll(CONSUMER_WAKE_PERIOD, TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + // ignore + return false; + } } - if (elem == null) { + + if (elem == QUEUE_END) { + putQueueEnd(); return false; } // do job @@ -136,13 +158,29 @@ private boolean consume() { return true; } + private void exceptionHandle(Throwable e) { + if (this.exceptionHandle == null) { + return; + } + + try { + this.exceptionHandle.accept(e); + } catch (Throwable ex) { + if (this.exception == null) { + this.exception = ex; + } else { + LOG.warn("Error while calling exceptionHandle()", ex); + } + } + } + private void done() { - if (this.done == null) { + if (this.doneHandle == null) { return; } try { - this.done.run(); + this.doneHandle.run(); } catch (Throwable e) { if (this.exception == null) { this.exception = e; @@ -169,6 +207,16 @@ public void provide(V v) throws Throwable { } else { try { this.queue.put(v); + } catch (InterruptedException e) { + LOG.warn("Interrupt while queuing QUEUE_END", e); + } + } + } + + private void putQueueEnd() { + if (this.executor != null) { + try { + this.queue.put(QUEUE_END); } catch (InterruptedException e) { LOG.warn("Interrupted while enqueue", e); } @@ -176,15 +224,18 @@ public void provide(V v) throws Throwable { } public void await() throws Throwable { - this.ending = true; if (this.executor == null) { // call done() directly if without thread pool this.done(); } else { try { + putQueueEnd(); this.latch.await(); } catch (InterruptedException e) { String error = "Interrupted while waiting for consumers"; + for (Future f : this.runningFutures) { + f.cancel(true); + } this.exception = new HugeException(error, e); LOG.warn(error, e); } @@ -201,7 +252,8 @@ public ExecutorService executor() { public static void executeOncePerThread(ExecutorService executor, int totalThreads, - Runnable callback) + Runnable callback, + long invokeTimeout) throws InterruptedException { // Ensure callback execute at least once for every thread final Map threadsTimes = new ConcurrentHashMap<>(); @@ -230,7 +282,7 @@ public static void executeOncePerThread(ExecutorService executor, for (int i = 0; i < totalThreads; i++) { tasks.add(task); } - executor.invokeAll(tasks); + executor.invokeAll(tasks, invokeTimeout, TimeUnit.SECONDS); } public static ExecutorService newThreadPool(String prefix, int workers) { @@ -290,13 +342,21 @@ public synchronized ExecutorService getExecutor() { public synchronized void returnExecutor(ExecutorService executor) { E.checkNotNull(executor, "executor"); if (!this.executors.offer(executor)) { - executor.shutdown(); + try { + executor.shutdown(); + } catch (Exception e) { + LOG.warn("close ExecutorService with error:", e); + } } } public synchronized void destroy() { for (ExecutorService executor : this.executors) { - executor.shutdown(); + try { + executor.shutdownNow(); + } catch (Exception e) { + LOG.warn("close ExecutorService with error:", e); + } } this.executors.clear(); } diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/CopyUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/CopyUtil.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/CopyUtil.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/CopyUtil.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/Events.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Events.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/Events.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Events.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedTimerWindowRateLimiter.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedTimerWindowRateLimiter.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedTimerWindowRateLimiter.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedTimerWindowRateLimiter.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedWatchWindowRateLimiter.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedWatchWindowRateLimiter.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedWatchWindowRateLimiter.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/FixedWatchWindowRateLimiter.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/GZipUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/GZipUtil.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/GZipUtil.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/GZipUtil.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/JsonUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/JsonUtil.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/JsonUtil.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/JsonUtil.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/KryoUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/KryoUtil.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/KryoUtil.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/KryoUtil.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/LZ4Util.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/LZ4Util.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/LZ4Util.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/LZ4Util.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/LockUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/LockUtil.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/LockUtil.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/LockUtil.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/ParameterUtil.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/ParameterUtil.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/ParameterUtil.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/ParameterUtil.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/RateLimiter.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/RateLimiter.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/RateLimiter.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/RateLimiter.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/Reflection.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Reflection.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/Reflection.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Reflection.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/CollectionFactory.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/CollectionFactory.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/CollectionFactory.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/CollectionFactory.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IdSet.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IdSet.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IdSet.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IdSet.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/Int2IntsMap.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/Int2IntsMap.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/Int2IntsMap.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/Int2IntsMap.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntIterator.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntIterator.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntIterator.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntIterator.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntMap.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntMap.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntMap.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntMap.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntSet.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntSet.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntSet.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/IntSet.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/ObjectIntMapping.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/ObjectIntMapping.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/ObjectIntMapping.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/ObjectIntMapping.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/ObjectIntMappingFactory.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/ObjectIntMappingFactory.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/ObjectIntMappingFactory.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/collection/ObjectIntMappingFactory.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/variables/HugeVariables.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/variables/HugeVariables.java similarity index 100% rename from hugegraph-core/src/main/java/org/apache/hugegraph/variables/HugeVariables.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/variables/HugeVariables.java diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java similarity index 74% rename from hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java rename to hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java index b47f944d8b..f3c277b67c 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java @@ -22,22 +22,24 @@ public class CoreVersion { + public static final String NAME = "hugegraph-core"; + public static final String DEFAULT_VERSION = "1.2.0"; + /** + * The second parameter of Version.of() is for IDE running without JAR + */ + public static final Version VERSION = Version.of(CoreVersion.class, DEFAULT_VERSION); + /** + * Update it when the gremlin version changed, search "tinkerpop.version" in pom + */ + public static final String GREMLIN_VERSION = "3.5.1"; + static { // Check versions of the dependency packages CoreVersion.check(); } - public static final String NAME = "hugegraph-core"; - - public static final String DEFAULT_VERSION = "1.0.0"; - - // The second parameter of Version.of() is for IDE running without JAR - public static final Version VERSION = Version.of(CoreVersion.class, DEFAULT_VERSION); - - public static final String GREMLIN_VERSION = "3.4.3"; - public static void check() { - // Check version of hugegraph-common - VersionUtil.check(CommonVersion.VERSION, "1.0", "1.1", CommonVersion.NAME); + // Check the version of hugegraph-common + VersionUtil.check(CommonVersion.VERSION, "1.0", "1.35", CommonVersion.NAME); } } diff --git a/hugegraph-core/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin b/hugegraph-server/hugegraph-core/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin similarity index 100% rename from hugegraph-core/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin rename to hugegraph-server/hugegraph-core/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin diff --git a/hugegraph-core/src/main/resources/hugegraph.properties b/hugegraph-server/hugegraph-core/src/main/resources/hugegraph.properties similarity index 100% rename from hugegraph-core/src/main/resources/hugegraph.properties rename to hugegraph-server/hugegraph-core/src/main/resources/hugegraph.properties diff --git a/hugegraph-core/src/main/resources/proto/raft.proto b/hugegraph-server/hugegraph-core/src/main/resources/proto/raft.proto similarity index 100% rename from hugegraph-core/src/main/resources/proto/raft.proto rename to hugegraph-server/hugegraph-core/src/main/resources/proto/raft.proto diff --git a/hugegraph-dist/README.md b/hugegraph-server/hugegraph-dist/README.md similarity index 72% rename from hugegraph-dist/README.md rename to hugegraph-server/hugegraph-dist/README.md index b8e6499285..1aedb37bbe 100644 --- a/hugegraph-dist/README.md +++ b/hugegraph-server/hugegraph-dist/README.md @@ -10,7 +10,7 @@ We can use docker to quickly start an inner HugeGraph server with RocksDB in bac 2. Using docker compose - We can also use `docker-compose up -d`. The `docker-compose.yaml` is below: + Certainly we can only deploy server without other instance. Additionally, if we want to manage other HugeGraph-related instances with `server` in a single file, we can deploy HugeGraph-related instances via `docker-compose up -d`. The `docker-compose.yaml` is as below: ```yaml version: '3' @@ -27,8 +27,6 @@ If you want to **pre-load** some (test) data or graphs in container(by default), If you want to customize the pre-loaded data, please mount the the groovy scripts (not necessary). - - 1. Using docker run Use `docker run -itd --name=graph -p 18080:8080 -e PRELOAD=true -v /path/to/yourScript:/hugegraph/scripts/example.groovy hugegraph/hugegraph` @@ -36,7 +34,7 @@ If you want to customize the pre-loaded data, please mount the the groovy script 2. Using docker compose - We can also use `docker-compose up -d` to quickly start. The `docker-compose.yaml` is below: + We can also use `docker-compose up -d` to quickly start. The `docker-compose.yaml` is below. [example.groovy](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/src/assembly/static/scripts/example.groovy) is a pre-defined script. If needed, we can mount a new `example.groovy` to preload different data: ```yaml version: '3' diff --git a/hugegraph-dist/dist.sh b/hugegraph-server/hugegraph-dist/dist.sh similarity index 100% rename from hugegraph-dist/dist.sh rename to hugegraph-server/hugegraph-dist/dist.sh diff --git a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh b/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh new file mode 100644 index 0000000000..e1fad4a9ff --- /dev/null +++ b/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with this +# work for additional information regarding copyright ownership. The ASF +# licenses this file to You under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# + + +./bin/wait-storage.sh + +./bin/init-store.sh + +./bin/start-hugegraph.sh -d false -j "$JAVA_OPTS" -g zgc diff --git a/hugegraph-server/hugegraph-dist/docker/example/docker-compose-cassandra.yml b/hugegraph-server/hugegraph-dist/docker/example/docker-compose-cassandra.yml new file mode 100644 index 0000000000..3682b02f92 --- /dev/null +++ b/hugegraph-server/hugegraph-dist/docker/example/docker-compose-cassandra.yml @@ -0,0 +1,61 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +version: "3" + +services: + graph: + image: hugegraph/hugegraph + container_name: cas-graph + ports: + - 18080:8080 + environment: + hugegraph.backend: cassandra + hugegraph.serializer: cassandra + hugegraph.cassandra.host: cas-cassandra + hugegraph.cassandra.port: 9042 + networks: + - ca-network + depends_on: + - cassandra + healthcheck: + test: ["CMD", "bin/gremlin-console.sh", "--" ,"-e", "scripts/remote-connect.groovy"] + interval: 10s + timeout: 30s + retries: 3 + + cassandra: + image: cassandra:4 + container_name: cas-cassandra + ports: + - 7000:7000 + - 9042:9042 + security_opt: + - seccomp:unconfined + networks: + - ca-network + healthcheck: + test: ["CMD", "cqlsh", "--execute", "describe keyspaces;"] + interval: 10s + timeout: 30s + retries: 5 + +networks: + ca-network: + +volumes: + hugegraph-data: diff --git a/hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy b/hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy new file mode 100644 index 0000000000..df57ade988 --- /dev/null +++ b/hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +import org.apache.hugegraph.HugeFactory +import org.apache.hugegraph.dist.RegisterUtil + +// register all the backend to avoid changes if docker needs to support othre backend +RegisterUtil.registerPlugins() +RegisterUtil.registerRocksDB() +RegisterUtil.registerCassandra() +RegisterUtil.registerScyllaDB() +RegisterUtil.registerHBase() +RegisterUtil.registerMysql() +RegisterUtil.registerPalo() +RegisterUtil.registerPostgresql() + +graph = HugeFactory.open('./conf/graphs/hugegraph.properties') diff --git a/hugegraph-server/hugegraph-dist/docker/scripts/remote-connect.groovy b/hugegraph-server/hugegraph-dist/docker/scripts/remote-connect.groovy new file mode 100644 index 0000000000..e352cdc7e9 --- /dev/null +++ b/hugegraph-server/hugegraph-dist/docker/scripts/remote-connect.groovy @@ -0,0 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +:remote connect tinkerpop.server conf/remote.yaml +:> hugegraph diff --git a/hugegraph-dist/pom.xml b/hugegraph-server/hugegraph-dist/pom.xml similarity index 91% rename from hugegraph-dist/pom.xml rename to hugegraph-server/hugegraph-dist/pom.xml index 48ad2017b7..cdec80950b 100644 --- a/hugegraph-dist/pom.xml +++ b/hugegraph-server/hugegraph-dist/pom.xml @@ -19,7 +19,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - hugegraph + hugegraph-server org.apache.hugegraph ${revision} ../pom.xml @@ -293,6 +293,22 @@ + + + + + + + + + + + diff --git a/hugegraph-dist/release-docs/LICENSE b/hugegraph-server/hugegraph-dist/release-docs/LICENSE similarity index 99% rename from hugegraph-dist/release-docs/LICENSE rename to hugegraph-server/hugegraph-dist/release-docs/LICENSE index f1cc9686c8..b6306df6b5 100644 --- a/hugegraph-dist/release-docs/LICENSE +++ b/hugegraph-server/hugegraph-dist/release-docs/LICENSE @@ -220,6 +220,7 @@ The text of each license is the standard Apache 2.0 license. hugegraph-core/src/main/java/org/apache/hugegraph/type/Nameable.java from https://github.com/JanusGraph/janusgraph hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Cardinality.java from https://github.com/JanusGraph/janusgraph hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java from https://github.com/JanusGraph/janusgraph +hugegraph-dist/src/assembly/static/bin/wait-storage.sh from https://github.com/JanusGraph/janusgraph hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java from https://github.com/apache/tinkerpop hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessBasicSuite.java from https://github.com/apache/tinkerpop hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureBasicSuite.java from https://github.com/apache/tinkerpop @@ -251,7 +252,7 @@ See licenses/ for text of these licenses. (Apache License, Version 2.0) * jersey-media-json-jackson (org.glassfish.jersey.media:jersey-media-json-jackson:3.0.3 - https://projects.eclipse.org/projects/ee4j.jersey/project/jersey-media-json-jackson) (Apache License, Version 2.0) * ASM based accessors helper used by json-smart (net.minidev:accessors-smart:1.2 - http://www.minidev.net/) (Apache License, Version 2.0) * Annotations for Metrics (io.dropwizard.metrics:metrics-annotation:4.2.4 - https://metrics.dropwizard.io/metrics-annotation) - (Apache License, Version 2.0) * Apache Cassandra (org.apache.cassandra:cassandra-all:3.11.12 - https://cassandra.apache.org) + (Apache License, Version 2.0) * Apache Cassandra (org.apache.cassandra:cassandra-all:4.0.10 - https://cassandra.apache.org) (Apache License, Version 2.0) * Apache Commons BeanUtils (commons-beanutils:commons-beanutils:1.9.4 - https://commons.apache.org/proper/commons-beanutils/) (Apache License, Version 2.0) * Apache Commons Codec (commons-codec:commons-codec:1.11 - http://commons.apache.org/proper/commons-codec/) (Apache License, Version 2.0) * Apache Commons Codec (commons-codec:commons-codec:1.15 - https://commons.apache.org/proper/commons-codec/) diff --git a/hugegraph-dist/release-docs/NOTICE b/hugegraph-server/hugegraph-dist/release-docs/NOTICE similarity index 98% rename from hugegraph-dist/release-docs/NOTICE rename to hugegraph-server/hugegraph-dist/release-docs/NOTICE index 101ea81f45..39922da249 100644 --- a/hugegraph-dist/release-docs/NOTICE +++ b/hugegraph-server/hugegraph-dist/release-docs/NOTICE @@ -2058,3 +2058,41 @@ HPPC borrowed code, ideas or both from: (Apache license) * Koloboke, https://github.com/OpenHFT/Koloboke (Apache license) + + + +======================================================================== + +Arthas NOTICE + +======================================================================== + + +Arthas +Copyright 2018 Alibaba Group + +This product includes software developed at +Alibaba Group (https://www.alibabagroup.com/en/global/home). + +This product contains code form the greys-anatomy Project: + +The greys-anatomy Project +================= +Please visit Github for more information: +* https://github.com/oldmanpushcart/greys-anatomy + + +------------------------------------------------------------------------------- +This product contains a modified portion of 'Apache Commons Lang': +* LICENSE: + * Apache License 2.0 +* HOMEPAGE: + * https://commons.apache.org/proper/commons-lang/ + + +This product contains a modified portion of 'Apache Commons Net': +* LICENSE: + * Apache License 2.0 +* HOMEPAGE: + * https://commons.apache.org/proper/commons-net/ + diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-HdrHistogram.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-HdrHistogram.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-HdrHistogram.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-HdrHistogram.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-ST4.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-ST4.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-ST4.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-ST4.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-audience-annotations.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-arthas-agent-attach.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-audience-annotations.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-arthas-agent-attach.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-io.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-arthas-packaging.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-io.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-arthas-packaging.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-audience-annotations.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-audience-annotations.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy-agent.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy-agent-1.11.6.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy-agent.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy-agent-1.11.6.txt diff --git a/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy-agent.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy-agent.txt new file mode 100644 index 0000000000..d0381d6d04 --- /dev/null +++ b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy-agent.txt @@ -0,0 +1,176 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-cassandra-all.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-cassandra-all.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-cassandra-all.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-cassandra-all.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-beanutils.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-beanutils.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-beanutils.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-beanutils.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-cli.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-cli.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-cli.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-cli.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-codec.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-codec.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-codec.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-codec.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-collections.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-collections.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-collections.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-collections.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-compress.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-compress.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-compress.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-compress.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration2.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration2.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration2.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-configuration2.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-error-prone.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-io.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-error-prone.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-io.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-lang.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang3.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang3.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-lang3.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-lang3.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-logging.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-logging.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-logging.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-logging.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-commons-math3.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-math3.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-commons-math3.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-math3.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-console.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-gremlin-console.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-commons-text.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-compress-lzf.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-compress-lzf.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-compress-lzf.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-compress-lzf.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-concurrent-trees.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-concurrent-trees.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-concurrent-trees.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-concurrent-trees.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-concurrentlinkedhashmap-lru.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-concurrentlinkedhashmap-lru.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-concurrentlinkedhashmap-lru.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-concurrentlinkedhashmap-lru.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-disruptor.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-disruptor.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-disruptor.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-disruptor.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-core.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-error-prone.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-gremlin-core.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-error-prone.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-exp4j.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-exp4j.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-exp4j.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-exp4j.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-expressions-9.0.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-expressions-9.0.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-expressions-9.0.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-expressions-9.0.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-fastutil.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-fastutil.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-fastutil.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-fastutil.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-findbugs-annotations.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-findbugs-annotations.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-findbugs-annotations.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-findbugs-annotations.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-front-end.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-front-end.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-front-end.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-front-end.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-driver.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-console.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-gremlin-driver.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-console.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-groovy.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-core.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-gremlin-groovy.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-core.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-server.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-driver.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-gremlin-server.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-driver.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-shaded.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-groovy.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-gremlin-shaded.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-groovy.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-test.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-server.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-gremlin-test.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-server.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-groovy-cli-picocli.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-shaded.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-groovy-cli-picocli.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-shaded.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-groovy-console.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-test.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-groovy-console.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-gremlin-test.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-groovy-2.5.14.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-2.5.14.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-groovy-2.5.14.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-2.5.14.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-groovy-swing.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-cli-picocli.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-groovy-swing.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-cli-picocli.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-groovy-templates.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-console.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-groovy-templates.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-console.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-groovy-groovysh.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-groovysh.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-groovy-groovysh.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-groovysh.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-groovy-json.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-json.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-groovy-json.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-json.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-groovy-jsr223.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-jsr223.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-groovy-jsr223.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-jsr223.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-groovy-xml.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-swing.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-groovy-xml.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-swing.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-htrace-core4-4.2.0.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-templates.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-htrace-core4-4.2.0.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-templates.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-httpclient.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-xml.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-httpclient.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-groovy-xml.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-hamcrest.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-hamcrest.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-hamcrest.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-hamcrest.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-hbase-shaded-endpoint.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-hbase-shaded-endpoint.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-hbase-shaded-endpoint.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-hbase-shaded-endpoint.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-hppc.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-hppc.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-hppc.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-hppc.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-httpcore.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-htrace-core4-4.2.0.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-httpcore.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-htrace-core4-4.2.0.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-ikanalyzer-2012_u6.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-httpclient.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-ikanalyzer-2012_u6.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-httpclient.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-httpcore.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-httpcore.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-ikanalyzer-2012_u6.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-core.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-ikanalyzer-2012_u6.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-ivy.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-ivy.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-ivy.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-ivy.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-annotations.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-kerb-admin.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-kerb-admin.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-core.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-kerb-client.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-kerb-client.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-databind.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-dataformat-yaml.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-dataformat-yaml.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-dataformat-yaml.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-dataformat-yaml.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-datatype-jsr310.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-datatype-jsr310.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-datatype-jsr310.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-datatype-jsr310.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-base.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider-2.12.1.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider-2.12.1.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider-2.12.1.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider-2.12.1.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-jaxrs-json-provider.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jackson-module-jaxb-annotations.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-javax.json.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-javax.json.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-javax.json.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-javax.json.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jcabi-log.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jcabi-log.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jcabi-log.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jcabi-log.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jcabi-manifests.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jcabi-manifests.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jcabi-manifests.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jcabi-manifests.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jcl-over-slf4j.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jcl-over-slf4j.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jcl-over-slf4j.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jcl-over-slf4j.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jersey-client.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jersey-client.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jersey-client.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jersey-client.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jflex.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jflex.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jflex.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jflex.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jieba-analysis.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jieba-analysis.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jieba-analysis.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jieba-analysis.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-jna.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jna.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-jna.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-jna.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-json-simple.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-json-simple.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-json-simple.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-json-simple.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-json-smart.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-json-smart.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-json-smart.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-json-smart.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-kerb-common.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-admin.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-kerb-common.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-admin.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-kerb-core.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-client.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-kerb-core.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-client.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-kerb-crypto.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-common.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-kerb-crypto.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-common.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-kerb-identity.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-core.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-kerb-identity.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-core.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-kerb-server.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-crypto.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-kerb-server.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-crypto.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-kerb-simplekdc.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-identity.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-kerb-simplekdc.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-identity.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-kerb-util.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-server.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-kerb-util.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-server.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-kerby-asn1.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-simplekdc.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-kerby-asn1.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-simplekdc.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-kerby-config.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-util.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-kerby-config.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerb-util.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-kerby-pkix.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerby-asn1.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-kerby-pkix.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerby-asn1.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-kerby-util.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerby-config.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-kerby-util.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerby-config.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-kerby-xdr.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerby-pkix.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-kerby-xdr.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerby-pkix.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-log4j-api.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerby-util.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-log4j-api.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerby-util.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-log4j-slf4j-impl.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerby-xdr.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-log4j-slf4j-impl.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-kerby-xdr.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-objenesis.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-log4j-api.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-objenesis.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-log4j-api.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-log4j-core.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-log4j-core.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-log4j-core.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-log4j-core.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-tinkergraph-gremlin.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-log4j-slf4j-impl.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-tinkergraph-gremlin.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-log4j-slf4j-impl.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-token-provider.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-objenesis.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-token-provider.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-objenesis.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-ohc-core.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-ohc-core.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-ohc-core.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-ohc-core.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-opencypher-ast-9.0.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-opencypher-ast-9.0.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-opencypher-ast-9.0.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-opencypher-ast-9.0.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-parboiled-core.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-parboiled-core.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-parboiled-core.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-parboiled-core.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-parboiled-scala_2.12.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-parboiled-scala_2.12.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-parboiled-scala_2.12.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-parboiled-scala_2.12.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-parser-9.0.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-parser-9.0.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-parser-9.0.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-parser-9.0.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-postgresql.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-postgresql.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-postgresql.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-postgresql.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-rewriting-9.0.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-rewriting-9.0.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-rewriting-9.0.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-rewriting-9.0.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-rocksdbjni.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-rocksdbjni.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-rocksdbjni.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-rocksdbjni.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-sigar.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-sigar.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-sigar.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-sigar.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-snakeyaml.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-snakeyaml.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-snakeyaml.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-snakeyaml.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-snowball-stemmer.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-snowball-stemmer.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-snowball-stemmer.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-snowball-stemmer.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-swagger-annotations.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-swagger-annotations.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-swagger-annotations.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-swagger-annotations.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-swagger-models.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-swagger-models.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-swagger-models.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-swagger-models.txt diff --git a/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-tinkergraph-gremlin.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-tinkergraph-gremlin.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-tinkergraph-gremlin.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-token-provider.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-token-provider.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-token-provider.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-tracer-core.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-tracer-core.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-tracer-core.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-tracer-core.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-util-9.0.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-util-9.0.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LICENSE-util-9.0.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-util-9.0.txt diff --git a/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-zt-zip.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-zt-zip.txt new file mode 100644 index 0000000000..a250c1a8c1 --- /dev/null +++ b/hugegraph-server/hugegraph-dist/release-docs/licenses/LICENSE-zt-zip.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2012 ZeroTurnaround LLC. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/hugegraph-dist/release-docs/licenses/LINCENSE-jopt-simple.txt b/hugegraph-server/hugegraph-dist/release-docs/licenses/LINCENSE-jopt-simple.txt similarity index 100% rename from hugegraph-dist/release-docs/licenses/LINCENSE-jopt-simple.txt rename to hugegraph-server/hugegraph-dist/release-docs/licenses/LINCENSE-jopt-simple.txt diff --git a/hugegraph-dist/scripts/apache-release.sh b/hugegraph-server/hugegraph-dist/scripts/apache-release.sh similarity index 96% rename from hugegraph-dist/scripts/apache-release.sh rename to hugegraph-server/hugegraph-dist/scripts/apache-release.sh index 463373ccd0..a92a59b370 100755 --- a/hugegraph-dist/scripts/apache-release.sh +++ b/hugegraph-server/hugegraph-dist/scripts/apache-release.sh @@ -41,7 +41,7 @@ rm -rf dist && mkdir -p dist/apache-${REPO} # step1: package the source code cd ../../ git archive --format=tar.gz \ - --output="hugegraph-dist/scripts/dist/apache-${REPO}/apache-${REPO}-incubating-${RELEASE_VERSION}-src.tar.gz" \ + --output="hugegraph-server/hugegraph-dist/scripts/dist/apache-${REPO}/apache-${REPO}-incubating-${RELEASE_VERSION}-src.tar.gz" \ --prefix=apache-${REPO}-incubating-"${RELEASE_VERSION}"-src/ "${GIT_BRANCH}" || exit cd - || exit diff --git a/hugegraph-dist/scripts/dependency/check_dependencies.sh b/hugegraph-server/hugegraph-dist/scripts/dependency/check_dependencies.sh similarity index 75% rename from hugegraph-dist/scripts/dependency/check_dependencies.sh rename to hugegraph-server/hugegraph-dist/scripts/dependency/check_dependencies.sh index 309063faa5..024c05e35e 100644 --- a/hugegraph-dist/scripts/dependency/check_dependencies.sh +++ b/hugegraph-server/hugegraph-dist/scripts/dependency/check_dependencies.sh @@ -16,17 +16,20 @@ # under the License. # -BASE_PATH=$(cd $(dirname $0); pwd) +BASE_PATH=$( + cd "$(dirname "$0")" || exit 1 + pwd +) # check whether there are new third-party dependencies by diff command, # diff generated 'current-dependencies.txt' file with 'known-dependencies.txt' file. -diff -w -B -U0 <(sort < ${BASE_PATH}/known-dependencies.txt) \ -<(sort < ${BASE_PATH}/current-dependencies.txt) > ${BASE_PATH}/result.txt +diff -w -B -U0 <(sort <"${BASE_PATH}"/known-dependencies.txt) \ + <(sort <"${BASE_PATH}"/current-dependencies.txt) >${BASE_PATH}/result.txt # if has new third-party,the Action will fail and print diff -if [ -s ${BASE_PATH}/result.txt ]; then - cat ${BASE_PATH}/result.txt - exit 1 +if [ -s "${BASE_PATH}"/result.txt ]; then + cat "${BASE_PATH}"/result.txt + exit 1 else - echo 'All third dependencies is known!' + echo 'All third dependencies is known!' fi diff --git a/hugegraph-dist/scripts/dependency/known-dependencies.txt b/hugegraph-server/hugegraph-dist/scripts/dependency/known-dependencies.txt similarity index 74% rename from hugegraph-dist/scripts/dependency/known-dependencies.txt rename to hugegraph-server/hugegraph-dist/scripts/dependency/known-dependencies.txt index 5e50bdb4a0..92e406a122 100644 --- a/hugegraph-dist/scripts/dependency/known-dependencies.txt +++ b/hugegraph-server/hugegraph-dist/scripts/dependency/known-dependencies.txt @@ -1,14 +1,15 @@ -HdrHistogram-2.1.9.jar -ST4-4.0.8.jar accessors-smart-1.2.jar -airline-0.6.jar -animal-sniffer-annotations-1.14.jar +airline-0.8.jar +animal-sniffer-annotations-1.19.jar annotations-4.1.1.4.jar +annotations-13.0.jar ansj_seg-5.1.6.jar antlr-runtime-3.5.2.jar aopalliance-repackaged-3.0.1.jar -asm-5.0.4.jar +arthas-agent-attach-3.7.1.jar +arthas-packaging-3.7.1.jar asm-6.0.jar +asm-7.1.jar asm-analysis-5.0.3.jar asm-commons-5.0.3.jar asm-tree-5.0.3.jar @@ -18,13 +19,20 @@ audience-annotations-0.5.0.jar bolt-1.6.4.jar byte-buddy-1.10.5.jar byte-buddy-agent-1.10.5.jar -caffeine-2.2.6.jar +byte-buddy-agent-1.11.6.jar caffeine-2.3.1.jar -cassandra-all-3.11.12.jar +caffeine-2.5.6.jar +cassandra-all-4.0.10.jar cassandra-driver-core-3.6.0.jar -checker-qual-2.0.0.jar +checker-compat-qual-2.5.5.jar +checker-qual-3.12.0.jar checker-qual-3.5.0.jar -classgraph-4.8.95.jar +chronicle-bytes-2.20.111.jar +chronicle-core-2.20.126.jar +chronicle-queue-5.20.123.jar +chronicle-threads-2.20.111.jar +chronicle-wire-2.20.117.jar +classgraph-4.8.162.jar commons-beanutils-1.9.4.jar commons-cli-1.1.jar commons-codec-1.11.jar @@ -37,23 +45,22 @@ commons-configuration-1.10.jar commons-configuration2-2.8.0.jar commons-io-2.7.jar commons-lang-2.6.jar -commons-lang3-3.1.jar commons-lang3-3.11.jar +commons-lang3-3.12.0.jar commons-logging-1.1.1.jar commons-logging-1.2.jar commons-math3-3.2.jar commons-text-1.10.0.jar -compress-lzf-0.8.4.jar concurrent-trees-2.4.0.jar -concurrentlinkedhashmap-lru-1.4.jar cypher-gremlin-extensions-1.0.4.jar disruptor-3.3.7.jar eclipse-collections-11.1.0.jar eclipse-collections-api-11.1.0.jar -error_prone_annotations-2.1.3.jar error_prone_annotations-2.10.0.jar +error_prone_annotations-2.3.4.jar exp4j-0.4.8.jar expressions-9.0-9.0.20190305.jar +failureaccess-1.0.1.jar fastparse_2.12-2.0.4.jar fastutil-8.5.9.jar findbugs-annotations-1.3.9-1.jar @@ -83,37 +90,46 @@ grpc-api-1.47.0.jar grpc-context-1.47.0.jar grpc-core-1.47.0.jar grpc-netty-shaded-1.47.0.jar +grpc-protobuf-1.28.0.jar +grpc-protobuf-lite-1.28.0.jar gson-2.9.0.jar -guava-25.1-jre.jar +guava-27.0-jre.jar +guava-30.0-jre.jar +guava-31.0.1-android.jar hamcrest-2.2.jar hamcrest-core-1.3.jar hanlp-portable-1.8.3.jar hbase-shaded-endpoint-2.0.6.jar +HdrHistogram-2.1.9.jar hessian-3.3.6.jar high-scale-lib-1.0.6.jar hk2-api-3.0.1.jar hk2-locator-3.0.1.jar hk2-utils-3.0.1.jar hppc-0.7.1.jar +hppc-0.8.1.jar htrace-core4-4.2.0-incubating.jar httpclient-4.5.13.jar httpcore-4.4.13.jar ikanalyzer-2012_u6.jar ivy-2.4.0.jar -j2objc-annotations-1.1.jar -jackson-annotations-2.12.5.jar +j2objc-annotations-1.3.jar +jackson-annotations-2.13.2.jar jackson-annotations-2.14.0-rc1.jar -jackson-core-2.12.5.jar +jackson-core-2.13.2.jar jackson-core-2.14.0-rc1.jar -jackson-databind-2.12.1.jar -jackson-databind-2.12.5.jar +jackson-databind-2.13.2.2.jar jackson-databind-2.14.0-rc1.jar +jackson-databind-2.15.2.jar jackson-dataformat-yaml-2.9.3.jar -jackson-datatype-jsr310-2.12.1.jar +jackson-datatype-jsr310-2.15.2.jar +jackson-jakarta-rs-base-2.15.2.jar +jackson-jakarta-rs-json-provider-2.15.2.jar jackson-jaxrs-base-2.14.0-rc1.jar -jackson-jaxrs-json-provider-2.12.1-jakarta.jar jackson-jaxrs-json-provider-2.14.0-rc1.jar +jackson-module-jakarta-xmlbind-annotations-2.15.2.jar jackson-module-jaxb-annotations-2.14.0-rc1.jar +jakarta.activation-2.0.0.jar jakarta.activation-2.0.1.jar jakarta.activation-api-1.2.2.jar jakarta.annotation-api-2.0.0.jar @@ -121,8 +137,9 @@ jakarta.inject-api-2.0.0.jar jakarta.servlet-api-5.0.0.jar jakarta.validation-api-3.0.0.jar jakarta.ws.rs-api-3.0.0.jar -jakarta.xml.bind-api-4.0.0-RC2.jar -jamm-0.3.0.jar +jakarta.xml.bind-api-3.0.0.jar +jamm-0.3.2.jar +java-cup-runtime-11b-20160615.jar javapoet-1.8.0.jar javassist-3.21.0-GA.jar javatuples-1.2.jar @@ -137,9 +154,10 @@ jcabi-log-0.14.jar jcabi-manifests-1.1.jar jcip-annotations-1.0-1.jar jcl-over-slf4j-1.7.25.jar +jcommander-1.30.jar jcseg-core-2.6.2.jar -jctools-core-1.2.1.jar jctools-core-2.1.1.jar +jctools-core-3.1.0.jar jersey-apache-connector-3.0.3.jar jersey-client-3.0.3.jar jersey-common-3.0.3.jar @@ -154,9 +172,9 @@ jersey-media-json-jackson-3.0.3.jar jersey-server-3.0.3.jar jersey-test-framework-core-3.0.3.jar jersey-test-framework-provider-grizzly2-3.0.3.jar -jffi-1.2.16-native.jar jffi-1.2.16.jar -jflex-1.6.0.jar +jffi-1.2.16-native.jar +jflex-1.8.2.jar jieba-analysis-1.0.2.jar jjwt-api-0.11.5.jar jjwt-impl-0.11.5.jar @@ -166,12 +184,12 @@ jna-5.12.1.jar jnr-ffi-2.1.7.jar jnr-x86asm-1.0.2.jar joda-time-2.10.8.jar -joda-time-2.4.jar jraft-core-1.3.11.jar json-simple-1.1.jar json-smart-2.3.jar jsr305-3.0.1.jar -junit-4.12.jar +junit-4.13.1.jar +jvm-attach-api-1.5.jar kerb-admin-2.0.0.jar kerb-client-2.0.0.jar kerb-common-2.0.0.jar @@ -186,10 +204,15 @@ kerby-config-2.0.0.jar kerby-pkix-2.0.0.jar kerby-util-2.0.0.jar kerby-xdr-2.0.0.jar -libthrift-0.9.2.jar +kotlin-stdlib-1.6.20.jar +kotlin-stdlib-common-1.5.31.jar +kotlin-stdlib-jdk7-1.6.10.jar +kotlin-stdlib-jdk8-1.6.10.jar +listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar log4j-api-2.17.1.jar log4j-core-2.17.1.jar log4j-slf4j-impl-2.17.1.jar +logging-interceptor-4.10.0.jar lookout-api-1.4.1.jar lucene-analyzers-common-8.11.2.jar lucene-analyzers-smartcn-8.11.2.jar @@ -197,7 +220,6 @@ lucene-core-8.11.2.jar lucene-queries-4.7.2.jar lucene-queryparser-4.7.2.jar lucene-sandbox-4.7.2.jar -lz4-1.3.0.jar lz4-java-1.8.0.jar metrics-annotation-4.2.4.jar metrics-core-3.0.2.jar @@ -209,13 +231,17 @@ metrics-jvm-3.1.5.jar metrics-logback-3.1.5.jar mmseg4j-core-1.10.0.jar mockito-core-3.3.3.jar +mxdump-0.14.jar netty-all-4.1.44.Final.jar netty-all-4.1.61.Final.jar +netty-tcnative-boringssl-static-2.0.36.Final.jar nimbus-jose-jwt-4.41.2.jar nlp-lang-1.7.7.jar objenesis-2.6.jar ohc-core-0.7.4.jar -ohc-core-j8-0.4.4.jar +ohc-core-j8-0.5.1.jar +okhttp-4.10.0.jar +okio-jvm-3.0.0.jar opentracing-api-0.22.0.jar opentracing-mock-0.22.0.jar opentracing-noop-0.22.0.jar @@ -226,38 +252,46 @@ parboiled-scala_2.12-1.2.0.jar parser-9.0-9.0.20190305.jar perfmark-api-0.25.0.jar picocli-4.3.2.jar -postgresql-42.4.1.jar +postgresql-42.4.3.jar protobuf-java-3.21.7.jar -reporter-config-base-3.0.3.jar +proto-google-common-protos-1.17.0.jar +psjava-0.1.19.jar reporter-config3-3.0.3.jar +reporter-config-base-3.0.3.jar rewriting-9.0-9.0.20190305.jar rocksdbjni-7.2.2.jar scala-java8-compat_2.12-0.8.0.jar scala-library-2.12.7.jar scala-reflect-2.12.7.jar sigar-1.6.4.jar +sjk-cli-0.14.jar +sjk-core-0.14.jar +sjk-json-0.14.jar +sjk-stacktrace-0.14.jar slf4j-api-1.7.25.jar -slf4j-api-1.7.7.jar snakeyaml-1.26.jar snakeyaml-1.27.jar -snappy-java-1.1.1.7.jar +snakeyaml-2.2.jar +snappy-java-1.1.2.6.jar snowball-stemmer-1.3.0.581.1.jar sofa-common-tools-1.0.12.jar sofa-rpc-all-5.7.6.jar sourcecode_2.12-0.1.4.jar +ST4-4.0.8.jar stream-2.5.2.jar swagger-annotations-1.5.18.jar -swagger-annotations-jakarta-2.1.9.jar +swagger-annotations-jakarta-2.2.18.jar swagger-core-1.5.18.jar -swagger-core-jakarta-2.1.9.jar -swagger-integration-jakarta-2.1.9.jar -swagger-jaxrs2-jakarta-2.1.9.jar +swagger-core-jakarta-2.2.18.jar +swagger-integration-jakarta-2.2.18.jar +swagger-jaxrs2-jakarta-2.2.18.jar swagger-models-1.5.18.jar -swagger-models-jakarta-2.1.9.jar -thrift-server-0.3.7.jar +swagger-models-jakarta-2.2.18.jar tinkergraph-gremlin-3.5.1.jar token-provider-2.0.0.jar tracer-core-3.0.8.jar translation-1.0.4.jar util-9.0-9.0.20190305.jar validation-api-1.1.0.Final.jar +zstd-jni-1.5.5-1.jar +zt-zip-1.14.jar diff --git a/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh b/hugegraph-server/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh similarity index 100% rename from hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh rename to hugegraph-server/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh diff --git a/hugegraph-dist/src/assembly/descriptor/assembly.xml b/hugegraph-server/hugegraph-dist/src/assembly/descriptor/assembly.xml similarity index 96% rename from hugegraph-dist/src/assembly/descriptor/assembly.xml rename to hugegraph-server/hugegraph-dist/src/assembly/descriptor/assembly.xml index a5b300216b..4ae2286aa2 100644 --- a/hugegraph-dist/src/assembly/descriptor/assembly.xml +++ b/hugegraph-server/hugegraph-dist/src/assembly/descriptor/assembly.xml @@ -49,7 +49,7 @@ - ${top.level.dir}/hugegraph-dist/release-docs/ + ${top.level.dir}/hugegraph-server/hugegraph-dist/release-docs/ / diff --git a/hugegraph-dist/src/assembly/jenkins/build.sh b/hugegraph-server/hugegraph-dist/src/assembly/jenkins/build.sh similarity index 100% rename from hugegraph-dist/src/assembly/jenkins/build.sh rename to hugegraph-server/hugegraph-dist/src/assembly/jenkins/build.sh diff --git a/hugegraph-dist/src/assembly/jenkins/config.sh b/hugegraph-server/hugegraph-dist/src/assembly/jenkins/config.sh similarity index 100% rename from hugegraph-dist/src/assembly/jenkins/config.sh rename to hugegraph-server/hugegraph-dist/src/assembly/jenkins/config.sh diff --git a/hugegraph-dist/src/assembly/jenkins/deploy.sh b/hugegraph-server/hugegraph-dist/src/assembly/jenkins/deploy.sh similarity index 100% rename from hugegraph-dist/src/assembly/jenkins/deploy.sh rename to hugegraph-server/hugegraph-dist/src/assembly/jenkins/deploy.sh diff --git a/hugegraph-dist/src/assembly/jenkins/jenkins.sh b/hugegraph-server/hugegraph-dist/src/assembly/jenkins/jenkins.sh similarity index 97% rename from hugegraph-dist/src/assembly/jenkins/jenkins.sh rename to hugegraph-server/hugegraph-dist/src/assembly/jenkins/jenkins.sh index c177c03b73..559bf804bb 100644 --- a/hugegraph-dist/src/assembly/jenkins/jenkins.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/jenkins/jenkins.sh @@ -18,7 +18,7 @@ # Backends contains [memory, rocksdb, cassandra, scylladb, mysql] export BACKEND=memory # The jenkins script store path -export SCRIPT_DIR="hugegraph-dist/src/assembly/jenkins" +export SCRIPT_DIR="hugegraph-server/hugegraph-dist/src/assembly/jenkins" # The jenkins job integrated behavior: [test, deploy, publish] export ACTION=${ACTION} diff --git a/hugegraph-dist/src/assembly/jenkins/publish.sh b/hugegraph-server/hugegraph-dist/src/assembly/jenkins/publish.sh similarity index 100% rename from hugegraph-dist/src/assembly/jenkins/publish.sh rename to hugegraph-server/hugegraph-dist/src/assembly/jenkins/publish.sh diff --git a/hugegraph-dist/src/assembly/jenkins/test.sh b/hugegraph-server/hugegraph-dist/src/assembly/jenkins/test.sh similarity index 100% rename from hugegraph-dist/src/assembly/jenkins/test.sh rename to hugegraph-server/hugegraph-dist/src/assembly/jenkins/test.sh diff --git a/hugegraph-dist/src/assembly/static/bin/checksocket.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/checksocket.sh similarity index 100% rename from hugegraph-dist/src/assembly/static/bin/checksocket.sh rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/checksocket.sh diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/docker-entrypoint.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/docker-entrypoint.sh new file mode 100644 index 0000000000..e1fad4a9ff --- /dev/null +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/docker-entrypoint.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with this +# work for additional information regarding copyright ownership. The ASF +# licenses this file to You under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# + + +./bin/wait-storage.sh + +./bin/init-store.sh + +./bin/start-hugegraph.sh -d false -j "$JAVA_OPTS" -g zgc diff --git a/hugegraph-dist/src/assembly/static/bin/dump-conf.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/dump-conf.sh similarity index 100% rename from hugegraph-dist/src/assembly/static/bin/dump-conf.sh rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/dump-conf.sh diff --git a/hugegraph-dist/src/assembly/static/bin/dump-store.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/dump-store.sh similarity index 100% rename from hugegraph-dist/src/assembly/static/bin/dump-store.sh rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/dump-store.sh diff --git a/hugegraph-dist/src/assembly/static/bin/gremlin-console.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/gremlin-console.sh similarity index 91% rename from hugegraph-dist/src/assembly/static/bin/gremlin-console.sh rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/gremlin-console.sh index b8a0fadbd2..edcdc0c403 100755 --- a/hugegraph-dist/src/assembly/static/bin/gremlin-console.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/gremlin-console.sh @@ -84,14 +84,10 @@ PROFILING_ENABLED=false # Process options MAIN_CLASS=org.apache.tinkerpop.gremlin.console.Console -while getopts "elpv" opt; do +while getopts "lpv" opt; do case "$opt" in - e) MAIN_CLASS=org.apache.tinkerpop.gremlin.groovy.jsr223.ScriptExecutor - # Stop processing gremlin-console.sh arguments as soon as the -e switch - # is seen; everything following -e becomes arguments to the - # ScriptExecutor main class. This maintains compatibility with - # older deployments. - break;; + # class ScriptExecutor has been Deprecated. + # reference https://tinkerpop.apache.org/javadocs/3.2.3/full/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptExecutor.html l) eval GREMLIN_LOG_LEVEL=\$$OPTIND OPTIND="$(( $OPTIND + 1 ))" if [ "$GREMLIN_LOG_LEVEL" = "TRACE" -o \ diff --git a/hugegraph-dist/src/assembly/static/bin/hugegraph b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph similarity index 100% rename from hugegraph-dist/src/assembly/static/bin/hugegraph rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph diff --git a/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh similarity index 100% rename from hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh diff --git a/hugegraph-dist/src/assembly/static/bin/hugegraph.service b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph.service similarity index 100% rename from hugegraph-dist/src/assembly/static/bin/hugegraph.service rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph.service diff --git a/hugegraph-dist/src/assembly/static/bin/init-store.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/init-store.sh similarity index 100% rename from hugegraph-dist/src/assembly/static/bin/init-store.sh rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/init-store.sh diff --git a/hugegraph-dist/src/assembly/static/bin/install.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/install.sh similarity index 100% rename from hugegraph-dist/src/assembly/static/bin/install.sh rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/install.sh diff --git a/hugegraph-dist/src/assembly/static/bin/monitor-hugegraph.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/monitor-hugegraph.sh similarity index 100% rename from hugegraph-dist/src/assembly/static/bin/monitor-hugegraph.sh rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/monitor-hugegraph.sh diff --git a/hugegraph-dist/src/assembly/static/bin/raft-tools.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/raft-tools.sh similarity index 95% rename from hugegraph-dist/src/assembly/static/bin/raft-tools.sh rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/raft-tools.sh index a5df8fb08b..329361baa2 100755 --- a/hugegraph-dist/src/assembly/static/bin/raft-tools.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/raft-tools.sh @@ -18,9 +18,9 @@ export LANG=zh_CN.UTF-8 set -e -HOME_PATH=`dirname $0` -HOME_PATH=`cd ${HOME_PATH}/.. && pwd` -cd ${HOME_PATH} +HOME_PATH=$(dirname "$0") +HOME_PATH=$(cd "${HOME_PATH}"/.. && pwd) +cd "${HOME_PATH}" BIN_PATH=${HOME_PATH}/bin CONF_PATH=${HOME_PATH}/conf @@ -98,7 +98,7 @@ function remove_peer() { } if [ "${HUGEGRAPH_URL}" = "" ]; then - HUGEGRAPH_URL=`read_property ${CONF_PATH}/rest-server.properties restserver.url` + HUGEGRAPH_URL=$(read_property ${CONF_PATH}/rest-server.properties restserver.url) fi if [ "${HUGEGRAPH_GRAPH}" = "" ]; then diff --git a/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh similarity index 100% rename from hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh diff --git a/hugegraph-dist/src/assembly/static/bin/start-monitor.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-monitor.sh similarity index 100% rename from hugegraph-dist/src/assembly/static/bin/start-monitor.sh rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-monitor.sh diff --git a/hugegraph-dist/src/assembly/static/bin/stop-hugegraph.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/stop-hugegraph.sh similarity index 100% rename from hugegraph-dist/src/assembly/static/bin/stop-hugegraph.sh rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/stop-hugegraph.sh diff --git a/hugegraph-dist/src/assembly/static/bin/stop-monitor.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/stop-monitor.sh similarity index 100% rename from hugegraph-dist/src/assembly/static/bin/stop-monitor.sh rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/stop-monitor.sh diff --git a/hugegraph-dist/src/assembly/static/bin/util.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh similarity index 99% rename from hugegraph-dist/src/assembly/static/bin/util.sh rename to hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh index 64980403b1..fa3f94a215 100755 --- a/hugegraph-dist/src/assembly/static/bin/util.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh @@ -141,7 +141,7 @@ function wait_for_startup() { return 1 fi - status=$(curl -I -s -w "%{http_code}" -o /dev/null "$server_url") + status=$(curl -I -s -k -w "%{http_code}" -o /dev/null "$server_url") if [[ $status -eq 200 || $status -eq 401 ]]; then echo "OK" echo "Started [pid $pid]" diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-storage.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-storage.sh new file mode 100644 index 0000000000..bdadeab234 --- /dev/null +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-storage.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# +# Copyright 2023 JanusGraph Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +function abs_path() { + SOURCE="${BASH_SOURCE[0]}" + while [[ -h "$SOURCE" ]]; do + DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" + done + cd -P "$(dirname "$SOURCE")" && pwd +} + +BIN=$(abs_path) +TOP="$(cd "$BIN"/../ && pwd)" +GRAPH_CONF="$TOP/conf/graphs/hugegraph.properties" +WAIT_STORAGE_TIMEOUT_S=120 +DETECT_STORAGE="$TOP/scripts/detect-storage.groovy" + +. "$BIN"/util.sh + +# apply config from env +while IFS=' ' read -r envvar_key envvar_val; do + if [[ "${envvar_key}" =~ hugegraph\. ]] && [[ ! -z ${envvar_val} ]]; then + envvar_key=${envvar_key#"hugegraph."} + if grep -q -E "^\s*${envvar_key}\s*=\.*" ${GRAPH_CONF}; then + sed -ri "s#^(\s*${envvar_key}\s*=).*#\\1${envvar_val}#" ${GRAPH_CONF} + else + echo "${envvar_key}=${envvar_val}" >> ${GRAPH_CONF} + fi + else + continue + fi +done < <(env | sort -r | awk -F= '{ st = index($0, "="); print $1 " " substr($0, st+1) }') + +# wait for storage +if env | grep '^hugegraph\.' > /dev/null; then + if ! [ -z "${WAIT_STORAGE_TIMEOUT_S:-}" ]; then + timeout "${WAIT_STORAGE_TIMEOUT_S}s" bash -c \ + "until bin/gremlin-console.sh -- -e $DETECT_STORAGE > /dev/null 2>&1; do echo \"waiting for storage...\"; sleep 5; done" + fi +fi diff --git a/hugegraph-dist/src/assembly/static/conf/computer.yaml b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/computer.yaml similarity index 100% rename from hugegraph-dist/src/assembly/static/conf/computer.yaml rename to hugegraph-server/hugegraph-dist/src/assembly/static/conf/computer.yaml diff --git a/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties similarity index 100% rename from hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties rename to hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties diff --git a/hugegraph-dist/src/assembly/static/conf/gremlin-driver-settings.yaml b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/gremlin-driver-settings.yaml similarity index 100% rename from hugegraph-dist/src/assembly/static/conf/gremlin-driver-settings.yaml rename to hugegraph-server/hugegraph-dist/src/assembly/static/conf/gremlin-driver-settings.yaml diff --git a/hugegraph-dist/src/assembly/static/conf/gremlin-server.yaml b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/gremlin-server.yaml similarity index 98% rename from hugegraph-dist/src/assembly/static/conf/gremlin-server.yaml rename to hugegraph-server/hugegraph-dist/src/assembly/static/conf/gremlin-server.yaml index dff43cb04b..5946779828 100644 --- a/hugegraph-dist/src/assembly/static/conf/gremlin-server.yaml +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/gremlin-server.yaml @@ -40,6 +40,8 @@ scriptEngines: { org.apache.hugegraph.backend.id.IdGenerator, org.apache.hugegraph.type.define.Directions, org.apache.hugegraph.type.define.NodeRole, + org.apache.hugegraph.masterelection.GlobalMasterInfo, + org.apache.hugegraph.util.DateUtil, org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, org.apache.hugegraph.traversal.algorithm.CountTraverser, org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, @@ -64,7 +66,6 @@ scriptEngines: { org.apache.hugegraph.traversal.optimize.ConditionP, org.apache.hugegraph.traversal.optimize.Text, org.apache.hugegraph.traversal.optimize.TraversalUtil, - org.apache.hugegraph.util.DateUtil, org.opencypher.gremlin.traversal.CustomFunctions, org.opencypher.gremlin.traversal.CustomPredicate ], diff --git a/hugegraph-dist/src/assembly/static/conf/log4j2.xml b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml similarity index 79% rename from hugegraph-dist/src/assembly/static/conf/log4j2.xml rename to hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml index 985ab78b2f..db58e89112 100644 --- a/hugegraph-dist/src/assembly/static/conf/log4j2.xml +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml @@ -76,6 +76,30 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -113,5 +137,8 @@ + + + diff --git a/hugegraph-dist/src/assembly/static/conf/remote-objects.yaml b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/remote-objects.yaml similarity index 100% rename from hugegraph-dist/src/assembly/static/conf/remote-objects.yaml rename to hugegraph-server/hugegraph-dist/src/assembly/static/conf/remote-objects.yaml diff --git a/hugegraph-dist/src/assembly/static/conf/remote.yaml b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/remote.yaml similarity index 100% rename from hugegraph-dist/src/assembly/static/conf/remote.yaml rename to hugegraph-server/hugegraph-dist/src/assembly/static/conf/remote.yaml diff --git a/hugegraph-dist/src/assembly/static/conf/rest-server.properties b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/rest-server.properties similarity index 88% rename from hugegraph-dist/src/assembly/static/conf/rest-server.properties rename to hugegraph-server/hugegraph-dist/src/assembly/static/conf/rest-server.properties index 794caec84d..23f78c5824 100644 --- a/hugegraph-dist/src/assembly/static/conf/rest-server.properties +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/rest-server.properties @@ -9,6 +9,12 @@ graphs=./conf/graphs batch.max_write_ratio=80 batch.max_write_threads=0 +# configuration of arthas +arthas.telnet_port=8562 +arthas.http_port=8561 +arthas.ip=0.0.0.0 +arthas.disabled_commands=jad + # authentication configs # choose 'org.apache.hugegraph.auth.StandardAuthenticator' or # 'org.apache.hugegraph.auth.ConfigAuthenticator' @@ -42,3 +48,6 @@ rpc.server_port=8091 # lightweight load balancing (beta) server.id=server-1 server.role=master + +# slow query log +log.slow_query_threshold=1000 diff --git a/hugegraph-dist/src/assembly/static/ext/README.txt b/hugegraph-server/hugegraph-dist/src/assembly/static/ext/README.txt similarity index 100% rename from hugegraph-dist/src/assembly/static/ext/README.txt rename to hugegraph-server/hugegraph-dist/src/assembly/static/ext/README.txt diff --git a/hugegraph-dist/src/assembly/static/ext/plugins.txt b/hugegraph-server/hugegraph-dist/src/assembly/static/ext/plugins.txt similarity index 100% rename from hugegraph-dist/src/assembly/static/ext/plugins.txt rename to hugegraph-server/hugegraph-dist/src/assembly/static/ext/plugins.txt diff --git a/hugegraph-dist/src/assembly/static/scripts/empty-sample.groovy b/hugegraph-server/hugegraph-dist/src/assembly/static/scripts/empty-sample.groovy similarity index 100% rename from hugegraph-dist/src/assembly/static/scripts/empty-sample.groovy rename to hugegraph-server/hugegraph-dist/src/assembly/static/scripts/empty-sample.groovy diff --git a/hugegraph-dist/src/assembly/static/scripts/example.groovy b/hugegraph-server/hugegraph-dist/src/assembly/static/scripts/example.groovy similarity index 100% rename from hugegraph-dist/src/assembly/static/scripts/example.groovy rename to hugegraph-server/hugegraph-dist/src/assembly/static/scripts/example.groovy diff --git a/hugegraph-dist/src/assembly/travis/build-report.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/build-report.sh similarity index 97% rename from hugegraph-dist/src/assembly/travis/build-report.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/build-report.sh index 7d518334f6..5420b510fa 100755 --- a/hugegraph-dist/src/assembly/travis/build-report.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/build-report.sh @@ -27,7 +27,7 @@ if [ "$BACKEND" == "memory" ]; then OPTION_CLASS_FILES_BACKEND="" fi -cd hugegraph-test +cd hugegraph-server/hugegraph-test mvn jacoco:dump@pull-test-data -Dapp.host=localhost -Dapp.port=$JACOCO_PORT -Dskip.dump=false cd ../ diff --git a/hugegraph-dist/src/assembly/travis/conf-raft1/graphs/hugegraph.properties b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft1/graphs/hugegraph.properties similarity index 100% rename from hugegraph-dist/src/assembly/travis/conf-raft1/graphs/hugegraph.properties rename to hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft1/graphs/hugegraph.properties diff --git a/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml similarity index 94% rename from hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml rename to hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml index 517c0a5fcc..55a8c0bb34 100644 --- a/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml @@ -36,6 +36,8 @@ scriptEngines: { org.apache.hugegraph.backend.id.IdGenerator, org.apache.hugegraph.type.define.Directions, org.apache.hugegraph.type.define.NodeRole, + org.apache.hugegraph.masterelection.GlobalMasterInfo, + org.apache.hugegraph.util.DateUtil, org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, org.apache.hugegraph.traversal.algorithm.CountTraverser, org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, @@ -57,9 +59,11 @@ scriptEngines: { org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, + org.apache.hugegraph.traversal.optimize.ConditionP, org.apache.hugegraph.traversal.optimize.Text, org.apache.hugegraph.traversal.optimize.TraversalUtil, - org.apache.hugegraph.util.DateUtil + org.opencypher.gremlin.traversal.CustomFunctions, + org.opencypher.gremlin.traversal.CustomPredicate ], methodImports: [java.lang.Math#*] }, diff --git a/hugegraph-dist/src/assembly/travis/conf-raft1/rest-server.properties b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft1/rest-server.properties similarity index 100% rename from hugegraph-dist/src/assembly/travis/conf-raft1/rest-server.properties rename to hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft1/rest-server.properties diff --git a/hugegraph-dist/src/assembly/travis/conf-raft2/graphs/hugegraph.properties b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft2/graphs/hugegraph.properties similarity index 100% rename from hugegraph-dist/src/assembly/travis/conf-raft2/graphs/hugegraph.properties rename to hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft2/graphs/hugegraph.properties diff --git a/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml similarity index 94% rename from hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml rename to hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml index bd37369c83..54d9a6ddec 100644 --- a/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml @@ -36,6 +36,8 @@ scriptEngines: { org.apache.hugegraph.backend.id.IdGenerator, org.apache.hugegraph.type.define.Directions, org.apache.hugegraph.type.define.NodeRole, + org.apache.hugegraph.masterelection.GlobalMasterInfo, + org.apache.hugegraph.util.DateUtil, org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, org.apache.hugegraph.traversal.algorithm.CountTraverser, org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, @@ -57,9 +59,11 @@ scriptEngines: { org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, + org.apache.hugegraph.traversal.optimize.ConditionP, org.apache.hugegraph.traversal.optimize.Text, org.apache.hugegraph.traversal.optimize.TraversalUtil, - org.apache.hugegraph.util.DateUtil + org.opencypher.gremlin.traversal.CustomFunctions, + org.opencypher.gremlin.traversal.CustomPredicate ], methodImports: [java.lang.Math#*] }, diff --git a/hugegraph-dist/src/assembly/travis/conf-raft2/rest-server.properties b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft2/rest-server.properties similarity index 100% rename from hugegraph-dist/src/assembly/travis/conf-raft2/rest-server.properties rename to hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft2/rest-server.properties diff --git a/hugegraph-dist/src/assembly/travis/conf-raft3/graphs/hugegraph.properties b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft3/graphs/hugegraph.properties similarity index 100% rename from hugegraph-dist/src/assembly/travis/conf-raft3/graphs/hugegraph.properties rename to hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft3/graphs/hugegraph.properties diff --git a/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml similarity index 94% rename from hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml rename to hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml index a034d63520..508abef354 100644 --- a/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml @@ -36,6 +36,8 @@ scriptEngines: { org.apache.hugegraph.backend.id.IdGenerator, org.apache.hugegraph.type.define.Directions, org.apache.hugegraph.type.define.NodeRole, + org.apache.hugegraph.masterelection.GlobalMasterInfo, + org.apache.hugegraph.util.DateUtil, org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, org.apache.hugegraph.traversal.algorithm.CountTraverser, org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, @@ -57,9 +59,11 @@ scriptEngines: { org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, + org.apache.hugegraph.traversal.optimize.ConditionP, org.apache.hugegraph.traversal.optimize.Text, org.apache.hugegraph.traversal.optimize.TraversalUtil, - org.apache.hugegraph.util.DateUtil + org.opencypher.gremlin.traversal.CustomFunctions, + org.opencypher.gremlin.traversal.CustomPredicate ], methodImports: [java.lang.Math#*] }, diff --git a/hugegraph-dist/src/assembly/travis/conf-raft3/rest-server.properties b/hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft3/rest-server.properties similarity index 100% rename from hugegraph-dist/src/assembly/travis/conf-raft3/rest-server.properties rename to hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft3/rest-server.properties diff --git a/hugegraph-dist/src/assembly/travis/hbase-site.xml b/hugegraph-server/hugegraph-dist/src/assembly/travis/hbase-site.xml similarity index 100% rename from hugegraph-dist/src/assembly/travis/hbase-site.xml rename to hugegraph-server/hugegraph-dist/src/assembly/travis/hbase-site.xml diff --git a/hugegraph-dist/src/assembly/travis/install-backend.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-backend.sh similarity index 93% rename from hugegraph-dist/src/assembly/travis/install-backend.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/install-backend.sh index 64c53a875b..21e2f11e6b 100755 --- a/hugegraph-dist/src/assembly/travis/install-backend.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-backend.sh @@ -31,12 +31,14 @@ fi case $BACKEND in cassandra) + # TODO: replace it with docker "$TRAVIS_DIR"/install-cassandra.sh ;; scylladb) "$TRAVIS_DIR"/install-scylladb.sh ;; hbase) + # TODO: replace it with hbase2.3+ to avoid java8 env "$TRAVIS_DIR"/install-hbase.sh ;; mysql) diff --git a/hugegraph-dist/src/assembly/travis/install-cassandra.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-cassandra.sh similarity index 97% rename from hugegraph-dist/src/assembly/travis/install-cassandra.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/install-cassandra.sh index 367259d141..d83d890dee 100755 --- a/hugegraph-dist/src/assembly/travis/install-cassandra.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-cassandra.sh @@ -17,9 +17,8 @@ # set -ev -TRAVIS_DIR=`dirname $0` CASS_DOWNLOAD_ADDRESS="http://archive.apache.org/dist/cassandra" -CASS_VERSION="3.10" +CASS_VERSION="4.0.10" CASS_PACKAGE="apache-cassandra-${CASS_VERSION}" CASS_TAR="${CASS_PACKAGE}-bin.tar.gz" CASS_CONF="${CASS_PACKAGE}/conf/cassandra.yaml" diff --git a/hugegraph-dist/src/assembly/travis/install-hbase.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-hbase.sh similarity index 98% rename from hugegraph-dist/src/assembly/travis/install-hbase.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/install-hbase.sh index 9de48f277e..bdee3e75ab 100755 --- a/hugegraph-dist/src/assembly/travis/install-hbase.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-hbase.sh @@ -17,7 +17,7 @@ # set -ev -TRAVIS_DIR=`dirname $0` +TRAVIS_DIR=$(dirname $0) HBASE_DOWNLOAD_ADDRESS="http://archive.apache.org/dist/hbase" HBASE_VERSION="2.0.2" HBASE_PACKAGE="hbase-${HBASE_VERSION}" diff --git a/hugegraph-dist/src/assembly/travis/install-mysql-via-docker.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql-via-docker.sh similarity index 94% rename from hugegraph-dist/src/assembly/travis/install-mysql-via-docker.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql-via-docker.sh index ade8170d66..7239098cd7 100755 --- a/hugegraph-dist/src/assembly/travis/install-mysql-via-docker.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql-via-docker.sh @@ -20,7 +20,7 @@ set -ev TRAVIS_DIR=$(dirname "$0") # Need speed up it -CONF=hugegraph-test/src/main/resources/hugegraph.properties +CONF=hugegraph-server/hugegraph-test/src/main/resources/hugegraph.properties MYSQL_USERNAME=root # Set MySQL configurations diff --git a/hugegraph-dist/src/assembly/travis/install-mysql.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql.sh similarity index 100% rename from hugegraph-dist/src/assembly/travis/install-mysql.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql.sh diff --git a/hugegraph-dist/src/assembly/travis/install-postgresql-via-docker.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql-via-docker.sh similarity index 94% rename from hugegraph-dist/src/assembly/travis/install-postgresql-via-docker.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql-via-docker.sh index d9354e470e..62d35d283a 100755 --- a/hugegraph-dist/src/assembly/travis/install-postgresql-via-docker.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql-via-docker.sh @@ -18,7 +18,7 @@ set -ev TRAVIS_DIR=$(dirname "$0") -CONF=hugegraph-test/src/main/resources/hugegraph.properties +CONF=hugegraph-server/hugegraph-test/src/main/resources/hugegraph.properties POSTGRESQL_DRIVER=org.postgresql.Driver POSTGRESQL_URL=jdbc:postgresql://localhost:5432/ diff --git a/hugegraph-dist/src/assembly/travis/install-postgresql.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql.sh similarity index 94% rename from hugegraph-dist/src/assembly/travis/install-postgresql.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql.sh index 12185e8306..04562c18a8 100755 --- a/hugegraph-dist/src/assembly/travis/install-postgresql.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql.sh @@ -18,7 +18,7 @@ set -ev TRAVIS_DIR=$(dirname "$0") -CONF=hugegraph-test/src/main/resources/hugegraph.properties +CONF=hugegraph-server/hugegraph-test/src/main/resources/hugegraph.properties POSTGRESQL_DRIVER=org.postgresql.Driver POSTGRESQL_URL=jdbc:postgresql://localhost:5432/ diff --git a/hugegraph-dist/src/assembly/travis/install-scylladb.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-scylladb.sh similarity index 100% rename from hugegraph-dist/src/assembly/travis/install-scylladb.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/install-scylladb.sh diff --git a/hugegraph-dist/src/assembly/travis/maven.xml b/hugegraph-server/hugegraph-dist/src/assembly/travis/maven.xml similarity index 100% rename from hugegraph-dist/src/assembly/travis/maven.xml rename to hugegraph-server/hugegraph-dist/src/assembly/travis/maven.xml diff --git a/hugegraph-dist/src/assembly/travis/mysql.cnf b/hugegraph-server/hugegraph-dist/src/assembly/travis/mysql.cnf similarity index 100% rename from hugegraph-dist/src/assembly/travis/mysql.cnf rename to hugegraph-server/hugegraph-dist/src/assembly/travis/mysql.cnf diff --git a/hugegraph-dist/src/assembly/travis/run-api-test-for-raft.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test-for-raft.sh similarity index 88% rename from hugegraph-dist/src/assembly/travis/run-api-test-for-raft.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test-for-raft.sh index 1c0eaaf165..c8647d997f 100755 --- a/hugegraph-dist/src/assembly/travis/run-api-test-for-raft.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test-for-raft.sh @@ -21,9 +21,9 @@ BACKEND=$1 REPORT_DIR=$2 REPORT_FILE=$REPORT_DIR/jacoco-api-test.xml -TRAVIS_DIR=`dirname $0` -VERSION=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout` -SERVER_DIR=apache-hugegraph-incubating-$VERSION +TRAVIS_DIR=$(dirname $0) +VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) +SERVER_DIR=hugegraph-server/apache-hugegraph-incubating-$VERSION RAFT1_DIR=hugegraph-raft1 RAFT2_DIR=hugegraph-raft2 RAFT3_DIR=hugegraph-raft3 @@ -57,7 +57,7 @@ export HUGEGRAPH_PASSWORD=pa $RAFT_TOOLS --set-leader "hugegraph" "$RAFT_LEADER" # run api-test -mvn test -P api-test,$BACKEND || (cat $RAFT1_DIR/logs/hugegraph-server.log && exit 1) +mvn test -pl hugegraph-server/hugegraph-test -am -P api-test,$BACKEND || (cat $RAFT1_DIR/logs/hugegraph-server.log && exit 1) $TRAVIS_DIR/build-report.sh $BACKEND $JACOCO_PORT $REPORT_FILE diff --git a/hugegraph-dist/src/assembly/travis/run-api-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh similarity index 92% rename from hugegraph-dist/src/assembly/travis/run-api-test.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh index c856ac54b2..755bb4b99d 100755 --- a/hugegraph-dist/src/assembly/travis/run-api-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh @@ -23,7 +23,7 @@ REPORT_FILE=$REPORT_DIR/jacoco-api-test-for-raft.xml TRAVIS_DIR=$(dirname $0) VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) -SERVER_DIR=apache-hugegraph-incubating-$VERSION +SERVER_DIR=hugegraph-server/apache-hugegraph-incubating-$VERSION/ CONF=$SERVER_DIR/conf/graphs/hugegraph.properties REST_SERVER_CONF=$SERVER_DIR/conf/rest-server.properties GREMLIN_SERVER_CONF=$SERVER_DIR/conf/gremlin-server.yaml @@ -31,7 +31,6 @@ JACOCO_PORT=36320 mvn package -DskipTests -ntp - # add mysql dependency wget -P $SERVER_DIR/lib/ https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.28/mysql-connector-java-8.0.28.jar @@ -58,7 +57,7 @@ authentication: { $TRAVIS_DIR/start-server.sh $SERVER_DIR $BACKEND $JACOCO_PORT || (cat $SERVER_DIR/logs/hugegraph-server.log && exit 1) # run api-test -mvn test -P api-test,$BACKEND || (cat $SERVER_DIR/logs/hugegraph-server.log && exit 1) +mvn test -pl hugegraph-server/hugegraph-test -am -P api-test,$BACKEND || (cat $SERVER_DIR/logs/hugegraph-server.log && exit 1) $TRAVIS_DIR/build-report.sh $BACKEND $JACOCO_PORT $REPORT_FILE diff --git a/hugegraph-dist/src/assembly/travis/run-core-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-core-test.sh similarity index 91% rename from hugegraph-dist/src/assembly/travis/run-core-test.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/run-core-test.sh index 6227692466..9ead2910c8 100755 --- a/hugegraph-dist/src/assembly/travis/run-core-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-core-test.sh @@ -19,4 +19,4 @@ set -ev BACKEND=$1 -mvn test -P core-test,$BACKEND +mvn test -pl hugegraph-server/hugegraph-test -am -P core-test,$BACKEND diff --git a/hugegraph-dist/src/assembly/travis/run-tinkerpop-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-tinkerpop-test.sh similarity index 84% rename from hugegraph-dist/src/assembly/travis/run-tinkerpop-test.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/run-tinkerpop-test.sh index b7855d5ab3..e706e8b5f9 100755 --- a/hugegraph-dist/src/assembly/travis/run-tinkerpop-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-tinkerpop-test.sh @@ -21,9 +21,9 @@ BACKEND=$1 SUITE=$2 if [[ "$SUITE" == "structure" || "$SUITE" == "tinkerpop" ]]; then - mvn test -P tinkerpop-structure-test,$BACKEND + mvn test -pl hugegraph-server/hugegraph-test -am -P tinkerpop-structure-test,$BACKEND fi if [[ "$SUITE" == "process" || "$SUITE" == "tinkerpop" ]]; then - mvn test -P tinkerpop-process-test,$BACKEND + mvn test -pl hugegraph-server/hugegraph-test -am -P tinkerpop-process-test,$BACKEND fi diff --git a/hugegraph-dist/src/assembly/travis/run-unit-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-unit-test.sh similarity index 92% rename from hugegraph-dist/src/assembly/travis/run-unit-test.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/run-unit-test.sh index 340bc6b8fe..f9d9a639be 100755 --- a/hugegraph-dist/src/assembly/travis/run-unit-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-unit-test.sh @@ -20,5 +20,5 @@ set -ev BACKEND=$1 if [[ "$BACKEND" == "memory" ]]; then - mvn test -P unit-test + mvn test -pl hugegraph-server/hugegraph-test -am -P unit-test fi diff --git a/hugegraph-dist/src/assembly/travis/start-server.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/start-server.sh similarity index 100% rename from hugegraph-dist/src/assembly/travis/start-server.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/start-server.sh diff --git a/hugegraph-dist/src/assembly/travis/stop-server.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/stop-server.sh similarity index 100% rename from hugegraph-dist/src/assembly/travis/stop-server.sh rename to hugegraph-server/hugegraph-dist/src/assembly/travis/stop-server.sh diff --git a/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/ConfDumper.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/ConfDumper.java similarity index 100% rename from hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/ConfDumper.java rename to hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/ConfDumper.java diff --git a/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java similarity index 100% rename from hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java rename to hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java diff --git a/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/StoreDumper.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/StoreDumper.java similarity index 100% rename from hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/StoreDumper.java rename to hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/StoreDumper.java diff --git a/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/DistOptions.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/DistOptions.java similarity index 100% rename from hugegraph-dist/src/main/java/org/apache/hugegraph/dist/DistOptions.java rename to hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/DistOptions.java diff --git a/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGraphServer.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGraphServer.java similarity index 100% rename from hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGraphServer.java rename to hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGraphServer.java diff --git a/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGremlinServer.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGremlinServer.java similarity index 100% rename from hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGremlinServer.java rename to hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeGremlinServer.java diff --git a/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeRestServer.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeRestServer.java similarity index 100% rename from hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeRestServer.java rename to hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/HugeRestServer.java diff --git a/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/RegisterUtil.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/RegisterUtil.java similarity index 100% rename from hugegraph-dist/src/main/java/org/apache/hugegraph/dist/RegisterUtil.java rename to hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/dist/RegisterUtil.java diff --git a/hugegraph-dist/src/main/resources/backend.properties b/hugegraph-server/hugegraph-dist/src/main/resources/backend.properties similarity index 100% rename from hugegraph-dist/src/main/resources/backend.properties rename to hugegraph-server/hugegraph-dist/src/main/resources/backend.properties diff --git a/hugegraph-dist/src/main/resources/log4j2.xml b/hugegraph-server/hugegraph-dist/src/main/resources/log4j2.xml similarity index 79% rename from hugegraph-dist/src/main/resources/log4j2.xml rename to hugegraph-server/hugegraph-dist/src/main/resources/log4j2.xml index bdd391e58b..5d80816291 100644 --- a/hugegraph-dist/src/main/resources/log4j2.xml +++ b/hugegraph-server/hugegraph-dist/src/main/resources/log4j2.xml @@ -76,6 +76,30 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -124,5 +148,9 @@ + + + + diff --git a/hugegraph-example/pom.xml b/hugegraph-server/hugegraph-example/pom.xml similarity index 98% rename from hugegraph-example/pom.xml rename to hugegraph-server/hugegraph-example/pom.xml index 1a96b2aa1f..3e75e2af67 100644 --- a/hugegraph-example/pom.xml +++ b/hugegraph-server/hugegraph-example/pom.xml @@ -19,7 +19,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - hugegraph + hugegraph-server org.apache.hugegraph ${revision} ../pom.xml diff --git a/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java similarity index 100% rename from hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java rename to hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java diff --git a/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example2.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example2.java similarity index 100% rename from hugegraph-example/src/main/java/org/apache/hugegraph/example/Example2.java rename to hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example2.java diff --git a/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example3.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example3.java similarity index 100% rename from hugegraph-example/src/main/java/org/apache/hugegraph/example/Example3.java rename to hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example3.java diff --git a/hugegraph-example/src/main/java/org/apache/hugegraph/example/ExampleUtil.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/ExampleUtil.java similarity index 95% rename from hugegraph-example/src/main/java/org/apache/hugegraph/example/ExampleUtil.java rename to hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/ExampleUtil.java index 7cb148262a..8317f9ba7f 100644 --- a/hugegraph-example/src/main/java/org/apache/hugegraph/example/ExampleUtil.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/ExampleUtil.java @@ -20,18 +20,17 @@ import java.io.File; import java.util.Iterator; import java.util.concurrent.TimeoutException; -import org.slf4j.Logger; import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeFactory; import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.dist.RegisterUtil; +import org.apache.hugegraph.masterelection.GlobalMasterInfo; import org.apache.hugegraph.perf.PerfUtil; import org.apache.hugegraph.task.HugeTask; import org.apache.hugegraph.task.TaskScheduler; -import org.apache.hugegraph.type.define.NodeRole; import org.apache.hugegraph.util.Log; +import org.slf4j.Logger; public class ExampleUtil { private static final Logger LOG = Log.logger(ExampleUtil.class); @@ -81,7 +80,7 @@ public static HugeGraph loadGraph(boolean needClear, boolean needProfile) { graph.clearBackend(); } graph.initBackend(); - graph.serverStarted(IdGenerator.of("server1"), NodeRole.MASTER); + graph.serverStarted(GlobalMasterInfo.master("server1")); return graph; } diff --git a/hugegraph-example/src/main/java/org/apache/hugegraph/example/GraphOfTheMoviesExample.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/GraphOfTheMoviesExample.java similarity index 100% rename from hugegraph-example/src/main/java/org/apache/hugegraph/example/GraphOfTheMoviesExample.java rename to hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/GraphOfTheMoviesExample.java diff --git a/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java similarity index 100% rename from hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java rename to hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java diff --git a/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java similarity index 100% rename from hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java rename to hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java diff --git a/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample3.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample3.java similarity index 100% rename from hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample3.java rename to hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample3.java diff --git a/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample4.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample4.java similarity index 100% rename from hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample4.java rename to hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample4.java diff --git a/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExampleBase.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExampleBase.java similarity index 74% rename from hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExampleBase.java rename to hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExampleBase.java index dfd72a763f..b5ec0506f4 100644 --- a/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExampleBase.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExampleBase.java @@ -26,12 +26,6 @@ import java.util.concurrent.CyclicBarrier; import java.util.function.Consumer; -import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Transaction; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.slf4j.Logger; - import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.backend.cache.Cache; import org.apache.hugegraph.backend.cache.CacheManager; @@ -45,6 +39,11 @@ import org.apache.hugegraph.type.define.Directions; import org.apache.hugegraph.type.define.HugeKeys; import org.apache.hugegraph.util.Log; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Transaction; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.slf4j.Logger; public abstract class PerfExampleBase { @@ -54,8 +53,7 @@ public abstract class PerfExampleBase { protected static final Logger LOG = Log.logger(PerfExampleBase.class); - protected Set vertices = Collections.newSetFromMap( - new ConcurrentHashMap()); + protected Set vertices = Collections.newSetFromMap(new ConcurrentHashMap<>()); protected boolean profile = false; public int test(String[] args) throws Exception { @@ -69,8 +67,8 @@ public int test(String[] args) throws Exception { int multiple = Integer.parseInt(args[2]); this.profile = Boolean.parseBoolean(args[3]); - // NOTE: this test with HugeGraph is for local, change it into - // client if test with restful server from remote + // NOTE: this test with HugeGraph is for local, + // change it into a client if test with restful server from remote HugeGraph hugegraph = ExampleUtil.loadGraph(true, this.profile); GraphManager graph = new GraphManager(hugegraph); @@ -88,24 +86,19 @@ public int test(String[] args) throws Exception { /** * Multi-threaded and multi-commits and batch insertion test - * @param graph graph - * @param threadCount - * The count of threads that perform the insert operation at the - * same time - * @param times - * The transaction commit times for each thread - * @param multiple - * The coefficient to multiple number of vertices(100) and edges(100) - * for each transaction commit - * @throws Exception execute may throw Exception + * + * @param graph graph + * @param threadCount The count of threads that perform the insert operation at the + * same time + * @param times The transaction commit times for each thread + * @param multiple The coefficient to multiple number of vertices(100) and edges(100) + * for each transaction commit + * @throws Exception execute may throw Exception */ - public void testInsertPerf(GraphManager graph, - int threadCount, - int times, - int multiple) - throws Exception { + public void testInsertPerf(GraphManager graph, int threadCount, int times, int multiple) + throws Exception { // Total vertices/edges - long n = threadCount * times * multiple; + long n = (long) threadCount * times * multiple; long vertices = (PERSON_NUM + SOFTWARE_NUM) * n; long edges = EDGE_NUM * n; @@ -115,37 +108,29 @@ public void testInsertPerf(GraphManager graph, LOG.info("Insert rate with threads: {} vertices/s & {} edges/s, " + "insert total {} vertices & {} edges, cost time: {}ms", - vertices * 1000 / cost, edges * 1000 / cost, - vertices, edges, cost); - + vertices * 1000 / cost, edges * 1000 / cost, vertices, edges, cost); graph.clearVertexCache(); } - public void testQueryVertexPerf(GraphManager graph, - int threadCount, - int times, - int multiple) - throws Exception { + public void testQueryVertexPerf(GraphManager graph, int threadCount, int times, int multiple) + throws Exception { long cost = this.execute(graph, i -> { this.testQueryVertex(graph, threadCount, i, multiple); }, threadCount); - final long size = (PERSON_NUM + SOFTWARE_NUM) * threadCount * times; + final long size = (long) (PERSON_NUM + SOFTWARE_NUM) * threadCount * times; LOG.info("Query rate with threads: {} vertices/s, " + "query total vertices {}, cost time: {}ms", size * 1000 / cost, size, cost); } - public void testQueryEdgePerf(GraphManager graph, - int threadCount, - int times, - int multiple) - throws Exception { + public void testQueryEdgePerf(GraphManager graph, int threadCount, int times, int multiple) + throws Exception { long cost = this.execute(graph, i -> { this.testQueryEdge(graph, threadCount, i, multiple); }, threadCount); - final long size = (PERSON_NUM + SOFTWARE_NUM) * threadCount * times; + final long size = (long) (PERSON_NUM + SOFTWARE_NUM) * threadCount * times; LOG.info("Query rate with threads: {} vedges/s, " + "query total vedges {}, cost time: {}ms", size * 1000 / cost, size, cost); @@ -153,8 +138,8 @@ public void testQueryEdgePerf(GraphManager graph, protected long execute(GraphManager graph, Consumer task, int threadCount) throws Exception { - CyclicBarrier startBarrier = new CyclicBarrier(threadCount + 1); - CyclicBarrier endBarrier = new CyclicBarrier(threadCount + 1); + CyclicBarrier startBarrier = new CyclicBarrier(threadCount + 1); + CyclicBarrier endBarrier = new CyclicBarrier(threadCount + 1); List threads = new ArrayList<>(threadCount); for (int i = 0; i < threadCount; i++) { int j = i; @@ -201,14 +186,9 @@ protected long execute(GraphManager graph, Consumer task, protected abstract void initSchema(SchemaManager schema); - protected abstract void testInsert(GraphManager graph, - int times, - int multiple); + protected abstract void testInsert(GraphManager graph, int times, int multiple); - protected void testQueryVertex(GraphManager graph, - int threads, - int thread, - int multiple) { + protected void testQueryVertex(GraphManager graph, int threads, int thread, int multiple) { int i = 0; int j = 0; int total = 0; @@ -230,10 +210,7 @@ protected void testQueryVertex(GraphManager graph, LOG.debug("Query vertices with thread({}): {}", thread, total); } - protected void testQueryEdge(GraphManager graph, - int threads, - int thread, - int multiple) { + protected void testQueryEdge(GraphManager graph, int threads, int thread, int multiple) { int i = 0; int j = 0; int totalV = 0; @@ -259,9 +236,8 @@ protected void testQueryEdge(GraphManager graph, } protected static class GraphManager { - private HugeGraph hugegraph; - private Cache cache = CacheManager.instance() - .cache("perf-test"); + private final HugeGraph hugegraph; + private final Cache cache = CacheManager.instance().cache("perf-test"); public GraphManager(HugeGraph hugegraph) { this.hugegraph = hugegraph; @@ -269,13 +245,11 @@ public GraphManager(HugeGraph hugegraph) { public void initEnv() { // Cost about 6s - Whitebox.invoke(this.hugegraph.getClass(), - "graphTransaction", this.hugegraph); + Whitebox.invoke(this.hugegraph.getClass(), "graphTransaction", this.hugegraph); } public void destroyEnv() { - Whitebox.invoke(this.hugegraph.getClass(), - "closeTx", this.hugegraph); + Whitebox.invoke(this.hugegraph.getClass(), "closeTx", this.hugegraph); } public Transaction tx() { diff --git a/hugegraph-example/src/main/java/org/apache/hugegraph/example/TaskExample.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/TaskExample.java similarity index 100% rename from hugegraph-example/src/main/java/org/apache/hugegraph/example/TaskExample.java rename to hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/TaskExample.java diff --git a/hugegraph-example/src/main/java/org/apache/hugegraph/example/ThreadRangePerfTest.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/ThreadRangePerfTest.java similarity index 100% rename from hugegraph-example/src/main/java/org/apache/hugegraph/example/ThreadRangePerfTest.java rename to hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/ThreadRangePerfTest.java diff --git a/hugegraph-example/src/main/resources/hugegraph.properties b/hugegraph-server/hugegraph-example/src/main/resources/hugegraph.properties similarity index 100% rename from hugegraph-example/src/main/resources/hugegraph.properties rename to hugegraph-server/hugegraph-example/src/main/resources/hugegraph.properties diff --git a/hugegraph-example/src/main/resources/log4j2.xml b/hugegraph-server/hugegraph-example/src/main/resources/log4j2.xml similarity index 100% rename from hugegraph-example/src/main/resources/log4j2.xml rename to hugegraph-server/hugegraph-example/src/main/resources/log4j2.xml diff --git a/hugegraph-hbase/pom.xml b/hugegraph-server/hugegraph-hbase/pom.xml similarity index 97% rename from hugegraph-hbase/pom.xml rename to hugegraph-server/hugegraph-hbase/pom.xml index 9c9edd3e58..d408459a2d 100644 --- a/hugegraph-hbase/pom.xml +++ b/hugegraph-server/hugegraph-hbase/pom.xml @@ -19,7 +19,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - hugegraph + hugegraph-server org.apache.hugegraph ${revision} ../pom.xml diff --git a/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseFeatures.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseFeatures.java similarity index 100% rename from hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseFeatures.java rename to hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseFeatures.java diff --git a/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseMetrics.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseMetrics.java similarity index 100% rename from hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseMetrics.java rename to hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseMetrics.java diff --git a/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseOptions.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseOptions.java similarity index 100% rename from hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseOptions.java rename to hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseOptions.java diff --git a/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSerializer.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSerializer.java similarity index 100% rename from hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSerializer.java rename to hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSerializer.java diff --git a/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSessions.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSessions.java similarity index 98% rename from hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSessions.java rename to hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSessions.java index 06cbf9ab73..6f0bf3714a 100644 --- a/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSessions.java +++ b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSessions.java @@ -415,11 +415,18 @@ default R scan(String table, Set prefixes) { /** * Scan records by rowkey start and prefix from a table + * TODO: setRowPrefixFilter deprecated since HBase 2.5.0, will be removed in 4.0.0, + * use setStartStopRowForPrefixScan(byte[]) instead. */ default R scan(String table, byte[] startRow, boolean inclusiveStart, byte[] prefix) { - Scan scan = new Scan().withStartRow(startRow, inclusiveStart) - .setFilter(new PrefixFilter(prefix)); + final Scan scan = new Scan(); + if(startRow == prefix) { + scan.setRowPrefixFilter(prefix); + } else { + scan.withStartRow(startRow, inclusiveStart) + .setFilter(new PrefixFilter(prefix)); + } return this.scan(table, scan); } diff --git a/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseStore.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseStore.java similarity index 100% rename from hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseStore.java rename to hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseStore.java diff --git a/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseStoreProvider.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseStoreProvider.java similarity index 100% rename from hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseStoreProvider.java rename to hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseStoreProvider.java diff --git a/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTable.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTable.java similarity index 100% rename from hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTable.java rename to hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTable.java diff --git a/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTables.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTables.java similarity index 100% rename from hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTables.java rename to hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTables.java diff --git a/hugegraph-mysql/pom.xml b/hugegraph-server/hugegraph-mysql/pom.xml similarity index 97% rename from hugegraph-mysql/pom.xml rename to hugegraph-server/hugegraph-mysql/pom.xml index 0b2e7824e9..ddbf721703 100644 --- a/hugegraph-mysql/pom.xml +++ b/hugegraph-server/hugegraph-mysql/pom.xml @@ -19,7 +19,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - hugegraph + hugegraph-server org.apache.hugegraph ${revision} ../pom.xml diff --git a/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlBackendEntry.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlBackendEntry.java similarity index 100% rename from hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlBackendEntry.java rename to hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlBackendEntry.java diff --git a/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java similarity index 100% rename from hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java rename to hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java diff --git a/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlFeatures.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlFeatures.java similarity index 100% rename from hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlFeatures.java rename to hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlFeatures.java diff --git a/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java similarity index 100% rename from hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java rename to hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java diff --git a/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java similarity index 100% rename from hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java rename to hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java diff --git a/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java similarity index 100% rename from hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java rename to hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java diff --git a/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java similarity index 100% rename from hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java rename to hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java diff --git a/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java similarity index 100% rename from hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java rename to hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java diff --git a/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStoreProvider.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStoreProvider.java similarity index 100% rename from hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStoreProvider.java rename to hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStoreProvider.java diff --git a/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java similarity index 100% rename from hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java rename to hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java diff --git a/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java similarity index 100% rename from hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java rename to hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java diff --git a/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlUtil.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlUtil.java similarity index 100% rename from hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlUtil.java rename to hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlUtil.java diff --git a/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/ResultSetWrapper.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/ResultSetWrapper.java similarity index 99% rename from hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/ResultSetWrapper.java rename to hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/ResultSetWrapper.java index eb98a1150a..6d4a2f0e49 100644 --- a/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/ResultSetWrapper.java +++ b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/ResultSetWrapper.java @@ -17,12 +17,12 @@ package org.apache.hugegraph.backend.store.mysql; -import org.apache.hugegraph.backend.BackendException; - import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; +import org.apache.hugegraph.backend.BackendException; + public class ResultSetWrapper implements AutoCloseable { private final ResultSet resultSet; @@ -37,6 +37,7 @@ public boolean next() throws SQLException { return !this.resultSet.isClosed() && this.resultSet.next(); } + @Override public void close() { try { if (this.resultSet != null) { diff --git a/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java similarity index 100% rename from hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java rename to hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java diff --git a/hugegraph-palo/pom.xml b/hugegraph-server/hugegraph-palo/pom.xml similarity index 97% rename from hugegraph-palo/pom.xml rename to hugegraph-server/hugegraph-palo/pom.xml index cdeba95631..a1fecc482b 100644 --- a/hugegraph-palo/pom.xml +++ b/hugegraph-server/hugegraph-palo/pom.xml @@ -19,7 +19,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - hugegraph + hugegraph-server org.apache.hugegraph ${revision} ../pom.xml diff --git a/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFeatures.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFeatures.java similarity index 100% rename from hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFeatures.java rename to hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFeatures.java diff --git a/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java similarity index 100% rename from hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java rename to hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java diff --git a/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloHttpClient.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloHttpClient.java similarity index 86% rename from hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloHttpClient.java rename to hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloHttpClient.java index 8ee2f94129..281746e2ee 100644 --- a/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloHttpClient.java +++ b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloHttpClient.java @@ -19,15 +19,15 @@ import java.util.Map; -import jakarta.ws.rs.core.MultivaluedHashMap; -import jakarta.ws.rs.core.MultivaluedMap; -import jakarta.ws.rs.core.Response; - import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.rest.AbstractRestClient; import org.apache.hugegraph.rest.RestClient; +import org.apache.hugegraph.rest.RestHeaders; + import com.google.common.collect.ImmutableMap; +import okhttp3.Response; + public class PaloHttpClient { private final RestClient client; @@ -51,8 +51,8 @@ public void bulkLoadAsync(String table, String body, String label) { // Format path String path = table + "/_load"; // Format headers - MultivaluedMap headers = new MultivaluedHashMap<>(); - headers.putSingle("Expect", "100-continue"); + RestHeaders headers = new RestHeaders(); + headers.add("Expect", "100-continue"); // Format params Map params = ImmutableMap.of("label", label); // Send request @@ -68,8 +68,7 @@ public Client(String url, String user, String password, int timeout) { } @Override - protected void checkStatus(Response response, - Response.Status... statuses) { + protected void checkStatus(Response response, int... statuses) { // pass } } diff --git a/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloLoadInfo.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloLoadInfo.java similarity index 100% rename from hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloLoadInfo.java rename to hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloLoadInfo.java diff --git a/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloOptions.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloOptions.java similarity index 100% rename from hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloOptions.java rename to hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloOptions.java diff --git a/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSerializer.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSerializer.java similarity index 100% rename from hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSerializer.java rename to hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSerializer.java diff --git a/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java similarity index 100% rename from hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java rename to hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java diff --git a/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java similarity index 100% rename from hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java rename to hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java diff --git a/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java similarity index 100% rename from hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java rename to hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java diff --git a/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java similarity index 100% rename from hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java rename to hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java diff --git a/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java similarity index 100% rename from hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java rename to hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java diff --git a/hugegraph-postgresql/pom.xml b/hugegraph-server/hugegraph-postgresql/pom.xml similarity index 95% rename from hugegraph-postgresql/pom.xml rename to hugegraph-server/hugegraph-postgresql/pom.xml index 343c226137..57c9ad840f 100644 --- a/hugegraph-postgresql/pom.xml +++ b/hugegraph-server/hugegraph-postgresql/pom.xml @@ -19,7 +19,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - hugegraph + hugegraph-server org.apache.hugegraph ${revision} ../pom.xml @@ -42,7 +42,7 @@ org.postgresql postgresql - 42.4.1 + 42.4.3 diff --git a/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlOptions.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlOptions.java similarity index 100% rename from hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlOptions.java rename to hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlOptions.java diff --git a/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java similarity index 100% rename from hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java rename to hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java diff --git a/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java similarity index 100% rename from hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java rename to hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java diff --git a/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStore.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStore.java similarity index 100% rename from hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStore.java rename to hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStore.java diff --git a/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java similarity index 100% rename from hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java rename to hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java diff --git a/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java similarity index 100% rename from hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java rename to hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java diff --git a/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java similarity index 100% rename from hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java rename to hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java diff --git a/hugegraph-rocksdb/pom.xml b/hugegraph-server/hugegraph-rocksdb/pom.xml similarity index 97% rename from hugegraph-rocksdb/pom.xml rename to hugegraph-server/hugegraph-rocksdb/pom.xml index 2c27392ba8..444e9a48a3 100644 --- a/hugegraph-rocksdb/pom.xml +++ b/hugegraph-server/hugegraph-rocksdb/pom.xml @@ -19,7 +19,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - hugegraph + hugegraph-server org.apache.hugegraph ${revision} ../pom.xml diff --git a/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/OpenedRocksDB.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/OpenedRocksDB.java similarity index 100% rename from hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/OpenedRocksDB.java rename to hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/OpenedRocksDB.java diff --git a/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBFeatures.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBFeatures.java similarity index 100% rename from hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBFeatures.java rename to hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBFeatures.java diff --git a/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBIngester.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBIngester.java similarity index 100% rename from hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBIngester.java rename to hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBIngester.java diff --git a/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBIteratorPool.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBIteratorPool.java similarity index 100% rename from hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBIteratorPool.java rename to hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBIteratorPool.java diff --git a/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBMetrics.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBMetrics.java similarity index 100% rename from hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBMetrics.java rename to hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBMetrics.java diff --git a/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBOptions.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBOptions.java similarity index 100% rename from hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBOptions.java rename to hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBOptions.java diff --git a/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBSessions.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBSessions.java similarity index 100% rename from hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBSessions.java rename to hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBSessions.java diff --git a/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java similarity index 100% rename from hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java rename to hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java diff --git a/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStore.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStore.java similarity index 99% rename from hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStore.java rename to hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStore.java index 887f2a14ff..c9a27b7705 100644 --- a/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStore.java +++ b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStore.java @@ -93,7 +93,9 @@ public abstract class RocksDBStore extends AbstractBackendStore change : table.getValue()) { - sst.put(change.getKey(), change.getValue()); - } + SstFileWriter sst = table(table.getKey()); + for (Pair change : table.getValue()) { + sst.put(change.getKey(), change.getValue()); } } } catch (RocksDBException e) { diff --git a/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstStore.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstStore.java similarity index 100% rename from hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstStore.java rename to hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstStore.java diff --git a/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstStoreProvider.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstStoreProvider.java similarity index 100% rename from hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstStoreProvider.java rename to hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstStoreProvider.java diff --git a/hugegraph-scylladb/pom.xml b/hugegraph-server/hugegraph-scylladb/pom.xml similarity index 96% rename from hugegraph-scylladb/pom.xml rename to hugegraph-server/hugegraph-scylladb/pom.xml index e7f1f6ce21..c9676808fb 100644 --- a/hugegraph-scylladb/pom.xml +++ b/hugegraph-server/hugegraph-scylladb/pom.xml @@ -19,7 +19,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - hugegraph + hugegraph-server org.apache.hugegraph ${revision} ../pom.xml diff --git a/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBFeatures.java b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBFeatures.java similarity index 100% rename from hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBFeatures.java rename to hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBFeatures.java diff --git a/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java similarity index 100% rename from hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java rename to hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java diff --git a/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java similarity index 100% rename from hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java rename to hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java diff --git a/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java similarity index 100% rename from hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java rename to hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java diff --git a/hugegraph-test/pom.xml b/hugegraph-server/hugegraph-test/pom.xml similarity index 99% rename from hugegraph-test/pom.xml rename to hugegraph-server/hugegraph-test/pom.xml index 75e8caf664..d4ba1defd0 100644 --- a/hugegraph-test/pom.xml +++ b/hugegraph-server/hugegraph-test/pom.xml @@ -19,7 +19,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - hugegraph + hugegraph-server org.apache.hugegraph ${revision} ../pom.xml diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ApiTestSuite.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ApiTestSuite.java similarity index 97% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/ApiTestSuite.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ApiTestSuite.java index a5830a4336..0eed3e7049 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ApiTestSuite.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ApiTestSuite.java @@ -18,12 +18,11 @@ package org.apache.hugegraph.api; import org.apache.hugegraph.api.traversers.TraversersApiTestSuite; +import org.apache.hugegraph.dist.RegisterUtil; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; -import org.apache.hugegraph.dist.RegisterUtil; - @RunWith(Suite.class) @Suite.SuiteClasses({ PropertyKeyApiTest.class, @@ -40,7 +39,8 @@ LoginApiTest.class, ProjectApiTest.class, TraversersApiTestSuite.class, - CypherApiTest.class + CypherApiTest.class, + ArthasApiTest.class }) public class ApiTestSuite { diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java new file mode 100644 index 0000000000..52d0d7405c --- /dev/null +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hugegraph.api; + +import org.junit.Before; +import org.junit.Test; + +import com.google.common.collect.ImmutableMap; + +import jakarta.ws.rs.core.Response; + +public class ArthasApiTest extends BaseApiTest { + + private static final String ARTHAS_START_PATH = "/arthas"; + private static final String ARTHAS_API_BASE_URL = "http://127.0.0.1:8561"; + private static final String ARTHAS_API_PATH = "/api"; + + @Before + public void testArthasStart() { + Response r = client().put(ARTHAS_START_PATH, "", "", ImmutableMap.of()); + assertResponseStatus(200, r); + } + + @Test + public void testArthasApi() { + String body = "{\n" + + " \"action\": \"exec\",\n" + + " \"command\": \"version\"\n" + + "}"; + RestClient arthasApiClient = new RestClient(ARTHAS_API_BASE_URL, false); + // If the request header contains basic auth, + // and if we are not set auth when arthas attach hg, arthas will auth it and return 401. + // ref:https://arthas.aliyun.com/en/doc/auth.html#configure-username-and-password + Response r = arthasApiClient.post(ARTHAS_API_PATH, body); + String result = assertResponseStatus(200, r); + assertJsonContains(result, "state"); + assertJsonContains(result, "body"); + + RestClient arthasApiClientWithAuth = new RestClient(ARTHAS_API_BASE_URL); + r = arthasApiClientWithAuth.post(ARTHAS_API_PATH, body); + assertResponseStatus(401, r); + } +} diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java similarity index 98% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java index 83c1dcebe0..a964a7236d 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java @@ -27,13 +27,10 @@ import java.util.function.Consumer; import java.util.stream.Collectors; -import jakarta.ws.rs.client.Client; -import jakarta.ws.rs.client.ClientBuilder; -import jakarta.ws.rs.client.Entity; -import jakarta.ws.rs.client.WebTarget; -import jakarta.ws.rs.core.MultivaluedMap; -import jakarta.ws.rs.core.Response; import org.apache.http.util.TextUtils; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.util.CollectionUtil; +import org.apache.hugegraph.util.JsonUtil; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.glassfish.jersey.client.filter.EncodingFilter; import org.glassfish.jersey.message.GZipEncoder; @@ -42,9 +39,6 @@ import org.junit.Assert; import org.junit.BeforeClass; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.util.CollectionUtil; -import org.apache.hugegraph.util.JsonUtil; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -52,6 +46,13 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Multimap; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; + public class BaseApiTest { private static final String BASE_URL = "http://127.0.0.1:8080"; @@ -104,11 +105,17 @@ public static class RestClient { private WebTarget target; public RestClient(String url) { + this(url, true); + } + + public RestClient(String url,Boolean enableAuth) { this.client = ClientBuilder.newClient(); this.client.register(EncodingFilter.class); this.client.register(GZipEncoder.class); - this.client.register(HttpAuthenticationFeature.basic(USERNAME, - PASSWORD)); + if(enableAuth) { + this.client.register(HttpAuthenticationFeature.basic(USERNAME, + PASSWORD)); + } this.target = this.client.target(url); } @@ -132,8 +139,7 @@ public Response get(String path, String id) { return this.target.path(path).path(id).request().get(); } - public Response get(String path, - MultivaluedMap headers) { + public Response get(String path, MultivaluedMap headers) { return this.target.path(path).request().headers(headers).get(); } diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/CypherApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/CypherApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/CypherApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/CypherApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeApiTest.java similarity index 92% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeApiTest.java index 98390fc0ab..b55896f564 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeApiTest.java @@ -19,17 +19,17 @@ import java.io.IOException; +import org.apache.hugegraph.testutil.Assert; import org.junit.Before; import org.junit.Test; -import org.apache.hugegraph.testutil.Assert; import com.google.common.collect.ImmutableMap; import jakarta.ws.rs.core.Response; public class EdgeApiTest extends BaseApiTest { - private static String path = "/graphs/hugegraph/graph/edges/"; + private static final String PATH = "/graphs/hugegraph/graph/edges/"; @Before public void prepareSchema() { @@ -54,7 +54,7 @@ public void testCreate() throws IOException { "\"date\": \"20170324\"," + "\"weight\": 0.5}" + "}", outVId, inVId); - Response r = client().post(path, edge); + Response r = client().post(PATH, edge); assertResponseStatus(201, r); } @@ -73,7 +73,7 @@ public void testBatchUpdate() throws IOException { "\"date\": \"2013-02-20\"," + "\"weight\": 1.0}" + "}", outVId, inVId); - Response r = client().post(path, edge); + Response r = client().post(PATH, edge); // The edge id is 'S1:marko>1>7JooBil0>S1:josh' String content = assertResponseStatus(201, r); String edgeId = parseId(content); @@ -101,7 +101,7 @@ public void testBatchUpdate() throws IOException { "\"check_vertex\":false," + "\"create_if_not_exist\":true" + "}", edgeId, outVId, inVId); - r = client().put(path, "batch", edge, ImmutableMap.of()); + r = client().put(PATH, "batch", edge, ImmutableMap.of()); // Now allowed to modify sortkey values, the property 'date' has changed content = assertResponseStatus(400, r); Assert.assertTrue(content.contains( @@ -130,7 +130,7 @@ public void testBatchUpdate() throws IOException { "\"check_vertex\":false," + "\"create_if_not_exist\":true" + "}", outVId, inVId); - r = client().put(path, "batch", edge, ImmutableMap.of()); + r = client().put(PATH, "batch", edge, ImmutableMap.of()); // Add a new edge when sortkey value has changed content = assertResponseStatus(200, r); String newEdgeId = parseId(content); @@ -152,11 +152,11 @@ public void testGet() throws IOException { "\"date\": \"20170324\"," + "\"weight\": 0.5}" + "}", outVId, inVId); - Response r = client().post(path, edge); + Response r = client().post(PATH, edge); String content = assertResponseStatus(201, r); String id = parseId(content); - r = client().get(path, id); + r = client().get(PATH, id); assertResponseStatus(200, r); } @@ -175,10 +175,10 @@ public void testList() throws IOException { "\"date\": \"20170324\"," + "\"weight\": 0.5}" + "}", outVId, inVId); - Response r = client().post(path, edge); + Response r = client().post(PATH, edge); assertResponseStatus(201, r); - r = client().get(path); + r = client().get(PATH); assertResponseStatus(200, r); } @@ -197,11 +197,11 @@ public void testDelete() throws IOException { "\"date\": \"20170324\"," + "\"weight\": 0.5}" + "}", outVId, inVId); - Response r = client().post(path, edge); + Response r = client().post(PATH, edge); String content = assertResponseStatus(201, r); String id = parseId(content); - r = client().delete(path, id); + r = client().delete(PATH, id); assertResponseStatus(204, r); } } diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeLabelApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeLabelApiTest.java similarity index 89% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeLabelApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeLabelApiTest.java index b03a435086..2cd1b5ede4 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeLabelApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeLabelApiTest.java @@ -19,15 +19,16 @@ import java.util.Map; -import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; import com.google.common.collect.ImmutableMap; +import jakarta.ws.rs.core.Response; + public class EdgeLabelApiTest extends BaseApiTest { - private static String path = "/graphs/hugegraph/schema/edgelabels/"; + private static final String PATH = "/graphs/hugegraph/schema/edgelabels/"; @Before public void prepareSchema() { @@ -46,7 +47,7 @@ public void testCreate() { "\"nullable_keys\":[\"city\"]," + "\"sort_keys\":[]" + "}"; - Response r = client().post(path, edgeLabel); + Response r = client().post(PATH, edgeLabel); assertResponseStatus(201, r); } @@ -61,7 +62,7 @@ public void testAppend() { "\"nullable_keys\":[\"city\"]," + "\"sort_keys\":[]" + "}"; - Response r = client().post(path, edgeLabel); + Response r = client().post(PATH, edgeLabel); assertResponseStatus(201, r); edgeLabel = "{" + @@ -74,7 +75,7 @@ public void testAppend() { "\"sort_keys\":[]" + "}"; Map params = ImmutableMap.of("action", "append"); - r = client().put(path, "created", edgeLabel, params); + r = client().put(PATH, "created", edgeLabel, params); assertResponseStatus(200, r); } @@ -89,11 +90,11 @@ public void testGet() { "\"nullable_keys\":[\"city\"]," + "\"sort_keys\":[]" + "}"; - Response r = client().post(path, edgeLabel); + Response r = client().post(PATH, edgeLabel); assertResponseStatus(201, r); String name = "created"; - r = client().get(path, name); + r = client().get(PATH, name); assertResponseStatus(200, r); } @@ -108,10 +109,10 @@ public void testList() { "\"nullable_keys\":[\"city\"]," + "\"sort_keys\":[]" + "}"; - Response r = client().post(path, edgeLabel); + Response r = client().post(PATH, edgeLabel); assertResponseStatus(201, r); - r = client().get(path); + r = client().get(PATH); assertResponseStatus(200, r); } @@ -126,11 +127,11 @@ public void testDelete() { "\"nullable_keys\":[\"city\"]," + "\"sort_keys\":[]" + "}"; - Response r = client().post(path, edgeLabel); + Response r = client().post(PATH, edgeLabel); assertResponseStatus(201, r); String name = "created"; - r = client().delete(path, name); + r = client().delete(PATH, name); String content = assertResponseStatus(202, r); int task = assertJsonContains(content, "task_id"); waitTaskSuccess(task); diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/GremlinApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/GremlinApiTest.java similarity index 99% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/GremlinApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/GremlinApiTest.java index 57aefeb9be..b065270871 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/GremlinApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/GremlinApiTest.java @@ -121,7 +121,7 @@ public void testClearAndInit() { body = "{" + "\"gremlin\":\"hugegraph.serverStarted(" + - " IdGenerator.of('server1'), NodeRole.MASTER)\"," + + " GlobalMasterInfo.master('server1'))\"," + "\"bindings\":{}," + "\"language\":\"gremlin-groovy\"," + "\"aliases\":{\"g\":\"__g_hugegraph\"}}"; diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/IndexLabelApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/IndexLabelApiTest.java similarity index 87% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/IndexLabelApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/IndexLabelApiTest.java index 68920c177d..b3eb89eb14 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/IndexLabelApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/IndexLabelApiTest.java @@ -19,15 +19,16 @@ import java.util.Map; -import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; import com.google.common.collect.ImmutableMap; +import jakarta.ws.rs.core.Response; + public class IndexLabelApiTest extends BaseApiTest { - private static String path = "/graphs/hugegraph/schema/indexlabels/"; + private static final String PATH = "/graphs/hugegraph/schema/indexlabels/"; @Before public void prepareSchema() { @@ -45,7 +46,7 @@ public void testCreate() { "\"index_type\": \"RANGE\"," + "\"fields\":[\"age\"]" + "}"; - Response r = client().post(path, indexLabel); + Response r = client().post(PATH, indexLabel); assertResponseStatus(202, r); } @@ -59,7 +60,7 @@ public void testAppend() { "\"fields\":[\"age\"]" + "}"; - Response r = client().post(path, indexLabel); + Response r = client().post(PATH, indexLabel); assertResponseStatus(202, r); indexLabel = "{" + @@ -70,7 +71,7 @@ public void testAppend() { "}" + "}"; Map params = ImmutableMap.of("action", "append"); - r = client().put(path, "personByAge", indexLabel, params); + r = client().put(PATH, "personByAge", indexLabel, params); assertResponseStatus(200, r); } @@ -87,7 +88,7 @@ public void testEliminate() { "\"max\": 100" + "}" + "}"; - Response r = client().post(path, indexLabel); + Response r = client().post(PATH, indexLabel); assertResponseStatus(202, r); indexLabel = "{" + @@ -97,7 +98,7 @@ public void testEliminate() { "}" + "}"; Map params = ImmutableMap.of("action", "eliminate"); - r = client().put(path, "personByAge", indexLabel, params); + r = client().put(PATH, "personByAge", indexLabel, params); assertResponseStatus(200, r); } @@ -110,11 +111,11 @@ public void testGet() { "\"index_type\": \"RANGE\"," + "\"fields\":[\"age\"]" + "}"; - Response r = client().post(path, indexLabel); + Response r = client().post(PATH, indexLabel); assertResponseStatus(202, r); String name = "personByAge"; - r = client().get(path, name); + r = client().get(PATH, name); assertResponseStatus(200, r); } @@ -127,10 +128,10 @@ public void testList() { "\"index_type\": \"RANGE\"," + "\"fields\":[\"age\"]" + "}"; - Response r = client().post(path, indexLabel); + Response r = client().post(PATH, indexLabel); assertResponseStatus(202, r); - r = client().get(path); + r = client().get(PATH); assertResponseStatus(200, r); } @@ -143,11 +144,11 @@ public void testDelete() { "\"index_type\": \"RANGE\"," + "\"fields\":[\"age\"]" + "}"; - Response r = client().post(path, indexLabel); + Response r = client().post(PATH, indexLabel); assertResponseStatus(202, r); String name = "personByAge"; - r = client().delete(path, name); + r = client().delete(PATH, name); String content = assertResponseStatus(202, r); int task = assertJsonContains(content, "task_id"); waitTaskSuccess(task); diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/LoginApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/LoginApiTest.java similarity index 88% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/LoginApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/LoginApiTest.java index 40c83d5115..30775cb729 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/LoginApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/LoginApiTest.java @@ -20,18 +20,18 @@ import java.nio.file.Paths; import java.util.Map; -import jakarta.ws.rs.core.GenericType; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MultivaluedHashMap; -import jakarta.ws.rs.core.MultivaluedMap; -import jakarta.ws.rs.core.Response; +import org.apache.hugegraph.testutil.Assert; +import org.apache.hugegraph.util.JsonUtil; import org.apache.tinkerpop.shaded.jackson.core.type.TypeReference; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.apache.hugegraph.testutil.Assert; -import org.apache.hugegraph.util.JsonUtil; +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MultivaluedHashMap; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; public class LoginApiTest extends BaseApiTest { @@ -42,8 +42,7 @@ public class LoginApiTest extends BaseApiTest { @Before public void setup() { Response r = this.createUser("test", "test"); - Map user = r.readEntity( - new GenericType>(){}); + Map user = r.readEntity(new GenericType>(){}); this.userId4Test = (String) user.get("id"); } @@ -115,9 +114,8 @@ public void testVerify() { assertJsonContains(result, "user_id"); assertJsonContains(result, "user_name"); - Map user = JsonUtil.fromJson( - result, - new TypeReference>(){}); + Map user = JsonUtil.fromJson(result, + new TypeReference>(){}); Assert.assertEquals(this.userId4Test, user.get("user_id")); Assert.assertEquals("test", user.get("user_name")); @@ -142,8 +140,7 @@ private Response createUser(String name, String password) { "\",\"user_email\":\"user1@baidu.com\"," + "\"user_phone\":\"123456789\",\"user_avatar\":\"image1" + ".jpg\"}"; - return this.client().post(USER_PATH, - String.format(user, name, password)); + return this.client().post(USER_PATH, String.format(user, name, password)); } private Response deleteUser(String id) { @@ -155,14 +152,12 @@ private Response login(String name, String password) { String loginUser = "{\"user_name\":\"%s\"," + "\"user_password\":\"%s\"}"; - return client().post(login, String.format(loginUser, - name, password)); + return client().post(login, String.format(loginUser, name, password)); } private String tokenFromResponse(String content) { - Map data = JsonUtil.fromJson( - content, - new TypeReference>(){}); + Map data = JsonUtil.fromJson(content, + new TypeReference>(){}); return (String) data.get("token"); } } diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java similarity index 88% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java index 499103c174..86759483c2 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java @@ -17,20 +17,24 @@ package org.apache.hugegraph.api; +import java.util.HashMap; import java.util.Map; -import jakarta.ws.rs.core.Response; +import org.apache.hugegraph.testutil.Assert; import org.junit.Test; -import org.apache.hugegraph.testutil.Assert; +import jakarta.ws.rs.core.Response; public class MetricsApiTest extends BaseApiTest { - private static String path = "/metrics"; + private static final String PATH = "/metrics"; + private static final String STATISTICS_PATH = PATH + "/statistics"; @Test - public void testMetricsAll() { - Response r = client().get(path); + public void testBaseMetricsAll() { + Map params = new HashMap<>(); + params.put("type", "json"); + Response r = client().get(PATH, params); String result = assertResponseStatus(200, r); assertJsonContains(result, "gauges"); assertJsonContains(result, "counters"); @@ -39,9 +43,29 @@ public void testMetricsAll() { assertJsonContains(result, "timers"); } + @Test + public void testBaseMetricsPromAll() { + Response r = client().get(PATH); + assertResponseStatus(200, r); + } + + @Test + public void testStatisticsMetricsAll() { + Map params = new HashMap<>(); + params.put("type", "json"); + Response r = client().get(PATH); + assertResponseStatus(200, r); + } + + @Test + public void testStatisticsMetricsPromAll() { + Response r = client().get(STATISTICS_PATH); + assertResponseStatus(200, r); + } + @Test public void testMetricsSystem() { - Response r = client().get(path, "system"); + Response r = client().get(PATH, "system"); String result = assertResponseStatus(200, r); assertJsonContains(result, "basic"); assertJsonContains(result, "heap"); @@ -53,7 +77,7 @@ public void testMetricsSystem() { @Test public void testMetricsBackend() { - Response r = client().get(path, "backend"); + Response r = client().get(PATH, "backend"); String result = assertResponseStatus(200, r); Object value = assertJsonContains(result, "hugegraph"); @@ -101,10 +125,8 @@ public void testMetricsBackend() { for (Map.Entry e : servers.entrySet()) { String key = (String) e.getKey(); value = e.getValue(); - Assert.assertTrue(String.format( - "Expect map value for key %s but got %s", - key, value), - value instanceof Map); + Assert.assertTrue(String.format("Expect map value for key %s but got %s", + key, value), value instanceof Map); host = (Map) value; assertMapContains(host, "mem_max"); assertMapContains(host, "mem_committed"); @@ -164,10 +186,8 @@ public void testMetricsBackend() { for (Map.Entry e : servers.entrySet()) { String key = (String) e.getKey(); value = e.getValue(); - Assert.assertTrue(String.format( - "Expect map value for key %s but got %s", - key, value), - value instanceof Map); + Assert.assertTrue(String.format("Expect map value for key %s but got %s", + key, value), value instanceof Map); host = (Map) value; assertMapContains(host, "mem_max"); assertMapContains(host, "mem_committed"); @@ -233,10 +253,8 @@ public void testMetricsBackend() { for (Map.Entry e : servers.entrySet()) { String key = (String) e.getKey(); value = e.getValue(); - Assert.assertTrue(String.format( - "Expect map value for key %s but got %s", - key, value), - value instanceof Map); + Assert.assertTrue(String.format("Expect map value for key %s but got %s", + key, value), value instanceof Map); Map regionServer = (Map) value; assertMapContains(regionServer, "mem_max"); assertMapContains(regionServer, "mem_used"); @@ -251,8 +269,7 @@ public void testMetricsBackend() { assertMapContains(regionServer, "request_count_per_second"); assertMapContains(regionServer, "coprocessor_names"); - Map regions = assertMapContains(regionServer, - "regions"); + Map regions = assertMapContains(regionServer, "regions"); Assert.assertGte(1, regions.size()); for (Map.Entry e2 : regions.entrySet()) { Map region = (Map) e2.getValue(); @@ -283,7 +300,7 @@ public void testMetricsBackend() { } break; default: - Assert.assertTrue("Unexpected backend " + backend, false); + Assert.fail("Unexpected backend " + backend); break; } } diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ProjectApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ProjectApiTest.java similarity index 82% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/ProjectApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ProjectApiTest.java index 3f4239dfc6..b93b38f6b1 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ProjectApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ProjectApiTest.java @@ -20,17 +20,18 @@ import java.util.List; import java.util.Map; -import jakarta.ws.rs.client.Entity; -import jakarta.ws.rs.core.Response; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; +import org.apache.hugegraph.util.JsonUtil; import org.junit.After; import org.junit.Assert; import org.junit.Test; -import org.apache.hugegraph.util.JsonUtil; import com.google.common.collect.ImmutableMap; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.Response; + public class ProjectApiTest extends BaseApiTest { private static final String PATH = "graphs/hugegraph/auth/projects"; @@ -45,11 +46,10 @@ public void teardown() throws Exception { @SuppressWarnings("unchecked") Map projectMap = ((Map) project); String projectId = (String) projectMap.get("id"); - // remove graphs from project if needed + // remove graphs from a project if needed List projectGraphs = (List) projectMap.get("project_graphs"); - if (projectGraphs != null && projectGraphs.size() > 0) { - Map graphs = ImmutableMap.of("project_graphs", - projectGraphs); + if (projectGraphs != null && !projectGraphs.isEmpty()) { + Map graphs = ImmutableMap.of("project_graphs", projectGraphs); resp = client().target() .path(PATH) .path(projectId) @@ -70,30 +70,26 @@ public void teardown() throws Exception { @Test public void testCreate() { - String project = String.format("{\"project_name\": \"test_project\"," + - "\"project_description\": " + - "\"this is a good project\"}"); + String project = "{\"project_name\": \"test_project\"," + + "\"project_description\": " + + "\"this is a good project\"}"; Response resp = client().post(PATH, project); String respBody = assertResponseStatus(201, resp); String projectName = assertJsonContains(respBody, "project_name"); Assert.assertEquals("test_project", projectName); - String projectDescription = assertJsonContains(respBody, - "project_description"); + String projectDescription = assertJsonContains(respBody, "project_description"); Assert.assertEquals("this is a good project", projectDescription); String projectTarget = assertJsonContains(respBody, "project_target"); Assert.assertFalse(StringUtils.isEmpty(projectTarget)); - String projectAdminGroup = assertJsonContains(respBody, - "project_admin_group"); + String projectAdminGroup = assertJsonContains(respBody, "project_admin_group"); Assert.assertFalse(StringUtils.isEmpty(projectAdminGroup)); - String projectOpGroup = assertJsonContains(respBody, - "project_op_group"); + String projectOpGroup = assertJsonContains(respBody, "project_op_group"); Assert.assertFalse(StringUtils.isEmpty(projectOpGroup)); } @Test public void testDelete() { - String project = this.createProject("test_project1", - "this is a good project"); + String project = this.createProject("test_project1", "this is a good project"); String projectId = assertJsonContains(project, "id"); Response resp = client().target() .path(PATH) @@ -105,8 +101,7 @@ public void testDelete() { @Test public void testGet() { - String project = this.createProject("test_project", - "this is a good project"); + String project = this.createProject("test_project", "this is a good project"); String projectId = assertJsonContains(project, "id"); String project2 = this.getProject(projectId); Assert.assertEquals(project, project2); @@ -133,17 +128,14 @@ public void testUpdate() { .put(Entity.json(project)); assertResponseStatus(400, resp); - String projectId = assertJsonContains(createProject("test_project", - "desc"), - "id"); + String projectId = assertJsonContains(createProject("test_project", "desc"), "id"); resp = client().target() .path(PATH) .path(projectId) .request() .put(Entity.json(project)); String respBody = assertResponseStatus(200, resp); - String description = assertJsonContains(respBody, - "project_description"); + String description = assertJsonContains(respBody, "project_description"); Assert.assertEquals("update desc", description); } @@ -170,8 +162,7 @@ public void testAddGraphs() { @Test public void testRemoveGraphs() { - String projectId = this.createProjectAndAddGraph("project_test", - "graph_test"); + String projectId = this.createProjectAndAddGraph("project_test", "graph_test"); String graphs = "{\"project_graphs\":[\"graph_test\"]}"; Response resp = client().target() .path(PATH) @@ -215,18 +206,16 @@ private String createProject(String name, String desc) { Assert.assertEquals(desc, description); } Assert.assertFalse(StringUtils.isEmpty( - assertJsonContains(respBody, "project_target"))); + assertJsonContains(respBody, "project_target"))); Assert.assertFalse(StringUtils.isEmpty( - assertJsonContains(respBody, "project_admin_group"))); + assertJsonContains(respBody, "project_admin_group"))); Assert.assertFalse(StringUtils.isEmpty( - assertJsonContains(respBody, "project_op_group"))); + assertJsonContains(respBody, "project_op_group"))); return respBody; } - private String createProjectAndAddGraph(String projectName, - String graph) { - String projectId = assertJsonContains(createProject(projectName, null), - "id"); + private String createProjectAndAddGraph(String projectName, String graph) { + String projectId = assertJsonContains(createProject(projectName, null), "id"); this.addGraphsToProject(projectId, graph); return projectId; } @@ -237,8 +226,7 @@ private void addGraphsToProject(String projectId, String... graphNames) { for (int i = 0; i < graphNames.length - 1; i++) { graphNamesBuilder.append(String.format("\"%s\",", graphNames[i])); } - graphNamesBuilder.append(String.format("\"%s\"", - graphNames[graphNames.length - 1])); + graphNamesBuilder.append(String.format("\"%s\"", graphNames[graphNames.length - 1])); String graphs = String.format("{\"project_graphs\":[%s]}", graphNamesBuilder); Response resp = client().target() @@ -256,7 +244,6 @@ private String getProject(String projectId) { .path(projectId) .request() .get(); - String respBody = assertResponseStatus(200, resp); - return respBody; + return assertResponseStatus(200, resp); } } diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/PropertyKeyApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/PropertyKeyApiTest.java similarity index 85% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/PropertyKeyApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/PropertyKeyApiTest.java index 914c58f60a..9cb715b018 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/PropertyKeyApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/PropertyKeyApiTest.java @@ -17,14 +17,14 @@ package org.apache.hugegraph.api; -import jakarta.ws.rs.core.Response; +import org.apache.hugegraph.testutil.Assert; import org.junit.Test; -import org.apache.hugegraph.testutil.Assert; +import jakarta.ws.rs.core.Response; public class PropertyKeyApiTest extends BaseApiTest { - private static String path = "/graphs/hugegraph/schema/propertykeys/"; + private static final String PATH = "/graphs/hugegraph/schema/propertykeys/"; @Test public void testCreate() { @@ -34,7 +34,7 @@ public void testCreate() { "\"cardinality\": \"SINGLE\"," + "\"properties\":[]" + "}"; - Response r = client().post(path, propertyKey); + Response r = client().post(PATH, propertyKey); assertResponseStatus(202, r); } @@ -46,11 +46,11 @@ public void testGet() { "\"cardinality\": \"SINGLE\"," + "\"properties\":[]" + "}"; - Response r = client().post(path, propertyKey); + Response r = client().post(PATH, propertyKey); assertResponseStatus(202, r); String name = "id"; - r = client().get(path, name); + r = client().get(PATH, name); assertResponseStatus(200, r); } @@ -62,10 +62,10 @@ public void testList() { "\"cardinality\": \"SINGLE\"," + "\"properties\":[]" + "}"; - Response r = client().post(path, propertyKey); + Response r = client().post(PATH, propertyKey); assertResponseStatus(202, r); - r = client().get(path); + r = client().get(PATH); assertResponseStatus(200, r); } @@ -77,11 +77,11 @@ public void testDelete() { "\"cardinality\": \"SINGLE\"," + "\"properties\":[]" + "}"; - Response r = client().post(path, propertyKey); + Response r = client().post(PATH, propertyKey); assertResponseStatus(202, r); String name = "id"; - r = client().delete(path, name); + r = client().delete(PATH, name); String content = assertResponseStatus(202, r); int task = assertJsonContains(content, "task_id"); Assert.assertEquals(0, task); diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/SchemaApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/SchemaApiTest.java similarity index 92% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/SchemaApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/SchemaApiTest.java index 370facea77..7d701eed59 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/SchemaApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/SchemaApiTest.java @@ -17,16 +17,17 @@ package org.apache.hugegraph.api; -import jakarta.ws.rs.core.Response; import org.junit.Test; +import jakarta.ws.rs.core.Response; + public class SchemaApiTest extends BaseApiTest { - private static String path = "/graphs/hugegraph/schema"; + private static final String PATH = "/graphs/hugegraph/schema"; @Test public void testGet() { - Response r = client().get(path); + Response r = client().get(PATH); String content = assertResponseStatus(200, r); assertJsonContains(content, "propertykeys"); diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/TaskApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/TaskApiTest.java similarity index 84% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/TaskApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/TaskApiTest.java index 57659f6771..968a5d1c82 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/TaskApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/TaskApiTest.java @@ -20,16 +20,17 @@ import java.util.List; import java.util.Map; -import com.google.common.collect.ImmutableMap; -import jakarta.ws.rs.core.Response; +import org.apache.hugegraph.testutil.Assert; import org.junit.Before; import org.junit.Test; -import org.apache.hugegraph.testutil.Assert; +import com.google.common.collect.ImmutableMap; + +import jakarta.ws.rs.core.Response; public class TaskApiTest extends BaseApiTest { - private static String path = "/graphs/hugegraph/tasks/"; + private static final String PATH = "/graphs/hugegraph/tasks/"; @Before public void prepareSchema() { @@ -43,14 +44,14 @@ public void testList() { // create a task int taskId = this.rebuild(); - Response r = client().get(path, ImmutableMap.of("limit", -1)); + Response r = client().get(PATH, ImmutableMap.of("limit", -1)); String content = assertResponseStatus(200, r); List> tasks = assertJsonContains(content, "tasks"); assertArrayContains(tasks, "id", taskId); waitTaskSuccess(taskId); - r = client().get(path, String.valueOf(taskId)); + r = client().get(PATH, String.valueOf(taskId)); content = assertResponseStatus(200, r); String status = assertJsonContains(content, "task_status"); Assert.assertEquals("success", status); @@ -62,11 +63,10 @@ public void testList() { * NOTE: seems the master node won't store task status in memory, * because only worker nodes store task status in memory. */ - r = client().get(path, ImmutableMap.of("status", "RUNNING")); + r = client().get(PATH, ImmutableMap.of("status", "RUNNING")); content = assertResponseStatus(200, r); tasks = assertJsonContains(content, "tasks"); - String message = String.format("Expect none RUNNING tasks(%d), " + - "but got %s", taskId, tasks); + String message = String.format("Expect none RUNNING tasks(%d), but got %s", taskId, tasks); Assert.assertTrue(message, tasks.isEmpty()); } @@ -75,13 +75,13 @@ public void testGet() { // create a task int taskId = this.rebuild(); - Response r = client().get(path, String.valueOf(taskId)); + Response r = client().get(PATH, String.valueOf(taskId)); String content = assertResponseStatus(200, r); assertJsonContains(content, "id"); waitTaskSuccess(taskId); - r = client().get(path, String.valueOf(taskId)); + r = client().get(PATH, String.valueOf(taskId)); content = assertResponseStatus(200, r); String status = assertJsonContains(content, "task_status"); Assert.assertEquals("success", status); @@ -96,27 +96,25 @@ public void testCancel() { // cancel task Map params = ImmutableMap.of("action", "cancel"); - Response r = client().put(path, String.valueOf(taskId), "", params); + Response r = client().put(PATH, String.valueOf(taskId), "", params); String content = r.readEntity(String.class); Assert.assertTrue(content, r.getStatus() == 202 || r.getStatus() == 400); if (r.getStatus() == 202) { String status = assertJsonContains(content, "task_status"); - Assert.assertTrue(status, status.equals("cancelling") || - status.equals("cancelled")); + Assert.assertTrue(status, "cancelling".equals(status) || "cancelled".equals(status)); /* * NOTE: should be waitTaskStatus(taskId, "cancelled"), but worker - * node may ignore the CANCELLING status due to now we can't atomic + * node may ignore the CANCELLING status due to now we can't atomically * update task status, and then the task is running to SUCCESS. */ waitTaskCompleted(taskId); } else { assert r.getStatus() == 400; - String error = String.format( - "Can't cancel task '%s' which is completed", taskId); + String error = String.format("Can't cancel task '%s' which is completed", taskId); Assert.assertContains(error, content); - r = client().get(path, String.valueOf(taskId)); + r = client().get(PATH, String.valueOf(taskId)); content = assertResponseStatus(200, r); String status = assertJsonContains(content, "task_status"); Assert.assertEquals("success", status); @@ -130,7 +128,7 @@ public void testDelete() { waitTaskSuccess(taskId); // delete task - Response r = client().delete(path, String.valueOf(taskId)); + Response r = client().delete(PATH, String.valueOf(taskId)); assertResponseStatus(204, r); } diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/UserApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/UserApiTest.java similarity index 90% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/UserApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/UserApiTest.java index e2759b6368..ff457242b0 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/UserApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/UserApiTest.java @@ -20,16 +20,17 @@ import java.util.List; import java.util.Map; -import jakarta.ws.rs.core.Response; +import org.apache.hugegraph.util.JsonUtil; import org.apache.tinkerpop.shaded.jackson.core.type.TypeReference; import org.hamcrest.CoreMatchers; import org.junit.After; import org.junit.Assert; import org.junit.Test; -import org.apache.hugegraph.util.JsonUtil; import com.google.common.collect.ImmutableMap; +import jakarta.ws.rs.core.Response; + public class UserApiTest extends BaseApiTest { private static final String PATH = "graphs/hugegraph/auth/users"; @@ -39,16 +40,14 @@ public class UserApiTest extends BaseApiTest { @After public void teardown() throws Exception { super.teardown(); - Response r = this.client().get(PATH, - ImmutableMap.of("limit", NO_LIMIT)); + Response r = this.client().get(PATH, ImmutableMap.of("limit", NO_LIMIT)); String result = r.readEntity(String.class); Map>> resultMap = - JsonUtil.fromJson(result, - new TypeReference>>>() {}); + JsonUtil.fromJson(result, + new TypeReference>>>() {}); List> users = resultMap.get("users"); for (Map user : users) { - if (user.get("user_name").equals("admin")) { + if ("admin".equals(user.get("user_name"))) { continue; } this.client().delete(PATH, (String) user.get("id")); @@ -124,7 +123,7 @@ public void testUpdate() { createUser("test2"); List> users = listUsers(); for (Map user : users) { - if (user.get("user_name").equals("admin")) { + if ("admin".equals(user.get("user_name"))) { continue; } String user1 = "{\"user_password\":\"p1\"," + @@ -146,7 +145,7 @@ public void testDelete() { List> users = listUsers(); for (Map user : users) { - if (user.get("user_name").equals("admin")) { + if ("admin".equals(user.get("user_name"))) { continue; } Response r = client().delete(PATH, (String) user.get("id")); @@ -169,13 +168,12 @@ protected void createUser(String name) { } protected List> listUsers() { - Response r = this.client().get(PATH, ImmutableMap.of("limit", - NO_LIMIT)); + Response r = this.client().get(PATH, ImmutableMap.of("limit", NO_LIMIT)); String result = assertResponseStatus(200, r); Map>> resultMap = - JsonUtil.fromJson(result, new TypeReference>>>() {}); + JsonUtil.fromJson(result, + new TypeReference>>>() {}); return resultMap.get("users"); } } diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexApiTest.java similarity index 87% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexApiTest.java index a24f6cd167..aa93354fe0 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexApiTest.java @@ -19,13 +19,14 @@ import java.io.IOException; -import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; +import jakarta.ws.rs.core.Response; + public class VertexApiTest extends BaseApiTest { - private static String path = "/graphs/hugegraph/graph/vertices/"; + private static final String PATH = "/graphs/hugegraph/graph/vertices/"; @Before public void prepareSchema() { @@ -42,7 +43,7 @@ public void testCreate() { "\"city\":\"Beijing\"," + "\"age\":19}" + "}"; - Response r = client().post(path, vertex); + Response r = client().post(PATH, vertex); assertResponseStatus(201, r); } @@ -55,12 +56,12 @@ public void testGet() throws IOException { "\"city\":\"Beijing\"," + "\"age\":19}" + "}"; - Response r = client().post(path, vertex); + Response r = client().post(PATH, vertex); String content = assertResponseStatus(201, r); String id = parseId(content); id = String.format("\"%s\"", id); - r = client().get(path, id); + r = client().get(PATH, id); assertResponseStatus(200, r); } @@ -73,10 +74,10 @@ public void testList() { "\"city\":\"Beijing\"," + "\"age\":19}" + "}"; - Response r = client().post(path, vertex); + Response r = client().post(PATH, vertex); assertResponseStatus(201, r); - r = client().get(path); + r = client().get(PATH); assertResponseStatus(200, r); } @@ -89,12 +90,12 @@ public void testDelete() throws IOException { "\"city\":\"Beijing\"," + "\"age\":19}" + "}"; - Response r = client().post(path, vertex); + Response r = client().post(PATH, vertex); String content = assertResponseStatus(201, r); String id = parseId(content); id = String.format("\"%s\"", id); - r = client().delete(path, id); + r = client().delete(PATH, id); assertResponseStatus(204, r); } } diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexLabelApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexLabelApiTest.java similarity index 87% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexLabelApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexLabelApiTest.java index 3746deaece..a0fa10d5be 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexLabelApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexLabelApiTest.java @@ -19,15 +19,16 @@ import java.util.Map; -import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; import com.google.common.collect.ImmutableMap; +import jakarta.ws.rs.core.Response; + public class VertexLabelApiTest extends BaseApiTest { - private static String path = "/graphs/hugegraph/schema/vertexlabels/"; + private static final String PATH = "/graphs/hugegraph/schema/vertexlabels/"; @Before public void prepareSchema() { @@ -43,7 +44,7 @@ public void testCreate() { "\"primary_keys\":[\"name\"]," + "\"nullable_keys\":[\"city\"]" + "}"; - Response r = client().post(path, vertexLabel); + Response r = client().post(PATH, vertexLabel); assertResponseStatus(201, r); } @@ -56,7 +57,7 @@ public void testAppend() { "\"primary_keys\":[\"name\"]," + "\"nullable_keys\":[\"city\"]" + "}"; - Response r = client().post(path, vertexLabel); + Response r = client().post(PATH, vertexLabel); assertResponseStatus(201, r); vertexLabel = "{" + @@ -67,7 +68,7 @@ public void testAppend() { "\"nullable_keys\":[\"lang\"]" + "}"; Map params = ImmutableMap.of("action", "append"); - r = client().put(path, "person", vertexLabel, params); + r = client().put(PATH, "person", vertexLabel, params); assertResponseStatus(200, r); } @@ -80,11 +81,11 @@ public void testGet() { "\"primary_keys\":[\"name\"]," + "\"nullable_keys\":[\"city\"]" + "}"; - Response r = client().post(path, vertexLabel); + Response r = client().post(PATH, vertexLabel); assertResponseStatus(201, r); String name = "person"; - r = client().get(path, name); + r = client().get(PATH, name); assertResponseStatus(200, r); } @@ -97,10 +98,10 @@ public void testList() { "\"primary_keys\":[\"name\"]," + "\"nullable_keys\":[\"city\"]" + "}"; - Response r = client().post(path, vertexLabel); + Response r = client().post(PATH, vertexLabel); assertResponseStatus(201, r); - r = client().get(path); + r = client().get(PATH); assertResponseStatus(200, r); } @@ -113,11 +114,11 @@ public void testDelete() { "\"primary_keys\":[\"name\"]," + "\"nullable_keys\":[\"city\"]" + "}"; - Response r = client().post(path, vertexLabel); + Response r = client().post(PATH, vertexLabel); assertResponseStatus(201, r); String name = "person"; - r = client().delete(path, name); + r = client().delete(PATH, name); String content = assertResponseStatus(202, r); int task = assertJsonContains(content, "task_id"); waitTaskSuccess(task); diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPITest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPITest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPITest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPITest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AllShortestPathsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AllShortestPathsApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AllShortestPathsApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AllShortestPathsApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CountApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CountApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CountApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CountApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CrosspointsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CrosspointsApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CrosspointsApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CrosspointsApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/EdgesApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/EdgesApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/EdgesApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/EdgesApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/FusiformSimilarityApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/FusiformSimilarityApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/FusiformSimilarityApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/FusiformSimilarityApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/JaccardSimilarityApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/JaccardSimilarityApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/JaccardSimilarityApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/JaccardSimilarityApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/KneighborApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/KneighborApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/KneighborApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/KneighborApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/KoutApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/KoutApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/KoutApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/KoutApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PathsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PathsApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PathsApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PathsApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/RaysApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/RaysApiTest.java similarity index 93% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/RaysApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/RaysApiTest.java index c0156ebad5..15c81ae67e 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/RaysApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/RaysApiTest.java @@ -20,14 +20,15 @@ import java.util.List; import java.util.Map; -import jakarta.ws.rs.core.Response; +import org.apache.hugegraph.api.BaseApiTest; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.apache.hugegraph.api.BaseApiTest; import com.google.common.collect.ImmutableMap; +import jakarta.ws.rs.core.Response; + public class RaysApiTest extends BaseApiTest { static final String PATH = TRAVERSERS_API + "/rays"; @@ -46,12 +47,10 @@ public void testGet() { Map name2Ids = listAllVertexName2Ids(); String markoId = name2Ids.get("marko"); String vadasId = name2Ids.get("vadas"); - Response r = client().get(PATH, ImmutableMap.of("source", - id2Json(markoId), + Response r = client().get(PATH, ImmutableMap.of("source", id2Json(markoId), "max_depth", 10)); String content = assertResponseStatus(200, r); - List>> rays = assertJsonContains(content, - "rays"); + List>> rays = assertJsonContains(content, "rays"); Assert.assertNotNull(rays); Assert.assertEquals(2, rays.size()); Object[] valuesArray = rays.get(0).values().toArray(); diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPITest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPITest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPITest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPITest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/RingsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/RingsApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/RingsApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/RingsApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/SameNeighborsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/SameNeighborsApiTest.java similarity index 90% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/SameNeighborsApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/SameNeighborsApiTest.java index e4b3a6bfda..7e2670f10e 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/SameNeighborsApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/SameNeighborsApiTest.java @@ -20,14 +20,15 @@ import java.util.List; import java.util.Map; -import jakarta.ws.rs.core.Response; +import org.apache.hugegraph.api.BaseApiTest; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.apache.hugegraph.api.BaseApiTest; import com.google.common.collect.ImmutableMap; +import jakarta.ws.rs.core.Response; + public class SameNeighborsApiTest extends BaseApiTest { static final String PATH = TRAVERSERS_API + "/sameneighbors"; @@ -47,13 +48,10 @@ public void testGet() { String markoId = name2Ids.get("marko"); String joshId = name2Ids.get("josh"); String peterId = name2Ids.get("peter"); - Response r = client().get(PATH, ImmutableMap.of("vertex", - id2Json(markoId), - "other", - id2Json(joshId))); + Response r = client().get(PATH, ImmutableMap.of("vertex", id2Json(markoId), + "other", id2Json(joshId))); String content = assertResponseStatus(200, r); - List sameNeighbors = assertJsonContains(content, - "same_neighbors"); + List sameNeighbors = assertJsonContains(content, "same_neighbors"); Assert.assertFalse(sameNeighbors.isEmpty()); Assert.assertTrue(sameNeighbors.contains(peterId)); } diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ShortestPathApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ShortestPathApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ShortestPathApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ShortestPathApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/SingleSourceShortestPathApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/SingleSourceShortestPathApiTest.java similarity index 92% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/SingleSourceShortestPathApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/SingleSourceShortestPathApiTest.java index 39a5474255..663dd18380 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/SingleSourceShortestPathApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/SingleSourceShortestPathApiTest.java @@ -19,14 +19,15 @@ import java.util.Map; -import jakarta.ws.rs.core.Response; +import org.apache.hugegraph.api.BaseApiTest; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.apache.hugegraph.api.BaseApiTest; import com.google.common.collect.ImmutableMap; +import jakarta.ws.rs.core.Response; + public class SingleSourceShortestPathApiTest extends BaseApiTest { static final String PATH = TRAVERSERS_API + "/singlesourceshortestpath"; @@ -44,10 +45,8 @@ public void prepareSchema() { public void testGet() { Map name2Ids = listAllVertexName2Ids(); String markoId = name2Ids.get("marko"); - Response r = client().get(PATH, ImmutableMap.of("source", - id2Json(markoId), - "with_vertex", - true)); + Response r = client().get(PATH, ImmutableMap.of("source", id2Json(markoId), + "with_vertex", true)); String content = assertResponseStatus(200, r); Map> paths = assertJsonContains(content, "paths"); Assert.assertEquals(4, paths.size()); diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TemplatePathsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TemplatePathsApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TemplatePathsApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TemplatePathsApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TraversersApiTestSuite.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TraversersApiTestSuite.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TraversersApiTestSuite.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TraversersApiTestSuite.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/WeightedShortestPathApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/WeightedShortestPathApiTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/WeightedShortestPathApiTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/WeightedShortestPathApiTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/AuthTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/AuthTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/AuthTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/AuthTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/BaseCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/BaseCoreTest.java similarity index 96% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/BaseCoreTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/BaseCoreTest.java index d51e1b5951..df9932ab8e 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/core/BaseCoreTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/BaseCoreTest.java @@ -21,13 +21,12 @@ import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.HugeGraphParams; -import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.backend.store.BackendFeatures; import org.apache.hugegraph.dist.RegisterUtil; +import org.apache.hugegraph.masterelection.GlobalMasterInfo; import org.apache.hugegraph.schema.SchemaManager; import org.apache.hugegraph.testutil.Utils; import org.apache.hugegraph.testutil.Whitebox; -import org.apache.hugegraph.type.define.NodeRole; import org.apache.hugegraph.util.Log; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Vertex; @@ -66,7 +65,7 @@ public static void init() { graph = Utils.open(); graph.clearBackend(); graph.initBackend(); - graph.serverStarted(IdGenerator.of("server1"), NodeRole.MASTER); + graph.serverStarted(GlobalMasterInfo.master("server-test")); } @AfterClass diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/CoreTestSuite.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/CoreTestSuite.java similarity index 95% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/CoreTestSuite.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/CoreTestSuite.java index e140474b40..beafedf863 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/core/CoreTestSuite.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/CoreTestSuite.java @@ -36,9 +36,7 @@ TaskCoreTest.class, AuthTest.class, MultiGraphsTest.class, - RamTableTest.class, - RoleElectionStateMachineTest.class + RamTableTest.class }) public class CoreTestSuite { - } diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeLabelCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeLabelCoreTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeLabelCoreTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeLabelCoreTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/IndexLabelCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/IndexLabelCoreTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/IndexLabelCoreTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/IndexLabelCoreTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/MultiGraphsTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/MultiGraphsTest.java similarity index 97% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/MultiGraphsTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/MultiGraphsTest.java index 23fb122f44..3b468ba458 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/core/MultiGraphsTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/MultiGraphsTest.java @@ -31,8 +31,8 @@ import org.apache.hugegraph.backend.store.BackendStoreInfo; import org.apache.hugegraph.backend.store.rocksdb.RocksDBOptions; import org.apache.hugegraph.config.CoreOptions; -import org.apache.hugegraph.exception.ConnectionException; import org.apache.hugegraph.exception.ExistedException; +import org.apache.hugegraph.masterelection.GlobalMasterInfo; import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.schema.IndexLabel; import org.apache.hugegraph.schema.PropertyKey; @@ -40,7 +40,6 @@ import org.apache.hugegraph.schema.VertexLabel; import org.apache.hugegraph.testutil.Assert; import org.apache.hugegraph.testutil.Utils; -import org.apache.hugegraph.type.define.NodeRole; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.util.GraphFactory; @@ -87,9 +86,9 @@ public void testCopySchemaWithMultiGraphs() { graph.initBackend(); } HugeGraph g1 = graphs.get(0); - g1.serverStarted(IdGenerator.of("server-g2"), NodeRole.MASTER); + g1.serverStarted(GlobalMasterInfo.master("server-g2")); HugeGraph g2 = graphs.get(1); - g2.serverStarted(IdGenerator.of("server-g3"), NodeRole.MASTER); + g2.serverStarted(GlobalMasterInfo.master("server-g3")); SchemaManager schema = g1.schema(); @@ -209,8 +208,8 @@ public void testCopySchemaWithMultiGraphsWithConflict() { } HugeGraph g1 = graphs.get(0); HugeGraph g2 = graphs.get(1); - g1.serverStarted(IdGenerator.of("server-g1c"), NodeRole.MASTER); - g2.serverStarted(IdGenerator.of("server-g2c"), NodeRole.MASTER); + g1.serverStarted(GlobalMasterInfo.master("server-g1c")); + g2.serverStarted(GlobalMasterInfo.master("server-g2c")); g1.schema().propertyKey("id").asInt().create(); g2.schema().propertyKey("id").asText().create(); diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyCoreTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyCoreTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyCoreTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyKeyCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyKeyCoreTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyKeyCoreTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyKeyCoreTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/RamTableTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RamTableTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/RamTableTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RamTableTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/RestoreCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RestoreCoreTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/RestoreCoreTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RestoreCoreTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/RoleElectionStateMachineTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RoleElectionStateMachineTest.java similarity index 86% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/RoleElectionStateMachineTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RoleElectionStateMachineTest.java index 9fbbb5e628..dd73821661 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/core/RoleElectionStateMachineTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RoleElectionStateMachineTest.java @@ -34,8 +34,8 @@ import org.apache.hugegraph.masterelection.ClusterRoleStore; import org.apache.hugegraph.masterelection.Config; import org.apache.hugegraph.masterelection.RoleElectionStateMachine; +import org.apache.hugegraph.masterelection.RoleListener; import org.apache.hugegraph.masterelection.StandardRoleElectionStateMachine; -import org.apache.hugegraph.masterelection.StateMachineCallback; import org.apache.hugegraph.masterelection.StateMachineContext; import org.apache.hugegraph.testutil.Assert; import org.apache.hugegraph.testutil.Utils; @@ -43,13 +43,13 @@ public class RoleElectionStateMachineTest { - public static class LogEntry { + private static class LogEntry { - Integer epoch; + private final Integer epoch; - String node; + private final String node; - Role role; + private final Role role; enum Role { master, @@ -74,28 +74,29 @@ public boolean equals(Object obj) { return false; } LogEntry logEntry = (LogEntry) obj; - return Objects.equals(epoch, logEntry.epoch) && - Objects.equals(node, logEntry.node) && role == logEntry.role; + return Objects.equals(this.epoch, logEntry.epoch) && + Objects.equals(this.node, logEntry.node) && + this.role == logEntry.role; } @Override public int hashCode() { - return Objects.hash(epoch, node, role); + return Objects.hash(this.epoch, this.node, this.role); } @Override public String toString() { return "LogEntry{" + - "epoch=" + epoch + - ", node='" + node + '\'' + - ", role=" + role + + "epoch=" + this.epoch + + ", node='" + this.node + '\'' + + ", role=" + this.role + '}'; } } private static class TestConfig implements Config { - String node; + private final String node; public TestConfig(String node) { this.node = node; @@ -139,11 +140,11 @@ public long baseTimeoutMillisecond() { @Test public void testStateMachine() throws InterruptedException { - final CountDownLatch stop = new CountDownLatch(4); final int MAX_COUNT = 200; - final List logRecords = Collections.synchronizedList(new ArrayList<>(MAX_COUNT)); - final List masterNodes = Collections.synchronizedList(new ArrayList<>(MAX_COUNT)); - final StateMachineCallback callback = new StateMachineCallback() { + CountDownLatch stop = new CountDownLatch(4); + List logRecords = Collections.synchronizedList(new ArrayList<>(MAX_COUNT)); + List masterNodes = Collections.synchronizedList(new ArrayList<>(MAX_COUNT)); + RoleListener callback = new RoleListener() { @Override public void onAsRoleMaster(StateMachineContext context) { @@ -200,12 +201,13 @@ public void onAsRoleAbdication(StateMachineContext context) { @Override public void error(StateMachineContext context, Throwable e) { Utils.println("state machine error: node " + - context.node() + - " message " + e.getMessage()); + context.node() + " message " + e.getMessage()); } }; - final List clusterRoleLogs = Collections.synchronizedList(new ArrayList<>(100)); + final List clusterRoleLogs = Collections.synchronizedList( + new ArrayList<>(100)); + final ClusterRoleStore clusterRoleStore = new ClusterRoleStore() { volatile int epoch = 0; @@ -227,7 +229,7 @@ public boolean updateIfNodePresent(ClusterRole clusterRole) { } ClusterRole copy = this.copy(clusterRole); - ClusterRole newClusterRole = data.compute(copy.epoch(), (key, value) -> { + ClusterRole newClusterRole = this.data.compute(copy.epoch(), (key, value) -> { if (copy.epoch() > this.epoch) { this.epoch = copy.epoch(); Assert.assertNull(value); @@ -262,27 +264,27 @@ public Optional query() { Thread node1 = new Thread(() -> { Config config = new TestConfig("1"); RoleElectionStateMachine stateMachine = - new StandardRoleElectionStateMachine(config, clusterRoleStore); + new StandardRoleElectionStateMachine(config, clusterRoleStore); machines[1] = stateMachine; - stateMachine.apply(callback); + stateMachine.start(callback); stop.countDown(); }); Thread node2 = new Thread(() -> { Config config = new TestConfig("2"); RoleElectionStateMachine stateMachine = - new StandardRoleElectionStateMachine(config, clusterRoleStore); + new StandardRoleElectionStateMachine(config, clusterRoleStore); machines[2] = stateMachine; - stateMachine.apply(callback); + stateMachine.start(callback); stop.countDown(); }); Thread node3 = new Thread(() -> { Config config = new TestConfig("3"); RoleElectionStateMachine stateMachine = - new StandardRoleElectionStateMachine(config, clusterRoleStore); + new StandardRoleElectionStateMachine(config, clusterRoleStore); machines[3] = stateMachine; - stateMachine.apply(callback); + stateMachine.start(callback); stop.countDown(); }); diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/SchemaCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/SchemaCoreTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/SchemaCoreTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/SchemaCoreTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/TaskCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/TaskCoreTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/TaskCoreTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/TaskCoreTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexCoreTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexCoreTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexCoreTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexLabelCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexLabelCoreTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexLabelCoreTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexLabelCoreTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/testutil/FakeObjects.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/testutil/FakeObjects.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/testutil/FakeObjects.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/testutil/FakeObjects.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/testutil/Utils.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/testutil/Utils.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/testutil/Utils.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/testutil/Utils.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessBasicSuite.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessBasicSuite.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessBasicSuite.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessBasicSuite.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessStandardTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessStandardTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessStandardTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessStandardTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessTestGraphProvider.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessTestGraphProvider.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessTestGraphProvider.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessTestGraphProvider.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureBasicSuite.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureBasicSuite.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureBasicSuite.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureBasicSuite.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureStandardTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureStandardTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureStandardTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureStandardTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureTestGraphProvider.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureTestGraphProvider.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureTestGraphProvider.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureTestGraphProvider.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraph.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraph.java similarity index 99% rename from hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraph.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraph.java index c6dcff4a87..415e804626 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraph.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraph.java @@ -24,27 +24,24 @@ import java.util.Set; import org.apache.commons.configuration2.Configuration; -import org.apache.tinkerpop.gremlin.process.computer.GraphComputer; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.T; -import org.apache.tinkerpop.gremlin.structure.Transaction; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.structure.io.Io; - import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.backend.store.BackendStoreInfo; import org.apache.hugegraph.io.HugeGraphIoRegistry; import org.apache.hugegraph.io.HugeGraphSONModule; +import org.apache.hugegraph.masterelection.GlobalMasterInfo; import org.apache.hugegraph.perf.PerfUtil.Watched; import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.schema.SchemaManager; import org.apache.hugegraph.task.TaskScheduler; import org.apache.hugegraph.testutil.Whitebox; import org.apache.hugegraph.type.define.IdStrategy; -import org.apache.hugegraph.type.define.NodeRole; +import org.apache.tinkerpop.gremlin.process.computer.GraphComputer; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.Transaction; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.io.Io; import com.google.common.collect.ImmutableSet; @@ -85,8 +82,7 @@ protected void initBackend() { assert sysInfo.exists() && !this.graph.closed(); } - Id id = IdGenerator.of("server-tinkerpop"); - this.graph.serverStarted(id, NodeRole.MASTER); + this.graph.serverStarted(GlobalMasterInfo.master("server-tinkerpop")); this.initedBackend = true; } diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraphFactory.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraphFactory.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraphFactory.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraphFactory.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraphProvider.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraphProvider.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraphProvider.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraphProvider.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/tests/HugeGraphWriteTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/tests/HugeGraphWriteTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/tests/HugeGraphWriteTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/tests/HugeGraphWriteTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/BaseUnitTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/BaseUnitTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/BaseUnitTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/BaseUnitTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/FakeObjects.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/FakeObjects.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/FakeObjects.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/FakeObjects.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java similarity index 96% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java index 3b8071f9f1..458c2d8a9e 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java @@ -17,26 +17,13 @@ package org.apache.hugegraph.unit; -import org.apache.hugegraph.unit.cassandra.CassandraTest; -import org.apache.hugegraph.unit.id.EdgeIdTest; -import org.apache.hugegraph.unit.id.IdTest; -import org.apache.hugegraph.unit.id.IdUtilTest; -import org.apache.hugegraph.unit.id.SplicingIdGeneratorTest; -import org.apache.hugegraph.unit.mysql.MysqlUtilTest; -import org.apache.hugegraph.unit.mysql.WhereBuilderTest; -import org.apache.hugegraph.unit.rocksdb.RocksDBCountersTest; -import org.apache.hugegraph.unit.rocksdb.RocksDBSessionTest; -import org.apache.hugegraph.unit.rocksdb.RocksDBSessionsTest; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -import org.apache.hugegraph.unit.core.SystemSchemaStoreTest; -import org.apache.hugegraph.unit.util.RateLimiterTest; +import org.apache.hugegraph.core.RoleElectionStateMachineTest; import org.apache.hugegraph.unit.cache.CacheManagerTest; import org.apache.hugegraph.unit.cache.CacheTest; import org.apache.hugegraph.unit.cache.CachedGraphTransactionTest; import org.apache.hugegraph.unit.cache.CachedSchemaTransactionTest; import org.apache.hugegraph.unit.cache.RamTableTest; +import org.apache.hugegraph.unit.cassandra.CassandraTest; import org.apache.hugegraph.unit.core.AnalyzerTest; import org.apache.hugegraph.unit.core.BackendMutationTest; import org.apache.hugegraph.unit.core.BackendStoreInfoTest; @@ -53,7 +40,17 @@ import org.apache.hugegraph.unit.core.RowLockTest; import org.apache.hugegraph.unit.core.SecurityManagerTest; import org.apache.hugegraph.unit.core.SerialEnumTest; +import org.apache.hugegraph.unit.core.SystemSchemaStoreTest; import org.apache.hugegraph.unit.core.TraversalUtilTest; +import org.apache.hugegraph.unit.id.EdgeIdTest; +import org.apache.hugegraph.unit.id.IdTest; +import org.apache.hugegraph.unit.id.IdUtilTest; +import org.apache.hugegraph.unit.id.SplicingIdGeneratorTest; +import org.apache.hugegraph.unit.mysql.MysqlUtilTest; +import org.apache.hugegraph.unit.mysql.WhereBuilderTest; +import org.apache.hugegraph.unit.rocksdb.RocksDBCountersTest; +import org.apache.hugegraph.unit.rocksdb.RocksDBSessionTest; +import org.apache.hugegraph.unit.rocksdb.RocksDBSessionsTest; import org.apache.hugegraph.unit.serializer.BinaryBackendEntryTest; import org.apache.hugegraph.unit.serializer.BinaryScatterSerializerTest; import org.apache.hugegraph.unit.serializer.BinarySerializerTest; @@ -62,8 +59,10 @@ import org.apache.hugegraph.unit.serializer.StoreSerializerTest; import org.apache.hugegraph.unit.serializer.TableBackendEntryTest; import org.apache.hugegraph.unit.serializer.TextBackendEntryTest; +import org.apache.hugegraph.unit.store.RamIntObjectMapTest; import org.apache.hugegraph.unit.util.CompressUtilTest; import org.apache.hugegraph.unit.util.JsonUtilTest; +import org.apache.hugegraph.unit.util.RateLimiterTest; import org.apache.hugegraph.unit.util.StringEncodingTest; import org.apache.hugegraph.unit.util.VersionTest; import org.apache.hugegraph.unit.util.collection.CollectionFactoryTest; @@ -72,6 +71,8 @@ import org.apache.hugegraph.unit.util.collection.IntMapTest; import org.apache.hugegraph.unit.util.collection.IntSetTest; import org.apache.hugegraph.unit.util.collection.ObjectIntMappingTest; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; @RunWith(Suite.class) @Suite.SuiteClasses({ @@ -111,6 +112,7 @@ TraversalUtilTest.class, PageStateTest.class, SystemSchemaStoreTest.class, + RoleElectionStateMachineTest.class, /* serializer */ BytesBufferTest.class, @@ -148,7 +150,10 @@ Int2IntsMapTest.class, IdSetTest.class, IntMapTest.class, - IntSetTest.class + IntSetTest.class, + + /* store */ + RamIntObjectMapTest.class }) public class UnitTestSuite { } diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CacheManagerTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CacheManagerTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CacheManagerTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CacheManagerTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CacheTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CacheTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CacheTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CacheTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CachedGraphTransactionTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CachedGraphTransactionTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CachedGraphTransactionTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CachedGraphTransactionTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CachedSchemaTransactionTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CachedSchemaTransactionTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CachedSchemaTransactionTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/CachedSchemaTransactionTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/RamTableTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/RamTableTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/RamTableTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cache/RamTableTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cassandra/CassandraTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cassandra/CassandraTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/cassandra/CassandraTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cassandra/CassandraTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/AnalyzerTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/AnalyzerTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/AnalyzerTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/AnalyzerTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/BackendMutationTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/BackendMutationTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/BackendMutationTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/BackendMutationTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/BackendStoreInfoTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/BackendStoreInfoTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/BackendStoreInfoTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/BackendStoreInfoTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/ConditionQueryFlattenTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/ConditionQueryFlattenTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/ConditionQueryFlattenTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/ConditionQueryFlattenTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/ConditionTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/ConditionTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/ConditionTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/ConditionTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/DataTypeTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/DataTypeTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/DataTypeTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/DataTypeTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/DirectionsTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/DirectionsTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/DirectionsTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/DirectionsTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/ExceptionTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/ExceptionTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/ExceptionTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/ExceptionTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/LocksTableTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/LocksTableTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/LocksTableTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/LocksTableTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/PageStateTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/PageStateTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/PageStateTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/PageStateTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/QueryTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/QueryTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/QueryTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/QueryTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/RangeTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/RangeTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/RangeTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/RangeTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/RolePermissionTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/RolePermissionTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/RolePermissionTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/RolePermissionTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/RowLockTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/RowLockTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/RowLockTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/RowLockTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SecurityManagerTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SecurityManagerTest.java similarity index 98% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SecurityManagerTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SecurityManagerTest.java index 403bc62e99..ae431480c4 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SecurityManagerTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SecurityManagerTest.java @@ -32,23 +32,22 @@ import java.util.Map; import java.util.concurrent.TimeoutException; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeFactory; import org.apache.hugegraph.HugeGraph; -import org.apache.hugegraph.backend.id.IdGenerator; import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.job.GremlinJob; import org.apache.hugegraph.job.JobBuilder; +import org.apache.hugegraph.masterelection.GlobalMasterInfo; import org.apache.hugegraph.security.HugeSecurityManager; import org.apache.hugegraph.task.HugeTask; import org.apache.hugegraph.testutil.Assert; -import org.apache.hugegraph.type.define.NodeRole; import org.apache.hugegraph.unit.FakeObjects; import org.apache.hugegraph.util.JsonUtil; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + import com.google.common.collect.ImmutableMap; public class SecurityManagerTest { @@ -319,7 +318,7 @@ private static HugeGraph loadGraph(boolean needClear) { graph.clearBackend(); } graph.initBackend(); - graph.serverStarted(IdGenerator.of("server1"), NodeRole.MASTER); + graph.serverStarted(GlobalMasterInfo.master("server1")); return graph; } diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SerialEnumTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SerialEnumTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SerialEnumTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SerialEnumTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SystemSchemaStoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SystemSchemaStoreTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SystemSchemaStoreTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SystemSchemaStoreTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/TraversalUtilTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/TraversalUtilTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/TraversalUtilTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/TraversalUtilTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/EdgeIdTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/EdgeIdTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/EdgeIdTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/EdgeIdTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/IdTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/IdTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/IdTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/IdTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/IdUtilTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/IdUtilTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/IdUtilTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/IdUtilTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/SplicingIdGeneratorTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/SplicingIdGeneratorTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/SplicingIdGeneratorTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/id/SplicingIdGeneratorTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/MysqlUtilTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/MysqlUtilTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/MysqlUtilTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/MysqlUtilTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/WhereBuilderTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/WhereBuilderTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/WhereBuilderTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/WhereBuilderTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/BaseRocksDBUnitTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/BaseRocksDBUnitTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/BaseRocksDBUnitTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/BaseRocksDBUnitTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBCountersTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBCountersTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBCountersTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBCountersTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBPerfTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBPerfTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBPerfTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBPerfTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBSessionTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBSessionTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBSessionTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBSessionTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBSessionsTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBSessionsTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBSessionsTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBSessionsTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BinaryBackendEntryTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BinaryBackendEntryTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BinaryBackendEntryTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BinaryBackendEntryTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BinaryScatterSerializerTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BinaryScatterSerializerTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BinaryScatterSerializerTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BinaryScatterSerializerTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BinarySerializerTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BinarySerializerTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BinarySerializerTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BinarySerializerTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BytesBufferTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BytesBufferTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BytesBufferTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BytesBufferTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/SerializerFactoryTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/SerializerFactoryTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/SerializerFactoryTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/SerializerFactoryTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/StoreSerializerTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/StoreSerializerTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/StoreSerializerTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/StoreSerializerTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/TableBackendEntryTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/TableBackendEntryTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/TableBackendEntryTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/TableBackendEntryTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/TextBackendEntryTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/TextBackendEntryTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/TextBackendEntryTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/TextBackendEntryTest.java diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/store/RamIntObjectMapTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/store/RamIntObjectMapTest.java new file mode 100644 index 0000000000..4e9fe4d95b --- /dev/null +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/store/RamIntObjectMapTest.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hugegraph.unit.store; + +import java.util.concurrent.CountDownLatch; + +import org.apache.hugegraph.backend.store.ram.IntObjectMap; +import org.junit.Assert; +import org.junit.Test; + +public class RamIntObjectMapTest { + + @Test + public void testConcurrency() { + int size = 32; + IntObjectMap map = new IntObjectMap<>(size); + + final int numThreads = 10; + final CountDownLatch startSignal = new CountDownLatch(1); + final CountDownLatch doneSignal = new CountDownLatch(numThreads); + + for (int i = 0; i < numThreads; i++) { + new Thread(() -> { + try { + startSignal.await(); + } catch (InterruptedException e) { + e.printStackTrace(); + Assert.fail(e.getMessage()); + } + + for (int j = 0; j < size; j++) { + map.set(j, j); + } + + doneSignal.countDown(); + }).start(); + } + + startSignal.countDown(); + + try { + doneSignal.await(); + } catch (InterruptedException e) { + e.printStackTrace(); + Assert.fail(e.getMessage()); + } + + for (int i = 0; i < numThreads; i++) { + new Thread(() -> { + for (int j = 0; j < size; j++) { + Integer value = map.get(j); + Assert.assertNotNull(value); + } + }).start(); + } + } +} diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/CompressUtilTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/CompressUtilTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/CompressUtilTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/CompressUtilTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/JsonUtilTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/JsonUtilTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/JsonUtilTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/JsonUtilTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/RateLimiterTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/RateLimiterTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/RateLimiterTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/RateLimiterTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/StringEncodingTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/StringEncodingTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/StringEncodingTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/StringEncodingTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/VersionTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/VersionTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/VersionTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/VersionTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/CollectionFactoryTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/CollectionFactoryTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/CollectionFactoryTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/CollectionFactoryTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/IdSetTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/IdSetTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/IdSetTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/IdSetTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/Int2IntsMapTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/Int2IntsMapTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/Int2IntsMapTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/Int2IntsMapTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/IntMapTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/IntMapTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/IntMapTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/IntMapTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/IntSetTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/IntSetTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/IntSetTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/IntSetTest.java diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/ObjectIntMappingTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/ObjectIntMappingTest.java similarity index 100% rename from hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/ObjectIntMappingTest.java rename to hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/collection/ObjectIntMappingTest.java diff --git a/hugegraph-test/src/main/resources/fast-methods.filter b/hugegraph-server/hugegraph-test/src/main/resources/fast-methods.filter similarity index 100% rename from hugegraph-test/src/main/resources/fast-methods.filter rename to hugegraph-server/hugegraph-test/src/main/resources/fast-methods.filter diff --git a/hugegraph-test/src/main/resources/hugegraph.properties b/hugegraph-server/hugegraph-test/src/main/resources/hugegraph.properties similarity index 100% rename from hugegraph-test/src/main/resources/hugegraph.properties rename to hugegraph-server/hugegraph-test/src/main/resources/hugegraph.properties diff --git a/hugegraph-test/src/main/resources/log4j2.xml b/hugegraph-server/hugegraph-test/src/main/resources/log4j2.xml similarity index 79% rename from hugegraph-test/src/main/resources/log4j2.xml rename to hugegraph-server/hugegraph-test/src/main/resources/log4j2.xml index e830c6248e..284f53487c 100644 --- a/hugegraph-test/src/main/resources/log4j2.xml +++ b/hugegraph-server/hugegraph-test/src/main/resources/log4j2.xml @@ -76,6 +76,30 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -124,5 +148,9 @@ + + + + diff --git a/hugegraph-test/src/main/resources/methods.filter b/hugegraph-server/hugegraph-test/src/main/resources/methods.filter similarity index 100% rename from hugegraph-test/src/main/resources/methods.filter rename to hugegraph-server/hugegraph-test/src/main/resources/methods.filter diff --git a/hugegraph-test/src/test/java/org/apache/hugegraph/benchmark/BenchmarkConstants.java b/hugegraph-server/hugegraph-test/src/test/java/org/apache/hugegraph/benchmark/BenchmarkConstants.java similarity index 100% rename from hugegraph-test/src/test/java/org/apache/hugegraph/benchmark/BenchmarkConstants.java rename to hugegraph-server/hugegraph-test/src/test/java/org/apache/hugegraph/benchmark/BenchmarkConstants.java diff --git a/hugegraph-test/src/test/java/org/apache/hugegraph/benchmark/SimpleRandom.java b/hugegraph-server/hugegraph-test/src/test/java/org/apache/hugegraph/benchmark/SimpleRandom.java similarity index 100% rename from hugegraph-test/src/test/java/org/apache/hugegraph/benchmark/SimpleRandom.java rename to hugegraph-server/hugegraph-test/src/test/java/org/apache/hugegraph/benchmark/SimpleRandom.java diff --git a/hugegraph-test/src/test/java/org/apache/hugegraph/benchmark/map/MapRandomGetPutThroughputTest.java b/hugegraph-server/hugegraph-test/src/test/java/org/apache/hugegraph/benchmark/map/MapRandomGetPutThroughputTest.java similarity index 100% rename from hugegraph-test/src/test/java/org/apache/hugegraph/benchmark/map/MapRandomGetPutThroughputTest.java rename to hugegraph-server/hugegraph-test/src/test/java/org/apache/hugegraph/benchmark/map/MapRandomGetPutThroughputTest.java diff --git a/hugegraph-server/pom.xml b/hugegraph-server/pom.xml new file mode 100644 index 0000000000..e5f09d22eb --- /dev/null +++ b/hugegraph-server/pom.xml @@ -0,0 +1,495 @@ + + + + 4.0.0 + hugegraph-server + ${revision} + pom + + ${project.artifactId} + https://github.com/apache/hugegraph/tree/master/hugegraph-server + + HugeGraph server is the graph engine layer of HugeGraph, including REST-API, OLTP engine and backends interface. + + + + org.apache.hugegraph + hugegraph + ${revision} + ../pom.xml + + + + UTF-8 + ${project.basedir}/.. + hugegraph + apache-${release.name}-incubating-${project.version} + ${top.level.dir}/${final.name}.tar.gz + 1.8 + 1.8 + 1.7.5 + 1.2.17 + 2.17.1 + 4.13.1 + 3.5.1 + 2.7 + 25.1-jre + 4.5.13 + 3.0.3 + 4.2.4 + 3.21.0-GA + bash + 3.1.2 + 8.45 + 1.2.0 + 1.47.0 + 3.21.7 + 1.36 + 3.7.1 + 2.2.18 + + + + hugegraph-core + hugegraph-api + hugegraph-example + hugegraph-dist + hugegraph-test + hugegraph-cassandra + hugegraph-scylladb + hugegraph-rocksdb + hugegraph-mysql + hugegraph-palo + hugegraph-hbase + hugegraph-postgresql + + + + + + + org.apache.hugegraph + hugegraph-rpc + ${hugegraph-commons.version} + + + org.apache.hugegraph + hugegraph-common + ${hugegraph-commons.version} + + + + + org.apache.logging.log4j + log4j-api + ${log4j2.version} + + + org.apache.logging.log4j + log4j-core + ${log4j2.version} + + + org.apache.logging.log4j + log4j-slf4j-impl + ${log4j2.version} + + + + + junit + junit + ${junit.version} + + + + + org.apache.tinkerpop + gremlin-core + ${tinkerpop.version} + + + org.apache.tinkerpop + gremlin-server + ${tinkerpop.version} + + + com.github.jeremyh + jBCrypt + + + + + org.apache.tinkerpop + gremlin-console + ${tinkerpop.version} + + + com.github.jeremyh + jBCrypt + + + + + org.apache.tinkerpop + gremlin-groovy + ${tinkerpop.version} + + + com.github.jeremyh + jBCrypt + + + + + org.apache.tinkerpop + tinkergraph-gremlin + ${tinkerpop.version} + + + org.apache.tinkerpop + gremlin-test + ${tinkerpop.version} + + + org.apache.tinkerpop + gremlin-groovy-test + 3.2.11 + + + org.apache.tinkerpop + gremlin-driver + ${tinkerpop.version} + + + + + commons-io + commons-io + ${commons.io.version} + + + org.apache.httpcomponents + httpclient + ${httpclient.version} + + + + + org.glassfish.jersey.core + jersey-server + ${jersey.version} + + + org.glassfish.jersey.containers + jersey-container-grizzly2-http + ${jersey.version} + + + org.glassfish.jersey.containers + jersey-container-grizzly2-servlet + ${jersey.version} + + + org.glassfish.jersey.media + jersey-media-json-jackson + ${jersey.version} + + + org.glassfish.jersey.test-framework.providers + jersey-test-framework-provider-grizzly2 + ${jersey.version} + + + + + io.dropwizard.metrics + metrics-json + ${metrics.version} + + + io.dropwizard.metrics + metrics-jersey3 + ${metrics.version} + + + + + org.javassist + javassist + ${javassist.version} + + + + + io.grpc + grpc-netty + ${grpc.version} + provided + + + io.grpc + grpc-stub + ${grpc.version} + provided + + + com.google.protobuf + protobuf-java + ${protobuf.version} + + + + org.apache.commons + commons-text + 1.10.0 + + + org.openjdk.jmh + jmh-core + ${jmh.version} + test + + + org.openjdk.jmh + jmh-generator-annprocess + ${jmh.version} + test + + + + + + + + + maven-compiler-plugin + 3.1 + + ${compiler.source} + ${compiler.target} + + 500 + + + -Xlint:unchecked + + + + + org.apache.maven.plugins + maven-clean-plugin + + + + ${project.basedir}/ + + *.tar + *.tar.gz + .flattened-pom.xml + ${final.name}/** + + false + + + ${final.name} + + + + + ../${project.basedir} + + *.tar.gz + + + + ../${final.name} + + + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + ${checkstyle.plugin.version} + + + com.puppycrawl.tools + checkstyle + ${checkstyle.version} + + + + style/checkstyle.xml + UTF-8 + true + true + false + false + + + + validate + validate + + check + + + + + + + org.codehaus.mojo + flatten-maven-plugin + 1.2.7 + + true + resolveCiFriendliesOnly + + + + flatten + process-resources + + flatten + + + + flatten.clean + clean + + clean + + + + + + + + + + + core-test + + true + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + core-test + + test + + test + + + + + + + + unit-test + + + + org.apache.maven.plugins + maven-surefire-plugin + + + unit-test + + test + + test + + + + + + + + api-test + + + + org.apache.maven.plugins + maven-surefire-plugin + + + api-test + + test + + test + + + + + + + + tinkerpop-structure-test + + + + org.apache.maven.plugins + maven-surefire-plugin + + + tinkerpop-structure-test + + test + + test + + + + + + + + tinkerpop-process-test + + + + org.apache.maven.plugins + maven-surefire-plugin + + + tinkerpop-process-test + + test + + test + + + + + + + + diff --git a/hugegraph-store/README.md b/hugegraph-store/README.md new file mode 100644 index 0000000000..bef8b53c8a --- /dev/null +++ b/hugegraph-store/README.md @@ -0,0 +1,5 @@ +# HugeGraph Store + +HugeGraph Store is a new built-in storage backend, which uses RocksDB as the distributed backend storage engine. + +> Note: Currently, the contents of this folder are empty. Starting from revision 1.5.0, the code of HugeGraph Store will be adapted to this location (WIP). diff --git a/pom.xml b/pom.xml index 5cc42a954d..6917da79f6 100644 --- a/pom.xml +++ b/pom.xml @@ -23,10 +23,10 @@ ${revision} pom - hugegraph + ${project.artifactId} https://github.com/apache/hugegraph - hugegraph is a fast-speed, highly-scalable, transactional graph database developed by baidu + HugeGraph is a fast-speed and highly-scalable graph database. @@ -45,37 +45,37 @@ - - Apache Hugegraph(incubating) - dev-subscribe@hugegraph.apache.org - https://hugegraph.apache.org/ - + + Apache Hugegraph(incubating) + dev-subscribe@hugegraph.apache.org + https://hugegraph.apache.org/ + - - Development Mailing List - dev-subscribe@hugegraph.apache.org - dev-unsubscribe@hugegraph.apache.org - dev@hugegraph.incubator.apache.org - - - Commits List - commits-subscribe@hugegraph.apache.org - commits-unsubscribe@hugegraph.apache.org - commits@hugegraph.apache.org - - - Issues List - issues-subscribe@hugegraph.apache.org - issues-unsubscribe@hugegraph.apache.org - issues@hugegraph.apache.org - + + Development Mailing List + dev-subscribe@hugegraph.apache.org + dev-unsubscribe@hugegraph.apache.org + dev@hugegraph.incubator.apache.org + + + Commits List + commits-subscribe@hugegraph.apache.org + commits-unsubscribe@hugegraph.apache.org + commits@hugegraph.apache.org + + + Issues List + issues-subscribe@hugegraph.apache.org + issues-unsubscribe@hugegraph.apache.org + issues@hugegraph.apache.org + - Github Issues - https://github.com/apache/hugegraph/issues + Github Issues + https://github.com/apache/hugegraph/issues @@ -89,255 +89,16 @@ - 1.0.0 - UTF-8 - ${project.basedir}/.. - hugegraph - apache-${release.name}-incubating-${project.version} - ${top.level.dir}/${final.name}.tar.gz - 1.8 - 1.8 - 1.7.5 - 1.2.17 - 2.17.1 - 4.12 - 3.5.1 - 2.7 - 25.1-jre - 4.5.13 - 3.0.3 - 4.2.4 - 3.21.0-GA - bash - 3.1.2 - 8.45 - 1.0.0 - 1.47.0 - 3.21.7 - 1.36 + 1.2.0 - hugegraph-core - hugegraph-api - hugegraph-example - hugegraph-dist - hugegraph-test - hugegraph-cassandra - hugegraph-scylladb - hugegraph-rocksdb - hugegraph-mysql - hugegraph-palo - hugegraph-hbase - hugegraph-postgresql + hugegraph-server + + + - - - - - org.apache.hugegraph - hugegraph-rpc - ${hugegraph-commons.version} - - - org.apache.hugegraph - hugegraph-common - ${hugegraph-commons.version} - - - - - org.apache.logging.log4j - log4j-api - ${log4j2.version} - - - org.apache.logging.log4j - log4j-core - ${log4j2.version} - - - org.apache.logging.log4j - log4j-slf4j-impl - ${log4j2.version} - - - - - junit - junit - ${junit.version} - - - - - org.apache.tinkerpop - gremlin-core - ${tinkerpop.version} - - - org.apache.tinkerpop - gremlin-server - ${tinkerpop.version} - - - com.github.jeremyh - jBCrypt - - - - - org.apache.tinkerpop - gremlin-console - ${tinkerpop.version} - - - com.github.jeremyh - jBCrypt - - - - - org.apache.tinkerpop - gremlin-groovy - ${tinkerpop.version} - - - com.github.jeremyh - jBCrypt - - - - - org.apache.tinkerpop - tinkergraph-gremlin - ${tinkerpop.version} - - - org.apache.tinkerpop - gremlin-test - ${tinkerpop.version} - - - org.apache.tinkerpop - gremlin-groovy-test - 3.2.11 - - - org.apache.tinkerpop - gremlin-driver - ${tinkerpop.version} - - - - - commons-io - commons-io - ${commons.io.version} - - - com.google.guava - guava - ${guava.version} - - - org.apache.httpcomponents - httpclient - ${httpclient.version} - - - - - org.glassfish.jersey.core - jersey-server - ${jersey.version} - - - org.glassfish.jersey.containers - jersey-container-grizzly2-http - ${jersey.version} - - - org.glassfish.jersey.containers - jersey-container-grizzly2-servlet - ${jersey.version} - - - org.glassfish.jersey.media - jersey-media-json-jackson - ${jersey.version} - - - org.glassfish.jersey.test-framework.providers - jersey-test-framework-provider-grizzly2 - ${jersey.version} - - - - - io.dropwizard.metrics - metrics-json - ${metrics.version} - - - io.dropwizard.metrics - metrics-jersey3 - ${metrics.version} - - - - - org.javassist - javassist - ${javassist.version} - - - - - io.grpc - grpc-netty - ${grpc.version} - provided - - - io.grpc - grpc-protobuf - ${grpc.version} - provided - - - io.grpc - grpc-stub - ${grpc.version} - provided - - - com.google.protobuf - protobuf-java - ${protobuf.version} - - - - org.apache.commons - commons-text - 1.10.0 - - - org.openjdk.jmh - jmh-core - ${jmh.version} - test - - - org.openjdk.jmh - jmh-generator-annprocess - ${jmh.version} - test - - - - @@ -373,41 +134,6 @@ - - maven-compiler-plugin - 3.1 - - ${compiler.source} - ${compiler.target} - - 500 - - - -Xlint:unchecked - - - - - org.apache.maven.plugins - maven-clean-plugin - - - - ${project.basedir}/ - - *.tar - *.tar.gz - .flattened-pom.xml - ${final.name}/** - - false - - - ${final.name} - - - - org.apache.rat @@ -481,171 +207,9 @@ - - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${checkstyle.plugin.version} - - - com.puppycrawl.tools - checkstyle - ${checkstyle.version} - - - - style/checkstyle.xml - UTF-8 - true - true - false - false - - - - validate - validate - - check - - - - - - - org.codehaus.mojo - flatten-maven-plugin - 1.2.7 - - true - resolveCiFriendliesOnly - - - - flatten - process-resources - - flatten - - - - flatten.clean - clean - - clean - - - - - - - - core-test - - true - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - core-test - - test - - test - - - - - - - - unit-test - - - - org.apache.maven.plugins - maven-surefire-plugin - - - unit-test - - test - - test - - - - - - - - api-test - - - - org.apache.maven.plugins - maven-surefire-plugin - - - api-test - - test - - test - - - - - - - - tinkerpop-structure-test - - - - org.apache.maven.plugins - maven-surefire-plugin - - - tinkerpop-structure-test - - test - - test - - - - - - - - tinkerpop-process-test - - - - org.apache.maven.plugins - maven-surefire-plugin - - - tinkerpop-process-test - - test - - test - - - - - - apache-release @@ -705,5 +269,16 @@ + + + + stage + + + staged-releases + https://repository.apache.org/content/groups/staging/ + + +