forked from hugegraph/hugegraph-sync
Compare commits
1 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
e6f64dbdb3 |
|
|
@ -34,15 +34,15 @@ github:
|
|||
protected_branches:
|
||||
master:
|
||||
required_status_checks:
|
||||
# strict means "Require PR to be up-to-date before merging". (enable when branch unstable)
|
||||
# strict means "Require branches to be up-to-date before merging".
|
||||
strict: false
|
||||
# contexts are the names of checks that must pass (now only enable the basic check)
|
||||
contexts:
|
||||
- Analyze (java)
|
||||
- CodeQL
|
||||
- check-license
|
||||
- build-server (memory, 11)
|
||||
- build-commons (11)
|
||||
- build (memory, 8)
|
||||
- build (memory, 11)
|
||||
required_pull_request_reviews:
|
||||
dismiss_stale_reviews: true
|
||||
require_code_owner_reviews: false
|
||||
|
|
|
|||
|
|
@ -21,79 +21,7 @@ root = true
|
|||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
max_line_length = 100
|
||||
ij_wrap_on_typing = true
|
||||
ij_visual_guides = 100
|
||||
|
||||
|
||||
[*.{java,xml,py}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.{java,xml}]
|
||||
# Ignore the IDEA unsupported warning & it works well (indeed)
|
||||
continuation_indent_size = 8
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
|
||||
[*.java]
|
||||
ij_java_doc_add_p_tag_on_empty_lines = true
|
||||
ij_java_doc_do_not_wrap_if_one_line = true
|
||||
ij_java_annotation_parameter_wrap = normal
|
||||
ij_java_align_multiline_annotation_parameters = true
|
||||
ij_java_class_count_to_use_import_on_demand = 100
|
||||
ij_java_names_count_to_use_import_on_demand = 100
|
||||
ij_java_imports_layout = $*, |, java.**, |, javax.**, |, org.**, |, com.**, |, *
|
||||
|
||||
ij_java_line_comment_at_first_column = false
|
||||
ij_java_align_multiline_chained_methods = true
|
||||
ij_java_align_multiline_parameters_in_calls = true
|
||||
ij_java_align_multiline_binary_operation = true
|
||||
ij_java_align_multiline_assignment = true
|
||||
ij_java_align_multiline_ternary_operation = true
|
||||
ij_java_align_multiline_throws_list = true
|
||||
ij_java_align_multiline_extends_list = true
|
||||
ij_java_align_multiline_array_initializer_expression = true
|
||||
|
||||
ij_java_call_parameters_wrap = normal
|
||||
ij_java_method_parameters_wrap = normal
|
||||
ij_java_resource_list_wrap = normal
|
||||
ij_java_extends_list_wrap = normal
|
||||
ij_java_throws_list_wrap = normal
|
||||
ij_java_method_call_chain_wrap = normal
|
||||
ij_java_binary_operation_wrap = normal
|
||||
ij_java_ternary_operation_wrap = normal
|
||||
ij_java_for_statement_wrap = normal
|
||||
ij_java_array_initializer_wrap = normal
|
||||
ij_java_assignment_wrap = normal
|
||||
ij_java_assert_statement_wrap = normal
|
||||
ij_java_if_brace_force = if_multiline
|
||||
ij_java_do_while_brace_force = always
|
||||
ij_java_while_brace_force = if_multiline
|
||||
ij_java_for_brace_force = if_multiline
|
||||
ij_java_wrap_long_lines = true
|
||||
ij_java_parameter_annotation_wrap = normal
|
||||
ij_java_enum_constants_wrap = split_into_lines
|
||||
|
||||
ij_java_keep_blank_lines_in_declarations = 1
|
||||
ij_java_keep_blank_lines_in_code = 1
|
||||
ij_java_keep_blank_lines_between_package_declaration_and_header = 1
|
||||
ij_java_keep_blank_lines_before_right_brace = 1
|
||||
ij_java_blank_lines_around_class = 1
|
||||
ij_java_blank_lines_after_class_header = 1
|
||||
|
||||
ij_smart_tabs = true
|
||||
|
||||
[*.xml]
|
||||
max_line_length = 120
|
||||
ij_visual_guides = 120
|
||||
ij_xml_text_wrap = off
|
||||
ij_xml_space_inside_empty_tag = true
|
||||
|
||||
[.yaml]
|
||||
ij_yaml_spaces_within_braces = false
|
||||
ij_yaml_spaces_within_brackets = false
|
||||
|
||||
[.properties]
|
||||
ij_properties_keep_blank_lines = true
|
||||
|
|
|
|||
|
|
@ -5,12 +5,8 @@
|
|||
apache-release.sh export-ignore
|
||||
.licenserc.yaml export-ignore
|
||||
.editorconfig export-ignore
|
||||
hugegraph-store/hg-store-dist/src/assembly/static/bin/libjemalloc.so export-ignore
|
||||
hugegraph-store/hg-store-dist/src/assembly/static/bin/libjemalloc_aarch64.so export-ignore
|
||||
|
||||
# ignored directory
|
||||
.github/ export-ignore
|
||||
.idea/ export-ignore
|
||||
install-dist/scripts/ export-ignore
|
||||
hugegraph-commons/hugegraph-dist/ export-ignore
|
||||
docker/ export-ignore
|
||||
hugegraph-dist/scripts/ export-ignore
|
||||
#assembly/ export-ignore
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ published)
|
|||
|
||||
## Purpose of the PR
|
||||
|
||||
- close #xxx <!-- or use "fix #xxx", "xxx" is the ID-link of related issue, e.g: close #1024 -->
|
||||
- close #xxx <!-- or use "fix #xxx", "xxx" is the ID-link of related issue, e.g: close #1024 -->
|
||||
|
||||
<!--
|
||||
Please explain more context in this section, clarify why the changes are needed.
|
||||
|
|
@ -30,7 +30,7 @@ e.g:
|
|||
|
||||
## Main Changes
|
||||
|
||||
<!-- Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. These change logs are helpful for better and faster reviews.)
|
||||
<!-- Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. These change logs are helpful for better ant faster reviews.)
|
||||
|
||||
For example:
|
||||
|
||||
|
|
@ -51,12 +51,11 @@ For example:
|
|||
|
||||
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
|
||||
|
||||
- [ ] Dependencies ([add/update license](https://hugegraph.apache.org/docs/contribution-guidelines/contribute/#321-check-licenses) info & [regenerate_dependencies](../hugegraph-server/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh)) <!-- Don't forget to add/update the info in "LICENSE" & "NOTICE" files (both in root & dist module) -->
|
||||
- [ ] Nope
|
||||
- [ ] Dependencies (add/update license info) <!-- Don't forget to add/update the info in "LICENSE" & "NOTICE" files (both in root & dist module) -->
|
||||
- [ ] Modify configurations
|
||||
- [ ] The public API
|
||||
- [ ] Other affects (typed here)
|
||||
- [ ] Nope
|
||||
|
||||
|
||||
## Documentation Status
|
||||
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
|
||||
<servers>
|
||||
<server>
|
||||
<id>github</id>
|
||||
<username>${env.GITHUB_ACTOR}</username>
|
||||
<password>${env.GITHUB_TOKEN}</password>
|
||||
</server>
|
||||
</servers>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>local-repo</id>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>central</id>
|
||||
<url>https://repo.maven.apache.org/maven2</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>staged-releases</id>
|
||||
<url>https://repository.apache.org/content/groups/staging/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>staged-releases</id>
|
||||
<url>https://repository.apache.org/content/groups/staging/</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<activeProfiles>
|
||||
<activeProfile>local-repo</activeProfile>
|
||||
</activeProfiles>
|
||||
</settings>
|
||||
|
|
@ -115,7 +115,7 @@ env:
|
|||
global:
|
||||
- RELEASE_BRANCH=^release-.*$
|
||||
- RELEASE_TAG=^v[0-9]\..*$
|
||||
- TRAVIS_DIR=hugegraph-server/hugegraph-dist/src/assembly/travis
|
||||
- TRAVIS_DIR=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=
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ on:
|
|||
branches:
|
||||
- /^release-.*$/
|
||||
pull_request:
|
||||
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
|
|
@ -13,26 +13,18 @@ jobs:
|
|||
dependency-check:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
USE_STAGE: 'true' # Whether to include the stage repository.
|
||||
SCRIPT_DEPENDENCY: install-dist/scripts/dependency
|
||||
SCRIPT_DEPENDENCY: hugegraph-dist/scripts/dependency
|
||||
steps:
|
||||
- name: Checkout source
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
- 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 -Dmaven.test.skip=true -ntp
|
||||
mvn install -DskipTests=true -ntp
|
||||
- name: generate current dependencies
|
||||
run: |
|
||||
bash $SCRIPT_DEPENDENCY/regenerate_known_dependencies.sh current-dependencies.txt
|
||||
|
|
@ -44,13 +36,12 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Checkout Repository'
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
- name: 'Dependency Review'
|
||||
uses: actions/dependency-review-action@v3
|
||||
# Refer: https://github.com/actions/dependency-review-action
|
||||
with:
|
||||
# TODO: reset critical to low before releasing
|
||||
fail-on-severity: critical
|
||||
fail-on-severity: low
|
||||
# Action will fail if dependencies don't match the list
|
||||
#allow-licenses: Apache-2.0, MIT
|
||||
#deny-licenses: GPL-3.0, AGPL-1.0, AGPL-3.0, LGPL-2.0, CC-BY-3.0
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
name: "HugeGraph-Server CI"
|
||||
name: "hugegraph-ci"
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
@ -9,46 +9,26 @@ on:
|
|||
pull_request:
|
||||
|
||||
jobs:
|
||||
build-server:
|
||||
# TODO: we need test & replace it to ubuntu-24.04 or ubuntu-latest
|
||||
build:
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
# TODO: reset use stage to false later
|
||||
USE_STAGE: 'true' # Whether to include the stage repository.
|
||||
TRAVIS_DIR: hugegraph-server/hugegraph-dist/src/assembly/travis
|
||||
TRAVIS_DIR: 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-') }}
|
||||
RAFT_MODE: ${{ startsWith(github.head_ref, 'test') || startsWith(github.head_ref, 'raft') }}
|
||||
RELEASE_BRANCH: ${{ startsWith(github.ref_name, 'release-') || startsWith(github.ref_name, 'test-') || startsWith(github.base_ref, 'release-') }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
BACKEND: [ memory, rocksdb, hbase, cassandra, mysql, postgresql, scylladb ]
|
||||
JAVA_VERSION: [ '11' ]
|
||||
BACKEND: [ memory, cassandra, scylladb, hbase, rocksdb, mysql, postgresql ]
|
||||
JAVA_VERSION: [ '8', '11' ]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 5
|
||||
|
||||
# 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 }}
|
||||
- name: Install JDK ${{ matrix.JAVA_VERSION }}
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.JAVA_VERSION }}
|
||||
|
|
@ -61,16 +41,30 @@ jobs:
|
|||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-m2
|
||||
|
||||
- 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: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- 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
|
||||
|
|
@ -83,9 +77,8 @@ 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.RAFT_MODE == 'true' && env.BACKEND == 'rocksdb' }}
|
||||
if: ${{ env.BACKEND == 'rocksdb' }}
|
||||
run: |
|
||||
$TRAVIS_DIR/run-api-test-for-raft.sh $BACKEND $REPORT_DIR
|
||||
|
||||
|
|
@ -95,7 +88,6 @@ jobs:
|
|||
$TRAVIS_DIR/run-tinkerpop-test.sh $BACKEND tinkerpop
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
uses: codecov/codecov-action@v3.0.0
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
file: ${{ env.REPORT_DIR }}/*.xml
|
||||
|
|
@ -4,15 +4,13 @@ on:
|
|||
push:
|
||||
branches: [ master, release-* ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
# branches: [ master ] # enable in all PRs
|
||||
# The branches below must be a subset of the branches above
|
||||
# branches: [ master ] # enable in all PR
|
||||
schedule:
|
||||
- cron: '33 0 * * 5'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
env:
|
||||
USE_STAGE: 'true' # Whether to include the stage repository.
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
|
|
@ -27,7 +25,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Java JDK
|
||||
uses: actions/setup-java@v3
|
||||
|
|
@ -35,12 +33,6 @@ 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
|
||||
|
|
|
|||
|
|
@ -1,64 +0,0 @@
|
|||
name: "HugeGraph-Commons CI"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- /^release-.*$/
|
||||
- /^test-.*$/
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build-commons:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# TODO: reset use stage to false later
|
||||
USE_STAGE: 'true' # Whether to include the stage repository.
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
JAVA_VERSION: ['11']
|
||||
|
||||
steps:
|
||||
- name: Install JDK ${{ matrix.JAVA_VERSION }}
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.JAVA_VERSION }}
|
||||
distribution: 'zulu'
|
||||
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.m2
|
||||
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 compile -Dmaven.javadoc.skip=true -ntp
|
||||
|
||||
- name: Run common test
|
||||
run: |
|
||||
mvn test -pl hugegraph-commons/hugegraph-common -Dtest=UnitTestSuite
|
||||
|
||||
- name: Run rpc test
|
||||
run: |
|
||||
mvn test -pl hugegraph-commons/hugegraph-rpc -Dtest=UnitTestSuite
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v3.0.0
|
||||
with:
|
||||
file: target/jacoco.xml
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
name: "License Checker"
|
||||
name: "License checker"
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
@ -10,10 +10,8 @@ on:
|
|||
jobs:
|
||||
check-license:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
USE_STAGE: 'true' # Whether to include the stage repository.
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Check License Header
|
||||
uses: apache/skywalking-eyes@main
|
||||
|
|
@ -24,7 +22,12 @@ jobs:
|
|||
token: ${{ github.token }}
|
||||
config: .licenserc.yaml
|
||||
|
||||
- name: License Check (RAT)
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
|
||||
- name: License check(RAT)
|
||||
run: |
|
||||
mvn apache-rat:check -ntp
|
||||
find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt
|
||||
|
|
|
|||
|
|
@ -1,219 +0,0 @@
|
|||
name: "HugeGraph-PD & Store & Hstore CI"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- 'release-*'
|
||||
- 'test-*'
|
||||
pull_request:
|
||||
|
||||
# TODO: consider merge to one ci.yml file
|
||||
jobs:
|
||||
pd:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# TODO: avoid duplicated env setup in pd & store
|
||||
# TODO: reset use stage to false later
|
||||
USE_STAGE: 'true' # Whether to include the stage repository.
|
||||
# TODO: remove outdated env
|
||||
TRAVIS_DIR: hugegraph-server/hugegraph-dist/src/assembly/travis
|
||||
REPORT_DIR: target/site/jacoco
|
||||
|
||||
steps:
|
||||
- name: Install JDK 11
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'zulu'
|
||||
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-m2
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 5
|
||||
|
||||
- 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: Run common test
|
||||
run: |
|
||||
mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-common-test -DskipCommonsTests=true
|
||||
|
||||
- name: Run core test
|
||||
run: |
|
||||
mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-core-test -DskipCommonsTests=true
|
||||
|
||||
# The above tests do not require starting a PD instance.
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
mvn clean package -U -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -ntp
|
||||
|
||||
- name: Prepare env and service
|
||||
run: |
|
||||
$TRAVIS_DIR/start-pd.sh
|
||||
|
||||
- name: Run client test
|
||||
run: |
|
||||
mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-client-test -DskipCommonsTests=true
|
||||
|
||||
- name: Run rest test
|
||||
run: |
|
||||
mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-rest-test -DskipCommonsTests=true
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v3.0.0
|
||||
with:
|
||||
file: ${{ env.REPORT_DIR }}/*.xml
|
||||
|
||||
store:
|
||||
# TODO: avoid duplicated env setup
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
USE_STAGE: 'true' # Whether to include the stage repository.
|
||||
# TODO: remove outdated env
|
||||
TRAVIS_DIR: hugegraph-server/hugegraph-dist/src/assembly/travis
|
||||
REPORT_DIR: target/site/jacoco
|
||||
|
||||
steps:
|
||||
- name: Install JDK 11
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'zulu'
|
||||
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-m2
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 5
|
||||
|
||||
- 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: Package
|
||||
run: |
|
||||
mvn clean package -U -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -ntp
|
||||
|
||||
- name: Prepare env and service
|
||||
run: |
|
||||
$TRAVIS_DIR/start-pd.sh
|
||||
$TRAVIS_DIR/start-store.sh
|
||||
|
||||
- name: Run common test
|
||||
run: |
|
||||
mvn test -pl hugegraph-store/hg-store-test -am -P store-common-test -DskipCommonsTests=true
|
||||
|
||||
- name: Run client test
|
||||
run: |
|
||||
mvn test -pl hugegraph-store/hg-store-test -am -P store-client-test -DskipCommonsTests=true
|
||||
|
||||
- name: Run core test
|
||||
run: |
|
||||
mvn test -pl hugegraph-store/hg-store-test -am -P store-core-test -DskipCommonsTests=true
|
||||
|
||||
- name: Run rocksdb test
|
||||
run: |
|
||||
mvn test -pl hugegraph-store/hg-store-test -am -P store-rocksdb-test -DskipCommonsTests=true
|
||||
|
||||
- name: Run server test
|
||||
run: |
|
||||
mvn test -pl hugegraph-store/hg-store-test -am -P store-server-test -DskipCommonsTests=true
|
||||
|
||||
- name: Run raft-core test
|
||||
run: |
|
||||
mvn test -pl hugegraph-store/hg-store-test -am -P store-raftcore-test -DskipCommonsTests=true
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v3.0.0
|
||||
with:
|
||||
file: ${{ env.REPORT_DIR }}/*.xml
|
||||
|
||||
hstore:
|
||||
# TODO: avoid duplicated env setup
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
USE_STAGE: 'true' # Whether to include the stage repository.
|
||||
TRAVIS_DIR: hugegraph-server/hugegraph-dist/src/assembly/travis
|
||||
REPORT_DIR: target/site/jacoco
|
||||
BACKEND: hstore
|
||||
RELEASE_BRANCH: ${{ startsWith(github.ref_name, 'release-') || startsWith(github.ref_name, 'test-') || startsWith(github.base_ref, 'release-') }}
|
||||
|
||||
steps:
|
||||
- name: Install JDK 11
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'zulu'
|
||||
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.m2
|
||||
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
|
||||
mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
mvn clean package -U -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -ntp
|
||||
|
||||
- name: Prepare env and service
|
||||
run: |
|
||||
$TRAVIS_DIR/install-backend.sh $BACKEND
|
||||
|
||||
- name: Run unit test
|
||||
run: |
|
||||
$TRAVIS_DIR/run-unit-test.sh $BACKEND
|
||||
|
||||
- name: Run core test
|
||||
run: |
|
||||
$TRAVIS_DIR/run-core-test.sh $BACKEND
|
||||
|
||||
- name: Run api test
|
||||
run: |
|
||||
$TRAVIS_DIR/run-api-test.sh $BACKEND $REPORT_DIR
|
||||
|
||||
- name: Run raft test
|
||||
if: ${{ env.BACKEND == 'rocksdb' }}
|
||||
run: |
|
||||
$TRAVIS_DIR/run-api-test-for-raft.sh $BACKEND $REPORT_DIR
|
||||
|
||||
- name: Run TinkerPop test
|
||||
if: ${{ env.RELEASE_BRANCH == 'true' }}
|
||||
run: |
|
||||
$TRAVIS_DIR/run-tinkerpop-test.sh $BACKEND tinkerpop
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v3.0.0
|
||||
with:
|
||||
file: ${{ env.REPORT_DIR }}/*.xml
|
||||
|
|
@ -29,7 +29,7 @@ jobs:
|
|||
days-before-pr-stale: 30
|
||||
days-before-pr-close: 180
|
||||
operations-per-run: 10
|
||||
start-date: '2016-10-01T00:00:00Z'
|
||||
start-date: '2017-10-01T00:00:00Z'
|
||||
|
||||
exempt-all-assignees: true
|
||||
remove-stale-when-updated: true
|
||||
|
|
|
|||
|
|
@ -19,9 +19,8 @@ gen-java
|
|||
.svn
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/*
|
||||
!.idea/vcs.xml
|
||||
!.idea/icon.png
|
||||
.idea
|
||||
.idea/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
|
@ -57,7 +56,7 @@ build/
|
|||
*.pyc
|
||||
|
||||
# maven ignore
|
||||
apache-hugegraph-*/
|
||||
apache-hugegraph-incubating-*/
|
||||
output/
|
||||
*.war
|
||||
*.zip
|
||||
|
|
@ -84,6 +83,3 @@ hs_err_pid*
|
|||
.mtj.tmp/
|
||||
# blueJ files
|
||||
*.ctxt
|
||||
|
||||
# docker volumes ignore
|
||||
hugegraph-server/hugegraph-dist/docker/data/
|
||||
|
|
|
|||
BIN
.idea/icon.png
BIN
.idea/icon.png
Binary file not shown.
|
Before Width: | Height: | Size: 8.3 KiB |
|
|
@ -1,37 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<project version="4">
|
||||
<component name="IssueNavigationConfiguration">
|
||||
<option name="links">
|
||||
<list>
|
||||
<IssueNavigationLink>
|
||||
<option name="issueRegexp" value="#(\d+)" />
|
||||
<!--
|
||||
GitHub share the sequence number of issues and pull requests, and it will redirect to
|
||||
the right place when the the sequence number not match kind.
|
||||
-->
|
||||
<option name="linkRegexp" value="https://github.com/apache/hugegraph/pull/$1" />
|
||||
</IssueNavigationLink>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -26,9 +26,7 @@ header: # `header` section is configurations for source codes license header.
|
|||
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.
|
||||
|
|
@ -36,20 +34,20 @@ header: # `header` section is configurations for source codes license header.
|
|||
limitations under the License.
|
||||
# `pattern` is optional regexp if all the file headers are the same as `license` or the license of `spdx-id` and `copyright-owner`.
|
||||
pattern: |
|
||||
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
|
||||
|
||||
Licensed to the Apache Software Foundation under one or more contributor
|
||||
license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright
|
||||
ownership. The Apache Software Foundation 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.
|
||||
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.
|
||||
paths: # `paths` are the path list that will be checked (and fixed) by license-eye, default is ['**'].
|
||||
- '**'
|
||||
|
||||
|
|
@ -70,7 +68,7 @@ header: # `header` section is configurations for source codes license header.
|
|||
- '**/*.properties'
|
||||
- '**/RaftRequests.java'
|
||||
- 'dist/**/*'
|
||||
- 'hugegraph-server/hugegraph-dist'
|
||||
- 'hugegraph-dist'
|
||||
- '**/assembly/static/bin/hugegraph.service'
|
||||
- 'scripts/dev/reviewers'
|
||||
- 'scripts/dev/reviewers'
|
||||
|
|
@ -91,15 +89,14 @@ header: # `header` section is configurations for source codes license header.
|
|||
- '**/META-INF/MANIFEST.MF'
|
||||
- '.repository/**'
|
||||
- '**/.flattened-pom.xml'
|
||||
- 'hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java'
|
||||
- 'hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java'
|
||||
- 'hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Nameable.java'
|
||||
- 'hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Cardinality.java'
|
||||
- 'hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java'
|
||||
- 'hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessBasicSuite.java'
|
||||
- 'hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureBasicSuite.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-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-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,
|
||||
|
|
|
|||
37
BUILDING.md
37
BUILDING.md
|
|
@ -1,35 +1,28 @@
|
|||
Building HugeGraph
|
||||
Building hugegraph
|
||||
--------------
|
||||
|
||||
Required:
|
||||
|
||||
* Java 11
|
||||
* Maven 3.5+
|
||||
|
||||
To build without executing tests: `mvn clean package -Dmaven.test.skip=true`
|
||||
|
||||
## Building in IDEA
|
||||
* Java 8/11
|
||||
* Maven
|
||||
|
||||
To build without executing tests:
|
||||
|
||||
1. Click on "File" -> "Open", choose your project location.
|
||||
2. Open maven view by click "View" -> "Tool Windows" -> "Maven Projects".
|
||||
3. Choose root module "hugegraph: Distributed Graph Database", unfold the menu of "Lifecycle".
|
||||
4. Click the "Toggle 'Skip Tests' Mode" button which is located on the top navibar of "Maven Projects" window to skip tests.
|
||||
5. Double click "package" or "install" to build a project.
|
||||
```
|
||||
mvn clean
|
||||
mvn package -DskipTests
|
||||
```
|
||||
|
||||
Could also refer [Dev-In-IDEA](https://hugegraph.apache.org/docs/contribution-guidelines/hugegraph-server-idea-setup/) for more details.
|
||||
## Building on Eclipse IDE
|
||||
Note that this has only been tested on Eclipse Neon.2 Release (4.6.2) with m2e (1.7.0.20160603-1933) and m2e-wtp (1.3.1.20160831-1005) plugin.
|
||||
|
||||
## Building in Eclipse
|
||||
|
||||
> Note: this has only been tested on Eclipse Neon.2 Release (4.6.2) with m2e (1.7.0.20160603-1933) and m2e-wtp (1.3.1.20160831-1005) plugin.
|
||||
|
||||
To build without executing tests:
|
||||
|
||||
1. Right-click on your project -> "Run As..." -> "Run Configurations..."
|
||||
2. On "Goals", populate with `install`
|
||||
3. Select the options `Update Snapshots` and `Skip Tests`
|
||||
4. Before clicking "Run", make sure that Eclipse knows where `JAVA_HOME` is. In the same window, go to "Environment" tab and click "New".
|
||||
4. Before clicking "Run", make sure that Eclipse knows where `JAVA_HOME` is. On same window, go to "Environment" tab and click "New".
|
||||
5. Under "Name:", add `JAVA_HOME`
|
||||
6. Under "Value:", add the path where `java` is located
|
||||
7. Click "OK"
|
||||
|
|
@ -39,3 +32,13 @@ To find the Java binary in your environment, run the appropriate command for you
|
|||
* Linux/macOS: `which java`
|
||||
* Windows: `for %i in (java.exe) do @echo. %~$PATH:i`
|
||||
|
||||
## Building on IDEA
|
||||
|
||||
To build without executing tests:
|
||||
|
||||
1. Click on "File" -> "Open", choose your project location.
|
||||
2. Open maven view by click "View" -> "Tool Windows" -> "Maven Projects".
|
||||
3. Choose root module "hugegraph: Distributed Graph Database", unfold the menu of "Lifecycle".
|
||||
4. Click the "Toggle 'Skip Tests' Mode" button which is located on the top
|
||||
navibar of "Maven Projects" window to skip tests.
|
||||
5. Double click "package" or "install" to build project.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
# How to Contribute to HugeGraph
|
||||
|
||||
> Refer [website-doc](https://hugegraph.apache.org/docs/contribution-guidelines/) for the latest information.
|
||||
|
||||
Thanks for taking the time to contribute!
|
||||
As an open source project, HugeGraph is looking forward to being contributed from everyone, and we are also grateful to all the contributors.
|
||||
Thanks for taking the time to contribute! As an open source project, HugeGraph is looking forward to be contributed from everyone,
|
||||
and we are also grateful to all the contributors.
|
||||
|
||||
The following is a contribution guide for HugeGraph:
|
||||
|
||||
|
|
@ -17,7 +15,7 @@ We can contribute by reporting issues, submitting code patches or any other feed
|
|||
|
||||
Before submitting the code, we need to do some preparation:
|
||||
|
||||
1. Sign up or login to GitHub: [https://github.com](https://github.com)
|
||||
1. Sign up or login to GitHub: [https://github.com](https://github.com)
|
||||
|
||||
2. Fork HugeGraph repo from GitHub: [https://github.com/apache/incubator-hugegraph/fork](https://github.com/apache/incubator-hugegraph/fork)
|
||||
|
||||
|
|
@ -66,26 +64,26 @@ Assume that we need to modify some files like "HugeGraph.java" and "HugeFactory.
|
|||
|
||||
```shell
|
||||
# modify code to fix a bug
|
||||
vim hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java
|
||||
vim hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java
|
||||
vim hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java
|
||||
vim hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java
|
||||
# run test locally (optional)
|
||||
mvn test -Pcore-test,memory
|
||||
```
|
||||
Note: To be consistent with the code style easily, if you use [IDEA](https://www.jetbrains.com/idea/) as your IDE, you can directly [import](https://www.jetbrains.com/help/idea/configuring-code-style.html) our code style [configuration file](./hugegraph-style.xml).
|
||||
Note: In order to be consistent with the code style easily, if you use [IDEA](https://www.jetbrains.com/idea/) as your IDE, you can directly [import](https://www.jetbrains.com/help/idea/configuring-code-style.html) our code style [configuration file](./hugegraph-style.xml).
|
||||
|
||||
##### 3.2.1 Check licenses
|
||||
If we want to add new third-party dependencies to the `HugeGraph` project, we need to do the following things:
|
||||
1. Find the third-party dependent repository, put the dependent `license` file into [./hugegraph-dist/release-docs/licenses/](https://github.com/apache/incubator-hugegraph/tree/master/hugegraph-dist/release-docs/licenses) path.
|
||||
2. Declare the dependency in [./hugegraph-server/hugegraph-dist/release-docs/LICENSE](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/release-docs/LICENSE) `LICENSE` information.
|
||||
3. Find the NOTICE file in the repository and append it to [./hugegraph-server/hugegraph-dist/release-docs/NOTICE](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/release-docs/NOTICE) file (skip this step if there is no NOTICE file).
|
||||
4. Execute locally [./hugegraph-server/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh) to update the dependency list [known-dependencies.txt](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/scripts/dependency/known-dependencies.txt) (or manually update).
|
||||
2. Declare the dependency in [./hugegraph-dist/release-docs/LICENSE](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/release-docs/LICENSE) `LICENSE` information.
|
||||
3. Find the NOTICE file in the repository and append it to [./hugegraph-dist/release-docs/NOTICE](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/release-docs/NOTICE) file (skip this step if there is no NOTICE file).
|
||||
4. Execute locally [./hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh) to update the dependency list [known-dependencies.txt](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/scripts/dependency/known-dependencies.txt) (or manually update) .
|
||||
|
||||
**Example**: A new third-party dependency is introduced into the project -> `ant-1.9.1.jar`
|
||||
- The project source code is located at: https://github.com/apache/ant/tree/rel/1.9.1
|
||||
- LICENSE file: https://github.com/apache/ant/blob/rel/1.9.1/LICENSE
|
||||
- NOTICE file: https://github.com/apache/ant/blob/rel/1.9.1/NOTICE
|
||||
|
||||
The license information of `ant-1.9.1.jar` needs to be specified in the LICENSE file, and the notice information needs to be specified in the NOTICE file. The detailed LICENSE file corresponding to ant-1.9.1.jar needs to be copied to our licenses/ directory. Finally, update the known-dependencies.txt file.
|
||||
The license information of `ant-1.9.1.jar` needs to be specified in the LICENSE file, and the notice information needs to be specified in the NOTICE file. The detailed LICENSE file corresponding to ant-1.9.1.jar needs to be copied to our licenses/ directory. Finally update the known-dependencies.txt file.
|
||||
|
||||
#### 3.3 Commit changes to git repo
|
||||
|
||||
|
|
@ -93,8 +91,8 @@ After the code has been completed, we submit them to the local git repo:
|
|||
|
||||
```shell
|
||||
# add files to local git index
|
||||
git add hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java
|
||||
git add hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java
|
||||
git add hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java
|
||||
git add hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java
|
||||
# commit to local git repo
|
||||
git commit
|
||||
```
|
||||
|
|
@ -107,7 +105,7 @@ Fix bug: run deploy multiple times
|
|||
fix #ISSUE_ID
|
||||
```
|
||||
|
||||
> Please remember to fill in the issue id, which GitHub generated after issue creation.
|
||||
> Please remember to fill in the issue id, which was generated by GitHub after issue creation.
|
||||
|
||||
#### 3.4 Push commit to GitHub fork repo
|
||||
|
||||
|
|
@ -123,7 +121,7 @@ Note that since GitHub requires submitting code through `username + token` (inst
|
|||
|
||||
## 4. Create a Pull Request
|
||||
|
||||
Go to the web page of GitHub fork repo, there would be a chance to create a Pull Request after pushing to a new branch, click the button "Compare & pull request" to do it. Then edit the description for proposed changes, which can just be copied from the commit message.
|
||||
Go to the web page of GitHub fork repo, there would be a chance to create a Pull Request after pushing to a new branch, just click button "Compare & pull request" to do it. Then edit the description for proposed changes, which can just be copied from the commit message.
|
||||
|
||||
Note: please make sure the email address you used to submit the code is bound to the GitHub account. For how to bind the email address, please refer to https://github.com/settings/emails:
|
||||
<img width="1280" alt="image" src="https://user-images.githubusercontent.com/9625821/163522445-2a50a72a-dea2-434f-9868-3a0d40d0d037.png">
|
||||
|
|
@ -133,7 +131,7 @@ Note: please make sure the email address you used to submit the code is bound to
|
|||
Maintainers will start the code review after all the **automatic** checks are passed:
|
||||
|
||||
- Check: Contributor License Agreement is signed
|
||||
- Check: Travis CI builds are passed (automatically Test and Deploy)
|
||||
- Check: Travis CI builds is passed (automatically Test and Deploy)
|
||||
|
||||
The commit will be accepted and merged if there is no problem after review.
|
||||
|
||||
|
|
@ -173,8 +171,8 @@ And push it to GitHub fork repo again:
|
|||
git push -f origin bugfix-branch:bugfix-branch
|
||||
```
|
||||
|
||||
GitHub will automatically update the Pull Request after we push it, wait for code review.
|
||||
GitHub will automatically update the Pull Request after we push it, just wait for code review.
|
||||
|
||||
For Any question, please contact us through [dev@hugegraph.apache.org](mailto:dev@hugegraph.apache.org) ([subscriber](https://hugegraph.apache.org/docs/contribution-guidelines/subscribe/) only)
|
||||
Any question please contact to us through [hugegraph@googlegroups.com](mailto:hugegraph@googlegroups.com) or [other contact information](https://hugegraph.github.io/hugegraph-doc/).
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,32 +15,29 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
# Dockerfile for HugeGraph PD
|
||||
# Dockerfile for HugeGraph Server
|
||||
# 1st stage: build source code
|
||||
FROM maven:3.9.0-eclipse-temurin-11 AS build
|
||||
|
||||
COPY . /pkg
|
||||
WORKDIR /pkg
|
||||
ARG MAVEN_ARGS
|
||||
|
||||
RUN mvn package $MAVEN_ARGS -e -B -ntp -Dmaven.test.skip=true -Dmaven.javadoc.skip=true && pwd && ls -l && rm \
|
||||
./hugegraph-server/*.tar.gz && rm ./hugegraph-pd/*.tar.gz && rm ./hugegraph-store/*.tar.gz
|
||||
RUN mvn package -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true && pwd && ls -l
|
||||
|
||||
# 2nd stage: runtime env
|
||||
# Note: ZGC (The Z Garbage Collector) is only supported on ARM-Mac with java > 13
|
||||
FROM openjdk:11-slim
|
||||
|
||||
COPY --from=build /pkg/hugegraph-pd/apache-hugegraph-pd-incubating-*/ /hugegraph-pd/
|
||||
# TODO: get the version from the pom.xml
|
||||
ENV version=1.0.0
|
||||
COPY --from=build /pkg/apache-hugegraph-incubating-$version/ /hugegraph
|
||||
LABEL maintainer="HugeGraph Docker Maintainers <dev@hugegraph.apache.org>"
|
||||
|
||||
# TODO: use g1gc or zgc as default
|
||||
ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport -XX:MaxRAMPercentage=50 -XshowSettings:vm" \
|
||||
HUGEGRAPH_HOME="hugegraph-pd"
|
||||
HUGEGRAPH_HOME="hugegraph"
|
||||
|
||||
#COPY . /hugegraph/hugegraph-pd
|
||||
WORKDIR /hugegraph-pd/
|
||||
#COPY . /hugegraph/hugegraph-server
|
||||
WORKDIR /hugegraph/
|
||||
|
||||
# 1. Install environment and init HugeGraph Sever
|
||||
# 1. Install environment
|
||||
RUN set -x \
|
||||
&& apt-get -q update \
|
||||
&& apt-get -q install -y --no-install-recommends --no-install-suggests \
|
||||
|
|
@ -48,19 +45,22 @@ RUN set -x \
|
|||
procps \
|
||||
curl \
|
||||
lsof \
|
||||
vim \
|
||||
cron \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& service cron start \
|
||||
&& pwd && cd /hugegraph-pd/
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 2. Init docker script
|
||||
COPY hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh .
|
||||
RUN chmod 755 ./docker-entrypoint.sh
|
||||
# 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
|
||||
|
||||
EXPOSE 8620
|
||||
VOLUME /hugegraph-pd
|
||||
# 3. Init docker script
|
||||
COPY hugegraph-dist/docker/scripts/remote-connect.groovy ./scripts
|
||||
COPY hugegraph-dist/docker/scripts/detect-storage.groovy ./scripts
|
||||
COPY hugegraph-dist/docker/docker-entrypoint.sh .
|
||||
RUN chmod 755 ./docker-entrypoint.sh
|
||||
|
||||
EXPOSE 8080
|
||||
VOLUME /hugegraph
|
||||
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
CMD ["./docker-entrypoint.sh"]
|
||||
19
LICENSE
19
LICENSE
|
|
@ -207,12 +207,13 @@ Apache 2.0 licenses
|
|||
The following components are provided under the Apache License. See project link for details.
|
||||
The text of each license is the standard Apache 2.0 license.
|
||||
|
||||
hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureBasicSuite.java from https://github.com/apache/tinkerpop
|
||||
hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/ProcessBasicSuite.java from https://github.com/apache/tinkerpop
|
||||
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java from https://github.com/twitter-archive/snowflake
|
||||
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java from https://github.com/apache/tinkerpop
|
||||
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/Nameable.java from https://github.com/JanusGraph/janusgraph
|
||||
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/type/define/Cardinality.java from https://github.com/JanusGraph/janusgraph
|
||||
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java from https://github.com/JanusGraph/janusgraph
|
||||
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java from https://github.com/opencypher/cypher-for-gremlin
|
||||
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java from https://github.com/opencypher/cypher-for-gremlin
|
||||
hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/StructureBasicSuite.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-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java from https://github.com/twitter-archive/snowflake
|
||||
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeScriptTraversal.java from https://github.com/apache/tinkerpop
|
||||
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
|
||||
|
|
|
|||
40
NOTICE
40
NOTICE
|
|
@ -1,5 +1,5 @@
|
|||
Apache HugeGraph(incubating)
|
||||
Copyright 2022-2024 The Apache Software Foundation
|
||||
Copyright 2022-2023 The Apache Software Foundation
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
|
|
@ -13,6 +13,9 @@ This product contains code form the Apache TinkerPop Project:
|
|||
Apache TinkerPop
|
||||
Copyright 2015-2022 The Apache Software Foundation.
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Activiti
|
||||
------------------------------------------------------------------------
|
||||
|
|
@ -39,7 +42,7 @@ This product contains code form the JanusGraph Project:
|
|||
-----------------------------------------------------------------------
|
||||
==============================================================
|
||||
JanusGraph: Distributed Graph Database
|
||||
Copyright 2012 with JanusGraph Authors
|
||||
Copyright 2012 and onwards JanusGraph Authors
|
||||
==============================================================
|
||||
|
||||
This product includes software developed by JanusGraph contributors listed
|
||||
|
|
@ -53,3 +56,36 @@ DataStax) and the following individuals:
|
|||
* Marko A. Rodriguez
|
||||
* Stephen Mallette
|
||||
* Pavel Yaskevich
|
||||
|
||||
It also includes software from other open source projects including, but not limited to (check pom.xml for complete listing):
|
||||
|
||||
* Apache Cassandra [https://cassandra.apache.org/]
|
||||
* Apache Commons [https://commons.apache.org/]
|
||||
* Apache Groovy [http://groovy-lang.org/]
|
||||
* Apache HBase [https://hbase.apache.org/]
|
||||
* Apache Hadoop [https://hadoop.apache.org/]
|
||||
* Apache Kerby [https://github.com/apache/directory-kerby]
|
||||
* Apache Log4j [https://logging.apache.org/log4j]
|
||||
* Apache Lucene [https://lucene.apache.org/]
|
||||
* Apache Solr [https://lucene.apache.org/solr/]
|
||||
* Apache TinkerPop [https://tinkerpop.apache.org/]
|
||||
* Astyanax [https://github.com/Netflix/astyanax]
|
||||
* DataStax Driver for Apache Cassandra [https://github.com/datastax/java-driver]
|
||||
* EasyMock [http://easymock.org/]
|
||||
* Elasticsearch [https://www.elastic.co/]
|
||||
* Google Cloud Bigtable [https://github.com/googlecloudplatform/cloud-bigtable-client]
|
||||
* Google Guava [https://github.com/google/guava]
|
||||
* HPPC [https://labs.carrotsearch.com/hppc.html]
|
||||
* JUnit [https://www.junit.org/]
|
||||
* Jackson [https://github.com/FasterXML/jackson]
|
||||
* Kryo [https://github.com/EsotericSoftware/kryo]
|
||||
* Metrics [https://metrics.dropwizard.io]
|
||||
* Mockito [https://site.mockito.org/]
|
||||
* Noggit [https://github.com/yonik/noggit]
|
||||
* OpenRDF [http://rdf4j.org/]
|
||||
* Oracle BerkeleyDB Java Edition [https://www.oracle.com/technetwork/products/berkeleydb/] (see license below)
|
||||
* Project Lombok [https://projectlombok.org/]
|
||||
* Reflections8 [https://github.com/aschoerk/reflections8]
|
||||
* SLF4J [https://www.slf4j.org/]
|
||||
* Spatial4j [https://github.com/locationtech/spatial4j]
|
||||
* Vavr [https://www.vavr.io/]
|
||||
|
|
|
|||
40
README.md
40
README.md
|
|
@ -8,17 +8,18 @@
|
|||
|
||||
[](https://www.apache.org/licenses/LICENSE-2.0.html)
|
||||
[](https://github.com/apache/incubator-hugegraph/actions/workflows/ci.yml)
|
||||
[](https://github.com/apache/incubator-hugegraph/actions/workflows/codeql-analysis.yml)
|
||||
[](https://github.com/apache/incubator-hugegraph/actions/workflows/licence-checker.yml)
|
||||
[](https://app.codecov.io/gh/apache/incubator-hugegraph)
|
||||
[](https://github.com/apache/hugegraph/releases)
|
||||
[](https://github.com/apache/incubator-hugegraph/stargazers)
|
||||
|
||||
</div>
|
||||
|
||||
## What is Apache HugeGraph?
|
||||
|
||||
[HugeGraph](https://hugegraph.apache.org/) is a fast-speed and highly-scalable [graph database](https://en.wikipedia.org/wiki/Graph_database).
|
||||
Billions of vertices and edges can be easily stored into and queried from HugeGraph due to its excellent OLTP ability.
|
||||
As compliance to [Apache TinkerPop 3](https://tinkerpop.apache.org/) framework, various complicated graph queries can be
|
||||
achieved through [Gremlin](https://tinkerpop.apache.org/gremlin.html)(a powerful graph traversal language).
|
||||
Billions of vertices and edges can be easily stored into and queried from HugeGraph due to its excellent OLTP ability. As compliance to [Apache TinkerPop 3](https://tinkerpop.apache.org/) framework, various complicated graph queries can be accomplished through [Gremlin](https://tinkerpop.apache.org/gremlin.html)(a powerful graph traversal language).
|
||||
|
||||
|
||||
## Features
|
||||
|
|
@ -26,28 +27,25 @@ achieved through [Gremlin](https://tinkerpop.apache.org/gremlin.html)(a powerful
|
|||
- Compliance to [Apache TinkerPop 3](https://tinkerpop.apache.org/), support [Gremlin](https://tinkerpop.apache.org/gremlin.html) & [Cypher](https://en.wikipedia.org/wiki/Cypher) language
|
||||
- Schema Metadata Management, including VertexLabel, EdgeLabel, PropertyKey and IndexLabel
|
||||
- Multi-type Indexes, supporting exact query, range query and complex conditions combination query
|
||||
- Plug-in Backend Store Driver Framework, support `RocksDB`, `Cassandra`, `HBase`, `ScyllaDB`, and `MySQL/Postgre` now and easy to add another backend store driver if needed
|
||||
- Plug-in Backend Store Driver Framework, support `RocksDB`, `Cassandra`, `HBase`, `ScyllaDB`, and `MySQL/Postgre` now and easy to add other backend store driver if needed
|
||||
- Integration with `Flink/Spark/HDFS`, and friendly to connect other big data platforms
|
||||
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Docker Way (Convenient for Test)
|
||||
### 1. Docker Way
|
||||
|
||||
We can use `docker run -itd --name=graph -p 8080:8080 hugegraph/hugegraph` to quickly start an inner
|
||||
HugeGraph server with `RocksDB` (in backgrounds) for **test/dev**.
|
||||
You can visit [doc page](https://hugegraph.apache.org/docs/quickstart/hugegraph-server/#3-deploy) or
|
||||
the [README](hugegraph-server/hugegraph-dist/docker/README.md) for more details. ([Docker Compose](./hugegraph-server/hugegraph-dist/docker/example))
|
||||
HugeGraph server with `RocksDB` in background.
|
||||
|
||||
> Note:
|
||||
>
|
||||
> 1. The docker image of hugegraph is a convenience release, but not **official distribution** artifacts. You can find more details from [ASF Release Distribution Policy](https://infra.apache.org/release-distribution.html#dockerhub).
|
||||
>
|
||||
> 2. Recommend to use `release tag`(like `1.2.0`) for the stable version. Use `latest` tag to experience the newest functions in development.
|
||||
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
|
||||
|
||||
Visit [Download Page](https://hugegraph.apache.org/docs/download/download/) and refer the [doc](https://hugegraph.apache.org/docs/quickstart/hugegraph-server/#32-download-the-binary-tar-tarball)
|
||||
Visit [Download Page](https://hugegraph.apache.org/docs/download/download/) and refer the [doc](https://hugegraph.apache.org/docs/quickstart/hugegraph-server/#33-source-code-compilation)
|
||||
to download the latest release package and start the server.
|
||||
|
||||
### 3. Source Building Way
|
||||
|
|
@ -59,15 +57,14 @@ 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/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/hugegraph-computer) (integrated **graph computing** system)
|
||||
3. [hugegraph-commons](https://github.com/apache/hugegraph-commons) (**common & rpc** libs)
|
||||
4. [hugegraph-website](https://github.com/apache/hugegraph-doc) (**doc & website** code)
|
||||
5. [hugegraph-ai](https://github.com/apache/incubator-hugegraph-ai) (integrated **Graph AI/LLM/KG** system)
|
||||
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
|
||||
|
||||
HugeGraph is licensed under [Apache 2.0 License](LICENSE).
|
||||
HugeGraph is licensed under Apache 2.0 License.
|
||||
|
||||
|
||||
## Contributing
|
||||
|
|
@ -84,8 +81,7 @@ HugeGraph is licensed under [Apache 2.0 License](LICENSE).
|
|||
HugeGraph relies on the [TinkerPop](http://tinkerpop.apache.org) framework, we refer to the storage structure of Titan and the schema definition of DataStax.
|
||||
Thanks to TinkerPop, thanks to Titan, thanks to DataStax. Thanks to all other organizations or authors who contributed to the project.
|
||||
|
||||
You are welcome to contribute to HugeGraph,
|
||||
and we are looking forward to working with you to build an excellent open-source community.
|
||||
You are welcome to contribute to HugeGraph, and we are looking forward to working with you to build an excellent open source community.
|
||||
|
||||
|
||||
## Contact Us
|
||||
|
|
|
|||
|
|
@ -1,63 +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.
|
||||
#
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: hugegraph-pd
|
||||
|
||||
management:
|
||||
metrics:
|
||||
export:
|
||||
prometheus:
|
||||
enabled: true
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
|
||||
logging:
|
||||
config: 'file:./conf/log4j2.xml'
|
||||
license:
|
||||
verify-path: ./conf/verify-license.json
|
||||
license-path: ./conf/hugegraph.license
|
||||
grpc:
|
||||
port: 8686
|
||||
host: 127.0.0.1
|
||||
|
||||
server:
|
||||
port: 8620
|
||||
|
||||
pd:
|
||||
data-path: ./pd_data
|
||||
patrol-interval: 1800
|
||||
initial-store-count: 3
|
||||
initial-store-list: 127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502
|
||||
|
||||
raft:
|
||||
address: 127.0.0.1:8610
|
||||
peers-list: 127.0.0.1:8610,127.0.0.1:8611,127.0.0.1:8612
|
||||
|
||||
store:
|
||||
max-down-time: 172800
|
||||
monitor_data_enabled: true
|
||||
monitor_data_interval: 1 minute
|
||||
monitor_data_retention: 1 day
|
||||
initial-store-count: 1
|
||||
|
||||
partition:
|
||||
default-shard-count: 1
|
||||
store-max-shard-count: 12
|
||||
|
|
@ -1,63 +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.
|
||||
#
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: hugegraph-pd
|
||||
|
||||
management:
|
||||
metrics:
|
||||
export:
|
||||
prometheus:
|
||||
enabled: true
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
|
||||
logging:
|
||||
config: 'file:./conf/log4j2.xml'
|
||||
license:
|
||||
verify-path: ./conf/verify-license.json
|
||||
license-path: ./conf/hugegraph.license
|
||||
grpc:
|
||||
port: 8687
|
||||
host: 127.0.0.1
|
||||
|
||||
server:
|
||||
port: 8621
|
||||
|
||||
pd:
|
||||
data-path: ./pd_data
|
||||
patrol-interval: 1800
|
||||
initial-store-count: 3
|
||||
initial-store-list: 127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502
|
||||
|
||||
raft:
|
||||
address: 127.0.0.1:8611
|
||||
peers-list: 127.0.0.1:8610,127.0.0.1:8611,127.0.0.1:8612
|
||||
|
||||
store:
|
||||
max-down-time: 172800
|
||||
monitor_data_enabled: true
|
||||
monitor_data_interval: 1 minute
|
||||
monitor_data_retention: 1 day
|
||||
initial-store-count: 1
|
||||
|
||||
partition:
|
||||
default-shard-count: 1
|
||||
store-max-shard-count: 12
|
||||
|
|
@ -1,63 +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.
|
||||
#
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: hugegraph-pd
|
||||
|
||||
management:
|
||||
metrics:
|
||||
export:
|
||||
prometheus:
|
||||
enabled: true
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
|
||||
logging:
|
||||
config: 'file:./conf/log4j2.xml'
|
||||
license:
|
||||
verify-path: ./conf/verify-license.json
|
||||
license-path: ./conf/hugegraph.license
|
||||
grpc:
|
||||
port: 8688
|
||||
host: 127.0.0.1
|
||||
|
||||
server:
|
||||
port: 8622
|
||||
|
||||
pd:
|
||||
data-path: ./pd_data
|
||||
patrol-interval: 1800
|
||||
initial-store-count: 3
|
||||
initial-store-list: 127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502
|
||||
|
||||
raft:
|
||||
address: 127.0.0.1:8612
|
||||
peers-list: 127.0.0.1:8610,127.0.0.1:8611,127.0.0.1:8612
|
||||
|
||||
store:
|
||||
max-down-time: 172800
|
||||
monitor_data_enabled: true
|
||||
monitor_data_interval: 1 minute
|
||||
monitor_data_retention: 1 day
|
||||
initial-store-count: 1
|
||||
|
||||
partition:
|
||||
default-shard-count: 1
|
||||
store-max-shard-count: 12
|
||||
|
|
@ -1,57 +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.
|
||||
#
|
||||
|
||||
pdserver:
|
||||
address: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
|
||||
|
||||
management:
|
||||
metrics:
|
||||
export:
|
||||
prometheus:
|
||||
enabled: true
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
|
||||
grpc:
|
||||
host: 127.0.0.1
|
||||
port: 8500
|
||||
netty-server:
|
||||
max-inbound-message-size: 1000MB
|
||||
raft:
|
||||
disruptorBufferSize: 1024
|
||||
address: 127.0.0.1:8510
|
||||
max-log-file-size: 600000000000
|
||||
snapshotInterval: 1800
|
||||
server:
|
||||
port: 8520
|
||||
|
||||
app:
|
||||
data-path: ./storage
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: store-node-grpc-server
|
||||
profiles:
|
||||
active: default
|
||||
include: pd
|
||||
|
||||
logging:
|
||||
config: 'file:./conf/log4j2.xml'
|
||||
level:
|
||||
root: info
|
||||
|
|
@ -1,57 +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.
|
||||
#
|
||||
|
||||
pdserver:
|
||||
address: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
|
||||
|
||||
management:
|
||||
metrics:
|
||||
export:
|
||||
prometheus:
|
||||
enabled: true
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
|
||||
grpc:
|
||||
host: 127.0.0.1
|
||||
port: 8501
|
||||
netty-server:
|
||||
max-inbound-message-size: 1000MB
|
||||
raft:
|
||||
disruptorBufferSize: 1024
|
||||
address: 127.0.0.1:8511
|
||||
max-log-file-size: 600000000000
|
||||
snapshotInterval: 1800
|
||||
server:
|
||||
port: 8521
|
||||
|
||||
app:
|
||||
data-path: ./storage
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: store-node-grpc-server
|
||||
profiles:
|
||||
active: default
|
||||
include: pd
|
||||
|
||||
logging:
|
||||
config: 'file:./conf/log4j2.xml'
|
||||
level:
|
||||
root: info
|
||||
|
|
@ -1,57 +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.
|
||||
#
|
||||
|
||||
pdserver:
|
||||
address: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
|
||||
|
||||
management:
|
||||
metrics:
|
||||
export:
|
||||
prometheus:
|
||||
enabled: true
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
|
||||
grpc:
|
||||
host: 127.0.0.1
|
||||
port: 8502
|
||||
netty-server:
|
||||
max-inbound-message-size: 1000MB
|
||||
raft:
|
||||
disruptorBufferSize: 1024
|
||||
address: 127.0.0.1:8512
|
||||
max-log-file-size: 600000000000
|
||||
snapshotInterval: 1800
|
||||
server:
|
||||
port: 8522
|
||||
|
||||
app:
|
||||
data-path: ./storage
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: store-node-grpc-server
|
||||
profiles:
|
||||
active: default
|
||||
include: pd
|
||||
|
||||
logging:
|
||||
config: 'file:./conf/log4j2.xml'
|
||||
level:
|
||||
root: info
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy
|
||||
gremlin.graph=org.apache.hugegraph.HugeFactory
|
||||
|
||||
# cache config
|
||||
vertex.cache_type=l2
|
||||
edge.cache_type=l2
|
||||
|
||||
store=hugegraph
|
||||
backend=hstore
|
||||
serializer=binary
|
||||
|
||||
# pd config
|
||||
pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
|
||||
|
||||
# task config
|
||||
task.scheduler_type=local
|
||||
task.schedule_period=10
|
||||
task.retry=0
|
||||
task.wait_timeout=10
|
||||
|
|
@ -1,25 +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.
|
||||
#
|
||||
hosts: [localhost]
|
||||
port: 8181
|
||||
serializer: {
|
||||
className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,127 +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.
|
||||
#
|
||||
# host and port of gremlin server, need to be consistent with host and port in rest-server.properties
|
||||
host: 127.0.0.1
|
||||
port: 8181
|
||||
|
||||
# timeout in ms of gremlin query
|
||||
evaluationTimeout: 30000
|
||||
|
||||
channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer
|
||||
# don't set graph at here, this happens after support for dynamically adding graph
|
||||
graphs: {
|
||||
}
|
||||
scriptEngines: {
|
||||
gremlin-groovy: {
|
||||
staticImports: [
|
||||
org.opencypher.gremlin.process.traversal.CustomPredicates.*',
|
||||
org.opencypher.gremlin.traversal.CustomFunctions.*
|
||||
],
|
||||
plugins: {
|
||||
org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {},
|
||||
org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
|
||||
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {
|
||||
classImports: [
|
||||
java.lang.Math,
|
||||
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,
|
||||
org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.HugeTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.KneighborTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.KoutTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.PathsTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.SubGraphTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser,
|
||||
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.opencypher.gremlin.traversal.CustomFunctions,
|
||||
org.opencypher.gremlin.traversal.CustomPredicate
|
||||
],
|
||||
methodImports: [
|
||||
java.lang.Math#*,
|
||||
org.opencypher.gremlin.traversal.CustomPredicate#*,
|
||||
org.opencypher.gremlin.traversal.CustomFunctions#*
|
||||
]
|
||||
},
|
||||
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {
|
||||
files: [scripts/empty-sample.groovy]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
serializers:
|
||||
- {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
- {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
- {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
- {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
metrics: {
|
||||
consoleReporter: {enabled: false, interval: 180000},
|
||||
csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv},
|
||||
jmxReporter: {enabled: false},
|
||||
slf4jReporter: {enabled: false, interval: 180000},
|
||||
gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
|
||||
graphiteReporter: {enabled: false, interval: 180000}
|
||||
}
|
||||
maxInitialLineLength: 4096
|
||||
maxHeaderSize: 8192
|
||||
maxChunkSize: 8192
|
||||
maxContentLength: 65536
|
||||
maxAccumulationBufferComponents: 1024
|
||||
resultIterationBatchSize: 64
|
||||
writeBufferLowWaterMark: 32768
|
||||
writeBufferHighWaterMark: 65536
|
||||
ssl: {
|
||||
enabled: false
|
||||
}
|
||||
|
|
@ -1,144 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<!-- Config will be auto loaded every 60s -->
|
||||
<configuration status="error" monitorInterval="60">
|
||||
<properties>
|
||||
<property name="LOG_PATH">logs</property>
|
||||
<property name="FILE_NAME">hugegraph-server</property>
|
||||
</properties>
|
||||
|
||||
<appenders>
|
||||
<Console name="console" target="SYSTEM_OUT">
|
||||
<ThresholdFilter level="DEBUG" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n"/>
|
||||
</Console>
|
||||
|
||||
<!-- Normal server log config -->
|
||||
<RollingRandomAccessFile name="file" fileName="${LOG_PATH}/${FILE_NAME}.log"
|
||||
filePattern="${LOG_PATH}/$${date:yyyy-MM}/${FILE_NAME}-%d{yyyy-MM-dd}-%i.log"
|
||||
immediateFlush="false">
|
||||
<ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n"/>
|
||||
<!-- Trigger after exceeding 1day or 50MB -->
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="50MB"/>
|
||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||
</Policies>
|
||||
<!-- Keep 5 files per day & auto delete after over 2GB or 100 files -->
|
||||
<DefaultRolloverStrategy max="5">
|
||||
<Delete basePath="${LOG_PATH}" maxDepth="2">
|
||||
<IfFileName glob="*/*.log"/>
|
||||
<!-- Limit log amount & size -->
|
||||
<IfAny>
|
||||
<IfAccumulatedFileSize exceeds="2GB"/>
|
||||
<IfAccumulatedFileCount exceeds="100"/>
|
||||
</IfAny>
|
||||
</Delete>
|
||||
</DefaultRolloverStrategy>
|
||||
</RollingRandomAccessFile>
|
||||
|
||||
<!-- Separate & compress audit log, buffer size is 512KB -->
|
||||
<RollingRandomAccessFile name="audit" fileName="${LOG_PATH}/audit-${FILE_NAME}.log"
|
||||
filePattern="${LOG_PATH}/$${date:yyyy-MM}/audit-${FILE_NAME}-%d{yyyy-MM-dd-HH}-%i.gz"
|
||||
bufferSize="524288" immediateFlush="false">
|
||||
<ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<!-- Use simple format for audit log to speed up -->
|
||||
<PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} - %m%n"/>
|
||||
<!-- Trigger after exceeding 1hour or 500MB -->
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||
</Policies>
|
||||
<!-- Keep 2 files per hour & auto delete [after 60 days] or [over 5GB or 500 files] -->
|
||||
<DefaultRolloverStrategy max="2">
|
||||
<Delete basePath="${LOG_PATH}" maxDepth="2">
|
||||
<IfFileName glob="*/*.gz"/>
|
||||
<IfLastModified age="60d"/>
|
||||
<IfAny>
|
||||
<IfAccumulatedFileSize exceeds="5GB"/>
|
||||
<IfAccumulatedFileCount exceeds="500"/>
|
||||
</IfAny>
|
||||
</Delete>
|
||||
</DefaultRolloverStrategy>
|
||||
</RollingRandomAccessFile>
|
||||
|
||||
<!-- Slow query log config -->
|
||||
<RollingRandomAccessFile name="slowQueryLog" fileName="${LOG_PATH}/slow_query.log"
|
||||
filePattern="${LOG_PATH}/$${date:yyyy-MM}/slow_query_log-%d{yyyy-MM-dd}-%i.log"
|
||||
immediateFlush="false">
|
||||
<ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n"/>
|
||||
<!-- Trigger after exceeding 1day or 50MB -->
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="50MB"/>
|
||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||
</Policies>
|
||||
<!-- Keep 5 files per day & auto delete after over 2GB or 100 files -->
|
||||
<DefaultRolloverStrategy max="5">
|
||||
<Delete basePath="${LOG_PATH}" maxDepth="2">
|
||||
<IfFileName glob="*/*.log"/>
|
||||
<!-- Limit log amount & size -->
|
||||
<IfAny>
|
||||
<IfAccumulatedFileSize exceeds="2GB"/>
|
||||
<IfAccumulatedFileCount exceeds="100"/>
|
||||
</IfAny>
|
||||
</Delete>
|
||||
</DefaultRolloverStrategy>
|
||||
</RollingRandomAccessFile>
|
||||
</appenders>
|
||||
|
||||
<loggers>
|
||||
<root level="INFO">
|
||||
<appender-ref ref="file"/>
|
||||
</root>
|
||||
<logger name="org.apache.cassandra" level="INFO" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</logger>
|
||||
<logger name="org.apache.hadoop" level="INFO" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</logger>
|
||||
<logger name="org.apache.zookeeper" level="WARN" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</logger>
|
||||
<logger name="com.datastax.driver" level="WARN" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</logger>
|
||||
<logger name="com.alipay.sofa" level="WARN" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</logger>
|
||||
<logger name="io.netty" level="INFO" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</logger>
|
||||
<logger name="org.apache.commons" level="INFO" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</logger>
|
||||
<!-- Use mixed async way to output logs -->
|
||||
<AsyncLogger name="org.apache.hugegraph" level="INFO" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</AsyncLogger>
|
||||
<AsyncLogger name="org.apache.hugegraph.auth" level="INFO" additivity="false">
|
||||
<appender-ref ref="audit"/>
|
||||
</AsyncLogger>
|
||||
<AsyncLogger name="org.apache.hugegraph.api.filter.AuthenticationFilter" level="INFO" additivity="false">
|
||||
<appender-ref ref="audit"/>
|
||||
</AsyncLogger>
|
||||
<AsyncLogger name="org.apache.hugegraph.api.filter.AccessLogFilter" level="INFO" additivity="false">
|
||||
<appender-ref ref="slowQueryLog"/>
|
||||
</AsyncLogger>
|
||||
</loggers>
|
||||
</configuration>
|
||||
|
|
@ -1,30 +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.
|
||||
#
|
||||
hosts: [localhost]
|
||||
port: 8181
|
||||
serializer: {
|
||||
className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
# The duplication of HugeGraphIoRegistry is meant to fix a bug in the
|
||||
# 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method.
|
||||
ioRegistries: [
|
||||
org.apache.hugegraph.io.HugeGraphIoRegistry,
|
||||
org.apache.hugegraph.io.HugeGraphIoRegistry
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +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.
|
||||
#
|
||||
hosts: [localhost]
|
||||
port: 8181
|
||||
serializer: {
|
||||
className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
# bind url
|
||||
restserver.url=http://127.0.0.1:8081
|
||||
# gremlin server url, need to be consistent with host and port in gremlin-server.yaml
|
||||
gremlinserver.url=http://127.0.0.1:8181
|
||||
|
||||
graphs=./conf/graphs
|
||||
|
||||
# configuration of arthas
|
||||
arthas.telnet_port=8562
|
||||
arthas.http_port=8561
|
||||
arthas.ip=127.0.0.1
|
||||
arthas.disabled_commands=jad
|
||||
|
||||
# authentication configs
|
||||
# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or
|
||||
# 'org.apache.hugegraph.auth.ConfigAuthenticator'
|
||||
#auth.authenticator=
|
||||
|
||||
# rpc server configs for multi graph-servers or raft-servers
|
||||
rpc.server_host=127.0.0.1
|
||||
rpc.server_port=8091
|
||||
|
||||
# lightweight load balancing (beta)
|
||||
server.id=server-1
|
||||
server.role=master
|
||||
|
||||
# slow query log
|
||||
log.slow_query_threshold=1000
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy
|
||||
gremlin.graph=org.apache.hugegraph.HugeFactory
|
||||
|
||||
# cache config
|
||||
vertex.cache_type=l2
|
||||
edge.cache_type=l2
|
||||
|
||||
store=hugegraph
|
||||
backend=hstore
|
||||
serializer=binary
|
||||
|
||||
# pd config
|
||||
pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
|
||||
|
||||
# task config
|
||||
task.scheduler_type=local
|
||||
task.schedule_period=10
|
||||
task.retry=0
|
||||
task.wait_timeout=10
|
||||
|
|
@ -1,127 +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.
|
||||
#
|
||||
# host and port of gremlin server, need to be consistent with host and port in rest-server.properties
|
||||
host: 127.0.0.1
|
||||
port: 8182
|
||||
|
||||
# timeout in ms of gremlin query
|
||||
evaluationTimeout: 30000
|
||||
|
||||
channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer
|
||||
# don't set graph at here, this happens after support for dynamically adding graph
|
||||
graphs: {
|
||||
}
|
||||
scriptEngines: {
|
||||
gremlin-groovy: {
|
||||
staticImports: [
|
||||
org.opencypher.gremlin.process.traversal.CustomPredicates.*',
|
||||
org.opencypher.gremlin.traversal.CustomFunctions.*
|
||||
],
|
||||
plugins: {
|
||||
org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {},
|
||||
org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
|
||||
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {
|
||||
classImports: [
|
||||
java.lang.Math,
|
||||
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,
|
||||
org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.HugeTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.KneighborTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.KoutTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.PathsTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.SubGraphTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser,
|
||||
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.opencypher.gremlin.traversal.CustomFunctions,
|
||||
org.opencypher.gremlin.traversal.CustomPredicate
|
||||
],
|
||||
methodImports: [
|
||||
java.lang.Math#*,
|
||||
org.opencypher.gremlin.traversal.CustomPredicate#*,
|
||||
org.opencypher.gremlin.traversal.CustomFunctions#*
|
||||
]
|
||||
},
|
||||
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {
|
||||
files: [scripts/empty-sample.groovy]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
serializers:
|
||||
- {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
- {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
- {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
- {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
metrics: {
|
||||
consoleReporter: {enabled: false, interval: 180000},
|
||||
csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv},
|
||||
jmxReporter: {enabled: false},
|
||||
slf4jReporter: {enabled: false, interval: 180000},
|
||||
gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
|
||||
graphiteReporter: {enabled: false, interval: 180000}
|
||||
}
|
||||
maxInitialLineLength: 4096
|
||||
maxHeaderSize: 8192
|
||||
maxChunkSize: 8192
|
||||
maxContentLength: 65536
|
||||
maxAccumulationBufferComponents: 1024
|
||||
resultIterationBatchSize: 64
|
||||
writeBufferLowWaterMark: 32768
|
||||
writeBufferHighWaterMark: 65536
|
||||
ssl: {
|
||||
enabled: false
|
||||
}
|
||||
|
|
@ -1,144 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<!-- Config will be auto loaded every 60s -->
|
||||
<configuration status="error" monitorInterval="60">
|
||||
<properties>
|
||||
<property name="LOG_PATH">logs</property>
|
||||
<property name="FILE_NAME">hugegraph-server</property>
|
||||
</properties>
|
||||
|
||||
<appenders>
|
||||
<Console name="console" target="SYSTEM_OUT">
|
||||
<ThresholdFilter level="DEBUG" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n"/>
|
||||
</Console>
|
||||
|
||||
<!-- Normal server log config -->
|
||||
<RollingRandomAccessFile name="file" fileName="${LOG_PATH}/${FILE_NAME}.log"
|
||||
filePattern="${LOG_PATH}/$${date:yyyy-MM}/${FILE_NAME}-%d{yyyy-MM-dd}-%i.log"
|
||||
immediateFlush="false">
|
||||
<ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n"/>
|
||||
<!-- Trigger after exceeding 1day or 50MB -->
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="50MB"/>
|
||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||
</Policies>
|
||||
<!-- Keep 5 files per day & auto delete after over 2GB or 100 files -->
|
||||
<DefaultRolloverStrategy max="5">
|
||||
<Delete basePath="${LOG_PATH}" maxDepth="2">
|
||||
<IfFileName glob="*/*.log"/>
|
||||
<!-- Limit log amount & size -->
|
||||
<IfAny>
|
||||
<IfAccumulatedFileSize exceeds="2GB"/>
|
||||
<IfAccumulatedFileCount exceeds="100"/>
|
||||
</IfAny>
|
||||
</Delete>
|
||||
</DefaultRolloverStrategy>
|
||||
</RollingRandomAccessFile>
|
||||
|
||||
<!-- Separate & compress audit log, buffer size is 512KB -->
|
||||
<RollingRandomAccessFile name="audit" fileName="${LOG_PATH}/audit-${FILE_NAME}.log"
|
||||
filePattern="${LOG_PATH}/$${date:yyyy-MM}/audit-${FILE_NAME}-%d{yyyy-MM-dd-HH}-%i.gz"
|
||||
bufferSize="524288" immediateFlush="false">
|
||||
<ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<!-- Use simple format for audit log to speed up -->
|
||||
<PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} - %m%n"/>
|
||||
<!-- Trigger after exceeding 1hour or 500MB -->
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||
</Policies>
|
||||
<!-- Keep 2 files per hour & auto delete [after 60 days] or [over 5GB or 500 files] -->
|
||||
<DefaultRolloverStrategy max="2">
|
||||
<Delete basePath="${LOG_PATH}" maxDepth="2">
|
||||
<IfFileName glob="*/*.gz"/>
|
||||
<IfLastModified age="60d"/>
|
||||
<IfAny>
|
||||
<IfAccumulatedFileSize exceeds="5GB"/>
|
||||
<IfAccumulatedFileCount exceeds="500"/>
|
||||
</IfAny>
|
||||
</Delete>
|
||||
</DefaultRolloverStrategy>
|
||||
</RollingRandomAccessFile>
|
||||
|
||||
<!-- Slow query log config -->
|
||||
<RollingRandomAccessFile name="slowQueryLog" fileName="${LOG_PATH}/slow_query.log"
|
||||
filePattern="${LOG_PATH}/$${date:yyyy-MM}/slow_query_log-%d{yyyy-MM-dd}-%i.log"
|
||||
immediateFlush="false">
|
||||
<ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n"/>
|
||||
<!-- Trigger after exceeding 1day or 50MB -->
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="50MB"/>
|
||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||
</Policies>
|
||||
<!-- Keep 5 files per day & auto delete after over 2GB or 100 files -->
|
||||
<DefaultRolloverStrategy max="5">
|
||||
<Delete basePath="${LOG_PATH}" maxDepth="2">
|
||||
<IfFileName glob="*/*.log"/>
|
||||
<!-- Limit log amount & size -->
|
||||
<IfAny>
|
||||
<IfAccumulatedFileSize exceeds="2GB"/>
|
||||
<IfAccumulatedFileCount exceeds="100"/>
|
||||
</IfAny>
|
||||
</Delete>
|
||||
</DefaultRolloverStrategy>
|
||||
</RollingRandomAccessFile>
|
||||
</appenders>
|
||||
|
||||
<loggers>
|
||||
<root level="INFO">
|
||||
<appender-ref ref="file"/>
|
||||
</root>
|
||||
<logger name="org.apache.cassandra" level="INFO" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</logger>
|
||||
<logger name="org.apache.hadoop" level="INFO" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</logger>
|
||||
<logger name="org.apache.zookeeper" level="WARN" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</logger>
|
||||
<logger name="com.datastax.driver" level="WARN" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</logger>
|
||||
<logger name="com.alipay.sofa" level="WARN" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</logger>
|
||||
<logger name="io.netty" level="INFO" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</logger>
|
||||
<logger name="org.apache.commons" level="INFO" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</logger>
|
||||
<!-- Use mixed async way to output logs -->
|
||||
<AsyncLogger name="org.apache.hugegraph" level="INFO" additivity="false">
|
||||
<appender-ref ref="file"/>
|
||||
</AsyncLogger>
|
||||
<AsyncLogger name="org.apache.hugegraph.auth" level="INFO" additivity="false">
|
||||
<appender-ref ref="audit"/>
|
||||
</AsyncLogger>
|
||||
<AsyncLogger name="org.apache.hugegraph.api.filter.AuthenticationFilter" level="INFO" additivity="false">
|
||||
<appender-ref ref="audit"/>
|
||||
</AsyncLogger>
|
||||
<AsyncLogger name="org.apache.hugegraph.api.filter.AccessLogFilter" level="INFO" additivity="false">
|
||||
<appender-ref ref="slowQueryLog"/>
|
||||
</AsyncLogger>
|
||||
</loggers>
|
||||
</configuration>
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
# bind url
|
||||
restserver.url=http://127.0.0.1:8082
|
||||
# gremlin server url, need to be consistent with host and port in gremlin-server.yaml
|
||||
gremlinserver.url=http://127.0.0.1:8182
|
||||
|
||||
graphs=./conf/graphs
|
||||
|
||||
# configuration of arthas
|
||||
arthas.telnet_port=8572
|
||||
arthas.http_port=8571
|
||||
arthas.ip=127.0.0.1
|
||||
arthas.disabled_commands=jad
|
||||
|
||||
# authentication configs
|
||||
# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or
|
||||
# 'org.apache.hugegraph.auth.ConfigAuthenticator'
|
||||
#auth.authenticator=
|
||||
|
||||
# rpc server configs for multi graph-servers or raft-servers
|
||||
rpc.server_host=127.0.0.1
|
||||
rpc.server_port=8092
|
||||
#rpc.server_timeout=30
|
||||
|
||||
# lightweight load balancing (beta)
|
||||
server.id=server-2
|
||||
server.role=worker
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy
|
||||
gremlin.graph=org.apache.hugegraph.HugeFactory
|
||||
|
||||
# cache config
|
||||
vertex.cache_type=l2
|
||||
edge.cache_type=l2
|
||||
|
||||
store=hugegraph
|
||||
backend=hstore
|
||||
serializer=binary
|
||||
|
||||
# pd config
|
||||
pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
|
||||
|
||||
# task config
|
||||
task.scheduler_type=local
|
||||
task.schedule_period=10
|
||||
task.retry=0
|
||||
task.wait_timeout=10
|
||||
|
|
@ -1,25 +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.
|
||||
#
|
||||
hosts: [localhost]
|
||||
port: 8183
|
||||
serializer: {
|
||||
className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,127 +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.
|
||||
#
|
||||
# host and port of gremlin server, need to be consistent with host and port in rest-server.properties
|
||||
host: 127.0.0.1
|
||||
port: 8183
|
||||
|
||||
# timeout in ms of gremlin query
|
||||
evaluationTimeout: 30000
|
||||
|
||||
channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer
|
||||
# don't set graph at here, this happens after support for dynamically adding graph
|
||||
graphs: {
|
||||
}
|
||||
scriptEngines: {
|
||||
gremlin-groovy: {
|
||||
staticImports: [
|
||||
org.opencypher.gremlin.process.traversal.CustomPredicates.*',
|
||||
org.opencypher.gremlin.traversal.CustomFunctions.*
|
||||
],
|
||||
plugins: {
|
||||
org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {},
|
||||
org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
|
||||
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {
|
||||
classImports: [
|
||||
java.lang.Math,
|
||||
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,
|
||||
org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.HugeTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.KneighborTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.KoutTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.PathsTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.SubGraphTraverser,
|
||||
org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser,
|
||||
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.opencypher.gremlin.traversal.CustomFunctions,
|
||||
org.opencypher.gremlin.traversal.CustomPredicate
|
||||
],
|
||||
methodImports: [
|
||||
java.lang.Math#*,
|
||||
org.opencypher.gremlin.traversal.CustomPredicate#*,
|
||||
org.opencypher.gremlin.traversal.CustomFunctions#*
|
||||
]
|
||||
},
|
||||
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {
|
||||
files: [scripts/empty-sample.groovy]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
serializers:
|
||||
- {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
- {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
- {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
- {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
metrics: {
|
||||
consoleReporter: {enabled: false, interval: 180000},
|
||||
csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv},
|
||||
jmxReporter: {enabled: false},
|
||||
slf4jReporter: {enabled: false, interval: 180000},
|
||||
gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
|
||||
graphiteReporter: {enabled: false, interval: 180000}
|
||||
}
|
||||
maxInitialLineLength: 4096
|
||||
maxHeaderSize: 8192
|
||||
maxChunkSize: 8192
|
||||
maxContentLength: 65536
|
||||
maxAccumulationBufferComponents: 1024
|
||||
resultIterationBatchSize: 64
|
||||
writeBufferLowWaterMark: 32768
|
||||
writeBufferHighWaterMark: 65536
|
||||
ssl: {
|
||||
enabled: false
|
||||
}
|
||||
|
|
@ -1,30 +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.
|
||||
#
|
||||
hosts: [localhost]
|
||||
port: 8183
|
||||
serializer: {
|
||||
className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
# The duplication of HugeGraphIoRegistry is meant to fix a bug in the
|
||||
# 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method.
|
||||
ioRegistries: [
|
||||
org.apache.hugegraph.io.HugeGraphIoRegistry,
|
||||
org.apache.hugegraph.io.HugeGraphIoRegistry
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +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.
|
||||
#
|
||||
hosts: [localhost]
|
||||
port: 8183
|
||||
serializer: {
|
||||
className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
|
||||
config: {
|
||||
serializeResultToString: false,
|
||||
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
# bind url
|
||||
restserver.url=http://127.0.0.1:8083
|
||||
# gremlin server url, need to be consistent with host and port in gremlin-server.yaml
|
||||
gremlinserver.url=http://127.0.0.1:8183
|
||||
|
||||
graphs=./conf/graphs
|
||||
|
||||
# configuration of arthas
|
||||
arthas.telnet_port=8582
|
||||
arthas.http_port=8581
|
||||
arthas.ip=127.0.0.1
|
||||
arthas.disabled_commands=jad
|
||||
|
||||
# authentication configs
|
||||
# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or
|
||||
# 'org.apache.hugegraph.auth.ConfigAuthenticator'
|
||||
#auth.authenticator=
|
||||
|
||||
# rpc server configs for multi graph-servers or raft-servers
|
||||
rpc.server_host=127.0.0.1
|
||||
rpc.server_port=8093
|
||||
|
||||
# lightweight load balancing (beta)
|
||||
server.id=server-3
|
||||
server.role=worker
|
||||
|
|
@ -1,180 +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.
|
||||
#
|
||||
|
||||
# TODO: reuse the configs for same type containers
|
||||
# User could modify the node nums and the port by themselves
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
pd0:
|
||||
image: hugegraph/pd
|
||||
container_name: pd0
|
||||
hostname: pd0
|
||||
network_mode: host
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8620"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
volumes:
|
||||
- ./configs/application-pd0.yml:/hugegraph-pd/conf/application.yml
|
||||
|
||||
pd1:
|
||||
image: hugegraph/pd
|
||||
container_name: pd1
|
||||
hostname: pd1
|
||||
network_mode: host
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8621"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
volumes:
|
||||
- ./configs/application-pd1.yml:/hugegraph-pd/conf/application.yml
|
||||
|
||||
pd2:
|
||||
image: hugegraph/pd
|
||||
container_name: pd2
|
||||
hostname: pd2
|
||||
network_mode: host
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8622"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
volumes:
|
||||
- ./configs/application-pd2.yml:/hugegraph-pd/conf/application.yml
|
||||
|
||||
store0:
|
||||
image: hugegraph/store
|
||||
container_name: store0
|
||||
hostname: store0
|
||||
network_mode: host
|
||||
depends_on:
|
||||
pd0:
|
||||
condition: service_healthy
|
||||
pd1:
|
||||
condition: service_healthy
|
||||
pd2:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8520"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
volumes:
|
||||
- ./configs/application-store0.yml:/hugegraph-store/conf/application.yml
|
||||
|
||||
store1:
|
||||
image: hugegraph/store
|
||||
container_name: store1
|
||||
hostname: store1
|
||||
network_mode: host
|
||||
depends_on:
|
||||
pd0:
|
||||
condition: service_healthy
|
||||
pd1:
|
||||
condition: service_healthy
|
||||
pd2:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8521"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
volumes:
|
||||
- ./configs/application-store1.yml:/hugegraph-store/conf/application.yml
|
||||
|
||||
store2:
|
||||
image: hugegraph/store
|
||||
container_name: store2
|
||||
hostname: store2
|
||||
network_mode: host
|
||||
depends_on:
|
||||
pd0:
|
||||
condition: service_healthy
|
||||
pd1:
|
||||
condition: service_healthy
|
||||
pd2:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8522"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
volumes:
|
||||
- ./configs/application-store2.yml:/hugegraph-store/conf/application.yml
|
||||
|
||||
server1:
|
||||
image: hugegraph/server
|
||||
container_name: server1
|
||||
hostname: server1
|
||||
network_mode: host
|
||||
depends_on:
|
||||
store0:
|
||||
condition: service_healthy
|
||||
store1:
|
||||
condition: service_healthy
|
||||
store2:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8081"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
volumes:
|
||||
- ./configs/server1-conf:/hugegraph-server/conf
|
||||
|
||||
server2:
|
||||
image: hugegraph/server
|
||||
container_name: server2
|
||||
hostname: server2
|
||||
network_mode: host
|
||||
depends_on:
|
||||
store0:
|
||||
condition: service_healthy
|
||||
store1:
|
||||
condition: service_healthy
|
||||
store2:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8082"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
volumes:
|
||||
- ./configs/server2-conf:/hugegraph-server/conf
|
||||
|
||||
server3:
|
||||
image: hugegraph/server
|
||||
container_name: server3
|
||||
hostname: server3
|
||||
network_mode: host
|
||||
depends_on:
|
||||
store0:
|
||||
condition: service_healthy
|
||||
store1:
|
||||
condition: service_healthy
|
||||
store2:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8083"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
volumes:
|
||||
- ./configs/server3-conf:/hugegraph-server/conf
|
||||
|
|
@ -1,58 +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.
|
||||
#
|
||||
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
pd:
|
||||
image: hugegraph/pd
|
||||
container_name: pd
|
||||
hostname: pd
|
||||
network_mode: host
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8620"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
|
||||
store:
|
||||
image: hugegraph/store
|
||||
container_name: store
|
||||
hostname: store
|
||||
network_mode: host
|
||||
depends_on:
|
||||
pd:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8520"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
|
||||
server:
|
||||
image: hugegraph/server
|
||||
container_name: server
|
||||
hostname: server
|
||||
network_mode: host
|
||||
depends_on:
|
||||
store:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
|
|
@ -1,26 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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
|
||||
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.
|
||||
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.
|
||||
-->
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.apache.hugegraph</groupId>
|
||||
<artifactId>hugegraph-server</artifactId>
|
||||
<artifactId>hugegraph</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
|
@ -151,7 +151,7 @@
|
|||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-jaxrs2-jakarta</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
<version>2.1.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
@ -164,12 +164,6 @@
|
|||
<artifactId>arthas-packaging</artifactId>
|
||||
<version>${arthas.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gridkit.jvmtool</groupId>
|
||||
<artifactId>sjk-core</artifactId>
|
||||
<version>0.22</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
@ -194,7 +188,7 @@
|
|||
</manifest>
|
||||
<manifestEntries>
|
||||
<!-- TODO: update it -->
|
||||
<Implementation-Version>0.71.0.0</Implementation-Version>
|
||||
<Implementation-Version>0.69.0.0</Implementation-Version>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -48,23 +48,22 @@ public class API {
|
|||
public static final String TEXT_PLAIN = MediaType.TEXT_PLAIN;
|
||||
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;
|
||||
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();
|
||||
.getSubtype();
|
||||
public static final String ACTION_APPEND = "append";
|
||||
public static final String ACTION_ELIMINATE = "eliminate";
|
||||
public static final String ACTION_CLEAR = "clear";
|
||||
protected static final Logger LOG = Log.logger(API.class);
|
||||
private static final Meter SUCCEED_METER =
|
||||
MetricsUtil.registerMeter(API.class, "commit-succeed");
|
||||
MetricsUtil.registerMeter(API.class, "commit-succeed");
|
||||
private static final Meter ILLEGAL_ARG_ERROR_METER =
|
||||
MetricsUtil.registerMeter(API.class, "illegal-arg");
|
||||
MetricsUtil.registerMeter(API.class, "illegal-arg");
|
||||
private static final Meter EXPECTED_ERROR_METER =
|
||||
MetricsUtil.registerMeter(API.class, "expected-error");
|
||||
MetricsUtil.registerMeter(API.class, "expected-error");
|
||||
private static final Meter UNKNOWN_ERROR_METER =
|
||||
MetricsUtil.registerMeter(API.class, "unknown-error");
|
||||
MetricsUtil.registerMeter(API.class, "unknown-error");
|
||||
|
||||
public static HugeGraph graph(GraphManager manager, String graph) {
|
||||
HugeGraph g = manager.graph(graph);
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -27,8 +27,6 @@ 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;
|
||||
|
|
@ -37,7 +35,6 @@ import jakarta.ws.rs.core.Context;
|
|||
|
||||
@Path("arthas")
|
||||
@Singleton
|
||||
@Tag(name = "ArthasAPI")
|
||||
public class ArthasAPI extends API {
|
||||
|
||||
@Context
|
||||
|
|
@ -46,15 +43,13 @@ public class ArthasAPI extends API {
|
|||
@PUT
|
||||
@Timed
|
||||
@Produces(APPLICATION_JSON_WITH_CHARSET)
|
||||
@Operation(summary = "start arthas agent")
|
||||
public Object startArthas() {
|
||||
HugeConfig config = this.configProvider.get();
|
||||
HashMap<String, String> 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));
|
||||
configMap.put("arthas.disabledCommands", config.get(ServerOptions.ARTHAS_DISABLED_COMMANDS));
|
||||
ArthasAgent.attach(configMap);
|
||||
return JsonUtil.toJson(configMap);
|
||||
}
|
||||
|
|
@ -1,55 +1,55 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.auth;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.DELETE;
|
||||
import jakarta.ws.rs.DefaultValue;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.PUT;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.QueryParam;
|
||||
import jakarta.ws.rs.core.Context;
|
||||
|
||||
import jakarta.inject.Singleton;
|
||||
import jakarta.ws.rs.Path;
|
||||
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.StatusFilter.Status;
|
||||
import org.apache.hugegraph.auth.HugeAccess;
|
||||
import org.apache.hugegraph.auth.HugePermission;
|
||||
import org.apache.hugegraph.backend.id.Id;
|
||||
import org.apache.hugegraph.core.GraphManager;
|
||||
import org.apache.hugegraph.define.Checkable;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
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.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.inject.Singleton;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.DELETE;
|
||||
import jakarta.ws.rs.DefaultValue;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.PUT;
|
||||
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}/auth/accesses")
|
||||
@Singleton
|
||||
@Tag(name = "AccessAPI")
|
||||
|
|
@ -1,42 +1,25 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.auth;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.api.filter.StatusFilter.Status;
|
||||
import org.apache.hugegraph.auth.HugeBelong;
|
||||
import org.apache.hugegraph.backend.id.Id;
|
||||
import org.apache.hugegraph.core.GraphManager;
|
||||
import org.apache.hugegraph.define.Checkable;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
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.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.inject.Singleton;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.DELETE;
|
||||
import jakarta.ws.rs.DefaultValue;
|
||||
|
|
@ -49,6 +32,23 @@ import jakarta.ws.rs.Produces;
|
|||
import jakarta.ws.rs.QueryParam;
|
||||
import jakarta.ws.rs.core.Context;
|
||||
|
||||
import jakarta.inject.Singleton;
|
||||
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.StatusFilter.Status;
|
||||
import org.apache.hugegraph.auth.HugeBelong;
|
||||
import org.apache.hugegraph.backend.id.Id;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@Path("graphs/{graph}/auth/belongs")
|
||||
@Singleton
|
||||
@Tag(name = "BelongAPI")
|
||||
|
|
@ -1,42 +1,25 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.auth;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.api.filter.StatusFilter.Status;
|
||||
import org.apache.hugegraph.auth.HugeGroup;
|
||||
import org.apache.hugegraph.backend.id.IdGenerator;
|
||||
import org.apache.hugegraph.core.GraphManager;
|
||||
import org.apache.hugegraph.define.Checkable;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
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.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.inject.Singleton;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.DELETE;
|
||||
import jakarta.ws.rs.DefaultValue;
|
||||
|
|
@ -49,6 +32,23 @@ import jakarta.ws.rs.Produces;
|
|||
import jakarta.ws.rs.QueryParam;
|
||||
import jakarta.ws.rs.core.Context;
|
||||
|
||||
import jakarta.inject.Singleton;
|
||||
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.StatusFilter.Status;
|
||||
import org.apache.hugegraph.auth.HugeGroup;
|
||||
import org.apache.hugegraph.backend.id.IdGenerator;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@Path("graphs/{graph}/auth/groups")
|
||||
@Singleton
|
||||
@Tag(name = "GroupAPI")
|
||||
|
|
@ -1,43 +1,25 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.auth;
|
||||
|
||||
import javax.security.sasl.AuthenticationException;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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 javax.security.sasl.AuthenticationException;
|
||||
import jakarta.ws.rs.BadRequestException;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.DELETE;
|
||||
|
|
@ -51,6 +33,23 @@ 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.util.E;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
@Path("graphs/{graph}/auth")
|
||||
@Singleton
|
||||
@Tag(name = "LoginAPI")
|
||||
|
|
@ -64,15 +63,18 @@ 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);
|
||||
|
||||
try {
|
||||
String token = manager.authManager().loginUser(jsonLogin.name, jsonLogin.password);
|
||||
String token = manager.authManager()
|
||||
.loginUser(jsonLogin.name, jsonLogin.password);
|
||||
HugeGraph g = graph(manager, graph);
|
||||
return manager.serializer(g).writeMap(ImmutableMap.of("token", token));
|
||||
return manager.serializer(g)
|
||||
.writeMap(ImmutableMap.of("token", token));
|
||||
} catch (AuthenticationException e) {
|
||||
throw new NotAuthorizedException(e.getMessage(), e);
|
||||
}
|
||||
|
|
@ -84,17 +86,21 @@ public class LoginAPI extends API {
|
|||
@Status(Status.OK)
|
||||
@Consumes(APPLICATION_JSON)
|
||||
@Produces(APPLICATION_JSON_WITH_CHARSET)
|
||||
public void logout(@Context GraphManager manager, @PathParam("graph") String graph,
|
||||
public void logout(@Context GraphManager manager,
|
||||
@PathParam("graph") String graph,
|
||||
@HeaderParam(HttpHeaders.AUTHORIZATION) String auth) {
|
||||
E.checkArgument(StringUtils.isNotEmpty(auth),
|
||||
"Request header Authorization must not be null");
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -104,17 +110,21 @@ public class LoginAPI extends API {
|
|||
@Status(Status.OK)
|
||||
@Consumes(APPLICATION_JSON)
|
||||
@Produces(APPLICATION_JSON_WITH_CHARSET)
|
||||
public String verifyToken(@Context GraphManager manager, @PathParam("graph") String graph,
|
||||
@HeaderParam(HttpHeaders.AUTHORIZATION) String token) {
|
||||
public String verifyToken(@Context GraphManager manager,
|
||||
@PathParam("graph") String graph,
|
||||
@HeaderParam(HttpHeaders.AUTHORIZATION)
|
||||
String token) {
|
||||
E.checkArgument(StringUtils.isNotEmpty(token),
|
||||
"Request header Authorization must not be null");
|
||||
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);
|
||||
|
|
@ -134,7 +144,8 @@ public class LoginAPI extends API {
|
|||
|
||||
@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");
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.auth;
|
||||
|
|
@ -21,25 +21,6 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.api.filter.StatusFilter.Status;
|
||||
import org.apache.hugegraph.auth.AuthManager;
|
||||
import org.apache.hugegraph.auth.HugeProject;
|
||||
import org.apache.hugegraph.backend.id.Id;
|
||||
import org.apache.hugegraph.core.GraphManager;
|
||||
import org.apache.hugegraph.define.Checkable;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
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.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.inject.Singleton;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
|
|
@ -54,6 +35,25 @@ import jakarta.ws.rs.Produces;
|
|||
import jakarta.ws.rs.QueryParam;
|
||||
import jakarta.ws.rs.core.Context;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.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.StatusFilter.Status;
|
||||
import org.apache.hugegraph.auth.AuthManager;
|
||||
import org.apache.hugegraph.auth.HugeProject;
|
||||
import org.apache.hugegraph.backend.id.Id;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@Path("graphs/{graph}/auth/projects")
|
||||
@Singleton
|
||||
@Tag(name = "ProjectAPI")
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.auth;
|
||||
|
|
@ -20,22 +20,6 @@ package org.apache.hugegraph.api.auth;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.api.filter.StatusFilter.Status;
|
||||
import org.apache.hugegraph.auth.HugeTarget;
|
||||
import org.apache.hugegraph.core.GraphManager;
|
||||
import org.apache.hugegraph.define.Checkable;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.JsonUtil;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.inject.Singleton;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
|
|
@ -50,6 +34,22 @@ import jakarta.ws.rs.Produces;
|
|||
import jakarta.ws.rs.QueryParam;
|
||||
import jakarta.ws.rs.core.Context;
|
||||
|
||||
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.StatusFilter.Status;
|
||||
import org.apache.hugegraph.auth.HugeTarget;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.JsonUtil;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@Path("graphs/{graph}/auth/targets")
|
||||
@Singleton
|
||||
@Tag(name = "TargetAPI")
|
||||
|
|
@ -1,43 +1,24 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.auth;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.api.filter.StatusFilter.Status;
|
||||
import org.apache.hugegraph.auth.HugeUser;
|
||||
import org.apache.hugegraph.backend.id.Id;
|
||||
import org.apache.hugegraph.backend.id.IdGenerator;
|
||||
import org.apache.hugegraph.core.GraphManager;
|
||||
import org.apache.hugegraph.define.Checkable;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import org.apache.hugegraph.util.StringEncoding;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.inject.Singleton;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
|
|
@ -52,6 +33,25 @@ import jakarta.ws.rs.Produces;
|
|||
import jakarta.ws.rs.QueryParam;
|
||||
import jakarta.ws.rs.core.Context;
|
||||
|
||||
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.StatusFilter.Status;
|
||||
import org.apache.hugegraph.auth.HugeUser;
|
||||
import org.apache.hugegraph.backend.id.Id;
|
||||
import org.apache.hugegraph.backend.id.IdGenerator;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import org.apache.hugegraph.util.StringEncoding;
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@Path("graphs/{graph}/auth/users")
|
||||
@Singleton
|
||||
@Tag(name = "UserAPI")
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.cypher;
|
||||
|
|
@ -33,7 +33,6 @@ import org.slf4j.Logger;
|
|||
|
||||
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;
|
||||
|
|
@ -48,7 +47,6 @@ import jakarta.ws.rs.core.HttpHeaders;
|
|||
|
||||
@Path("graphs/{graph}/cypher")
|
||||
@Singleton
|
||||
@Tag(name = "CypherAPI")
|
||||
public class CypherAPI extends API {
|
||||
|
||||
private static final Logger LOG = Log.logger(CypherAPI.class);
|
||||
|
|
@ -1,22 +1,32 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.cypher;
|
||||
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import org.apache.commons.configuration2.Configuration;
|
||||
import org.apache.tinkerpop.gremlin.driver.*;
|
||||
import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.ThreadSafe;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
|
@ -25,20 +35,6 @@ import java.util.Objects;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.ThreadSafe;
|
||||
|
||||
import org.apache.commons.configuration2.Configuration;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import org.apache.tinkerpop.gremlin.driver.Client;
|
||||
import org.apache.tinkerpop.gremlin.driver.Cluster;
|
||||
import org.apache.tinkerpop.gremlin.driver.Result;
|
||||
import org.apache.tinkerpop.gremlin.driver.ResultSet;
|
||||
import org.apache.tinkerpop.gremlin.driver.Tokens;
|
||||
import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@ThreadSafe
|
||||
public final class CypherClient {
|
||||
|
||||
|
|
@ -97,7 +93,7 @@ public final class CypherClient {
|
|||
}
|
||||
|
||||
private List<Object> doQueryList(Client client, RequestMessage request)
|
||||
throws ExecutionException, InterruptedException {
|
||||
throws ExecutionException, InterruptedException {
|
||||
ResultSet results = client.submitAsync(request).get();
|
||||
|
||||
Iterator<Result> iter = results.iterator();
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.cypher;
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.cypher;
|
||||
|
|
@ -50,14 +50,12 @@ public class CypherModel {
|
|||
}
|
||||
|
||||
public static class Status {
|
||||
|
||||
public String message = "";
|
||||
public int code;
|
||||
public Map<String, Object> attributes = Collections.EMPTY_MAP;
|
||||
}
|
||||
|
||||
private static class Result {
|
||||
|
||||
public List<Object> data;
|
||||
public Map<String, Object> meta = Collections.EMPTY_MAP;
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* 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 org.apache.hugegraph.metrics.MetricsUtil;
|
||||
|
||||
import jakarta.inject.Singleton;
|
||||
import jakarta.ws.rs.container.ContainerRequestContext;
|
||||
import jakarta.ws.rs.container.ContainerResponseContext;
|
||||
import jakarta.ws.rs.container.ContainerResponseFilter;
|
||||
import jakarta.ws.rs.ext.Provider;
|
||||
|
||||
|
||||
@Provider
|
||||
@Singleton
|
||||
public class AccessLogFilter implements ContainerResponseFilter {
|
||||
|
||||
private static final String DELIMETER = "/";
|
||||
|
||||
/**
|
||||
* 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;
|
||||
String method = requestContext.getRequest().getMethod();
|
||||
String path = requestContext.getUriInfo().getPath();
|
||||
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();
|
||||
}
|
||||
|
||||
// get responseTime
|
||||
Object requestTime = requestContext.getProperty(REQUEST_TIME);
|
||||
if(requestTime!=null){
|
||||
long now = System.currentTimeMillis();
|
||||
long responseTime = (now - (long)requestTime);
|
||||
|
||||
MetricsUtil.registerHistogram(
|
||||
join(metricsName, METRICS_PATH_RESPONSE_TIME_HISTOGRAM))
|
||||
.update(responseTime);
|
||||
}
|
||||
}
|
||||
|
||||
private String join(String path1, String path2) {
|
||||
return String.join(DELIMETER, path1, path2);
|
||||
}
|
||||
|
||||
private boolean statusOk(int status){
|
||||
return status == 200 || status == 201 || status == 202;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -41,11 +41,10 @@ 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.gridkit.jvmtool.cmd.AntPathMatcher;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import com.alipay.remoting.util.StringUtils;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import jakarta.annotation.Priority;
|
||||
import jakarta.ws.rs.BadRequestException;
|
||||
|
|
@ -71,15 +70,13 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||
|
||||
private static final Logger LOG = Log.logger(AuthenticationFilter.class);
|
||||
|
||||
private static final AntPathMatcher MATCHER = new AntPathMatcher();
|
||||
private static final Set<String> FIXED_WHITE_API_SET = ImmutableSet.of(
|
||||
"versions",
|
||||
"openapi.json"
|
||||
private static final List<String> WHITE_API_LIST = ImmutableList.of(
|
||||
"auth/login",
|
||||
"versions"
|
||||
);
|
||||
/** Remove auth/login API from whitelist */
|
||||
private static final Set<String> FLEXIBLE_WHITE_API_SET = ImmutableSet.of();
|
||||
|
||||
private static Boolean enabledWhiteIpCheck;
|
||||
private static String whiteIpStatus;
|
||||
|
||||
private static final String STRING_WHITE_IP_LIST = "whiteiplist";
|
||||
private static final String STRING_ENABLE = "enable";
|
||||
|
||||
|
|
@ -94,7 +91,7 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||
|
||||
@Override
|
||||
public void filter(ContainerRequestContext context) throws IOException {
|
||||
if (isWhiteAPI(context)) {
|
||||
if (AuthenticationFilter.isWhiteAPI(context)) {
|
||||
return;
|
||||
}
|
||||
User user = this.authenticate(context);
|
||||
|
|
@ -107,7 +104,7 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||
E.checkState(manager != null, "Context GraphManager is absent");
|
||||
|
||||
if (!manager.requireAuthentication()) {
|
||||
// Return anonymous user with an admin role if disable authentication
|
||||
// Return anonymous user with admin role if disable authentication
|
||||
return User.ANONYMOUS;
|
||||
}
|
||||
|
||||
|
|
@ -121,12 +118,11 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||
}
|
||||
|
||||
// Check whiteIp
|
||||
if (enabledWhiteIpCheck == null) {
|
||||
String whiteIpStatus = this.configProvider.get().get(WHITE_IP_STATUS);
|
||||
enabledWhiteIpCheck = Objects.equals(whiteIpStatus, STRING_ENABLE);
|
||||
if (whiteIpStatus == null) {
|
||||
whiteIpStatus = this.configProvider.get().get(WHITE_IP_STATUS);
|
||||
}
|
||||
|
||||
if (enabledWhiteIpCheck && request != null) {
|
||||
if (Objects.equals(whiteIpStatus, STRING_ENABLE) && request != null) {
|
||||
peer = request.getRemoteAddr() + ":" + request.getRemotePort();
|
||||
path = request.getRequestURI();
|
||||
|
||||
|
|
@ -135,8 +131,9 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||
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));
|
||||
throw new ForbiddenException(
|
||||
String.format("Remote ip '%s' is not permitted",
|
||||
remoteIp));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -144,23 +141,28 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||
// Extract authentication credentials
|
||||
String auth = context.getHeaderString(HttpHeaders.AUTHORIZATION);
|
||||
if (auth == null) {
|
||||
throw new NotAuthorizedException("Authentication credentials are required",
|
||||
"Missing authentication credentials");
|
||||
throw new NotAuthorizedException(
|
||||
"Authentication credentials are required",
|
||||
"Missing authentication credentials");
|
||||
}
|
||||
|
||||
if (auth.startsWith(BASIC_AUTH_PREFIX)) {
|
||||
auth = auth.substring(BASIC_AUTH_PREFIX.length());
|
||||
auth = new String(DatatypeConverter.parseBase64Binary(auth), Charsets.ASCII_CHARSET);
|
||||
auth = new String(DatatypeConverter.parseBase64Binary(auth),
|
||||
Charsets.ASCII_CHARSET);
|
||||
String[] values = auth.split(":");
|
||||
if (values.length != 2) {
|
||||
throw new BadRequestException("Invalid syntax for username and password");
|
||||
throw new BadRequestException(
|
||||
"Invalid syntax for username and password");
|
||||
}
|
||||
|
||||
final String username = values[0];
|
||||
final String password = values[1];
|
||||
|
||||
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
|
||||
throw new BadRequestException("Invalid syntax for username and password");
|
||||
if (StringUtils.isEmpty(username) ||
|
||||
StringUtils.isEmpty(password)) {
|
||||
throw new BadRequestException(
|
||||
"Invalid syntax for username and password");
|
||||
}
|
||||
|
||||
credentials.put(HugeAuthenticator.KEY_USERNAME, username);
|
||||
|
|
@ -169,7 +171,8 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||
String token = auth.substring(BEARER_TOKEN_PREFIX.length());
|
||||
credentials.put(HugeAuthenticator.KEY_TOKEN, token);
|
||||
} else {
|
||||
throw new BadRequestException("Only HTTP Basic or Bearer authentication is supported");
|
||||
throw new BadRequestException(
|
||||
"Only HTTP Basic or Bearer authentication is supported");
|
||||
}
|
||||
|
||||
credentials.put(HugeAuthenticator.KEY_ADDRESS, peer);
|
||||
|
|
@ -179,7 +182,8 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||
try {
|
||||
return manager.authenticate(credentials);
|
||||
} catch (AuthenticationException e) {
|
||||
throw new NotAuthorizedException("Authentication failed", e.getMessage());
|
||||
throw new NotAuthorizedException("Authentication failed",
|
||||
e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -243,7 +247,7 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||
requiredPerm = RequiredPerm.fromPermission(required);
|
||||
|
||||
/*
|
||||
* Replace owner value (it may be a variable) if the permission
|
||||
* Replace owner value(it may be a variable) if the permission
|
||||
* format like: "$owner=$graph $action=vertex_write"
|
||||
*/
|
||||
String owner = requiredPerm.owner();
|
||||
|
|
@ -259,7 +263,8 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Verify permission {} {} for user '{}' with role {}",
|
||||
requiredPerm.action().string(), requiredPerm.resourceObject(),
|
||||
requiredPerm.action().string(),
|
||||
requiredPerm.resourceObject(),
|
||||
this.user.username(), this.user.role());
|
||||
}
|
||||
|
||||
|
|
@ -268,8 +273,9 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||
|
||||
if (!valid && LOG.isInfoEnabled() &&
|
||||
!required.equals(HugeAuthenticator.USER_ADMIN)) {
|
||||
LOG.info("User '{}' is denied to {} {}", this.user.username(),
|
||||
requiredPerm.action().string(), requiredPerm.resourceObject());
|
||||
LOG.info("User '{}' is denied to {} {}",
|
||||
this.user.username(), requiredPerm.action().string(),
|
||||
requiredPerm.resourceObject());
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
|
@ -307,12 +313,9 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||
|
||||
public static boolean isWhiteAPI(ContainerRequestContext context) {
|
||||
String path = context.getUriInfo().getPath();
|
||||
if (FIXED_WHITE_API_SET.contains(path)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (String whiteApi : FLEXIBLE_WHITE_API_SET) {
|
||||
if (MATCHER.match(whiteApi, path)) {
|
||||
for (String whiteApi : WHITE_API_LIST) {
|
||||
if (path.endsWith(whiteApi)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -24,17 +24,18 @@ import java.lang.annotation.Retention;
|
|||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import jakarta.inject.Singleton;
|
||||
import jakarta.ws.rs.NameBinding;
|
||||
import jakarta.ws.rs.WebApplicationException;
|
||||
import jakarta.ws.rs.core.MultivaluedMap;
|
||||
import jakarta.ws.rs.ext.Provider;
|
||||
import jakarta.ws.rs.ext.WriterInterceptor;
|
||||
import jakarta.ws.rs.ext.WriterInterceptorContext;
|
||||
import jakarta.inject.Singleton;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
|
||||
@Provider
|
||||
@Singleton
|
||||
|
|
@ -50,7 +51,7 @@ public class CompressInterceptor implements WriterInterceptor {
|
|||
|
||||
@Override
|
||||
public void aroundWriteTo(WriterInterceptorContext context)
|
||||
throws IOException, WebApplicationException {
|
||||
throws IOException, WebApplicationException {
|
||||
// If there is no annotation(like exception), we don't compress it
|
||||
if (context.getAnnotations().length > 0) {
|
||||
try {
|
||||
|
|
@ -69,14 +70,14 @@ public class CompressInterceptor implements WriterInterceptor {
|
|||
}
|
||||
|
||||
private void compress(WriterInterceptorContext context)
|
||||
throws IOException {
|
||||
throws IOException {
|
||||
// Get compress info from the @Compress annotation
|
||||
final Compress compression = getCompressAnnotation(context);
|
||||
final String encoding = compression.value();
|
||||
final int buffer = compression.buffer();
|
||||
|
||||
// Update header
|
||||
MultivaluedMap<String, Object> headers = context.getHeaders();
|
||||
MultivaluedMap<String,Object> headers = context.getHeaders();
|
||||
headers.remove("Content-Length");
|
||||
headers.add("Content-Encoding", encoding);
|
||||
|
||||
|
|
@ -103,9 +104,7 @@ public class CompressInterceptor implements WriterInterceptor {
|
|||
@NameBinding
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Compress {
|
||||
|
||||
String value() default GZIP;
|
||||
|
||||
int buffer() default BUFFER_SIZE;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -37,7 +37,7 @@ public class DecompressInterceptor implements ReaderInterceptor {
|
|||
|
||||
@Override
|
||||
public Object aroundReadFrom(ReaderInterceptorContext context)
|
||||
throws IOException {
|
||||
throws IOException {
|
||||
// NOTE: Currently we just support GZIP
|
||||
String encoding = context.getHeaders().getFirst("Content-Encoding");
|
||||
if (!GZIP.equalsIgnoreCase(encoding)) {
|
||||
|
|
@ -47,10 +47,10 @@ public class DecompressInterceptor implements ReaderInterceptor {
|
|||
return context.proceed();
|
||||
}
|
||||
|
||||
|
||||
@NameBinding
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Decompress {
|
||||
|
||||
String value() default GZIP;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -25,18 +25,6 @@ import javax.json.Json;
|
|||
import javax.json.JsonArrayBuilder;
|
||||
import javax.json.JsonObjectBuilder;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.hugegraph.HugeException;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.hugegraph.config.ServerOptions;
|
||||
import org.apache.hugegraph.exception.HugeGremlinException;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
import org.glassfish.hk2.api.MultiException;
|
||||
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Singleton;
|
||||
|
|
@ -53,6 +41,18 @@ import jakarta.ws.rs.core.Response;
|
|||
import jakarta.ws.rs.ext.ExceptionMapper;
|
||||
import jakarta.ws.rs.ext.Provider;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.hugegraph.config.ServerOptions;
|
||||
import org.glassfish.hk2.api.MultiException;
|
||||
|
||||
import org.apache.hugegraph.HugeException;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.hugegraph.exception.HugeGremlinException;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
public class ExceptionFilter {
|
||||
|
||||
private static final int BAD_REQUEST_ERROR =
|
||||
|
|
@ -107,8 +107,8 @@ public class ExceptionFilter {
|
|||
|
||||
@Provider
|
||||
public static class HugeExceptionMapper
|
||||
extends TracedExceptionMapper
|
||||
implements ExceptionMapper<HugeException> {
|
||||
extends TracedExceptionMapper
|
||||
implements ExceptionMapper<HugeException> {
|
||||
|
||||
@Override
|
||||
public Response toResponse(HugeException exception) {
|
||||
|
|
@ -121,8 +121,8 @@ public class ExceptionFilter {
|
|||
|
||||
@Provider
|
||||
public static class IllegalArgumentExceptionMapper
|
||||
extends TracedExceptionMapper
|
||||
implements ExceptionMapper<IllegalArgumentException> {
|
||||
extends TracedExceptionMapper
|
||||
implements ExceptionMapper<IllegalArgumentException> {
|
||||
|
||||
@Override
|
||||
public Response toResponse(IllegalArgumentException exception) {
|
||||
|
|
@ -135,8 +135,8 @@ public class ExceptionFilter {
|
|||
|
||||
@Provider
|
||||
public static class NotFoundExceptionMapper
|
||||
extends TracedExceptionMapper
|
||||
implements ExceptionMapper<NotFoundException> {
|
||||
extends TracedExceptionMapper
|
||||
implements ExceptionMapper<NotFoundException> {
|
||||
|
||||
@Override
|
||||
public Response toResponse(NotFoundException exception) {
|
||||
|
|
@ -149,8 +149,8 @@ public class ExceptionFilter {
|
|||
|
||||
@Provider
|
||||
public static class NoSuchElementExceptionMapper
|
||||
extends TracedExceptionMapper
|
||||
implements ExceptionMapper<NoSuchElementException> {
|
||||
extends TracedExceptionMapper
|
||||
implements ExceptionMapper<NoSuchElementException> {
|
||||
|
||||
@Override
|
||||
public Response toResponse(NoSuchElementException exception) {
|
||||
|
|
@ -163,8 +163,8 @@ public class ExceptionFilter {
|
|||
|
||||
@Provider
|
||||
public static class WebApplicationExceptionMapper
|
||||
extends TracedExceptionMapper
|
||||
implements ExceptionMapper<WebApplicationException> {
|
||||
extends TracedExceptionMapper
|
||||
implements ExceptionMapper<WebApplicationException> {
|
||||
|
||||
@Override
|
||||
public Response toResponse(WebApplicationException exception) {
|
||||
|
|
@ -189,8 +189,8 @@ public class ExceptionFilter {
|
|||
|
||||
@Provider
|
||||
public static class HugeGremlinExceptionMapper
|
||||
extends TracedExceptionMapper
|
||||
implements ExceptionMapper<HugeGremlinException> {
|
||||
extends TracedExceptionMapper
|
||||
implements ExceptionMapper<HugeGremlinException> {
|
||||
|
||||
@Override
|
||||
public Response toResponse(HugeGremlinException exception) {
|
||||
|
|
@ -204,7 +204,7 @@ public class ExceptionFilter {
|
|||
|
||||
@Provider
|
||||
public static class AssertionErrorMapper extends TracedExceptionMapper
|
||||
implements ExceptionMapper<AssertionError> {
|
||||
implements ExceptionMapper<AssertionError> {
|
||||
|
||||
@Override
|
||||
public Response toResponse(AssertionError exception) {
|
||||
|
|
@ -217,7 +217,7 @@ public class ExceptionFilter {
|
|||
|
||||
@Provider
|
||||
public static class UnknownExceptionMapper extends TracedExceptionMapper
|
||||
implements ExceptionMapper<Throwable> {
|
||||
implements ExceptionMapper<Throwable> {
|
||||
|
||||
@Override
|
||||
public Response toResponse(Throwable exception) {
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -20,15 +20,6 @@ package org.apache.hugegraph.api.filter;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.hugegraph.config.ServerOptions;
|
||||
import org.apache.hugegraph.define.WorkLoad;
|
||||
import org.apache.hugegraph.util.Bytes;
|
||||
import org.apache.hugegraph.util.E;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.util.concurrent.RateLimiter;
|
||||
|
||||
import jakarta.inject.Singleton;
|
||||
import jakarta.ws.rs.ServiceUnavailableException;
|
||||
import jakarta.ws.rs.container.ContainerRequestContext;
|
||||
|
|
@ -38,6 +29,14 @@ import jakarta.ws.rs.core.Context;
|
|||
import jakarta.ws.rs.core.PathSegment;
|
||||
import jakarta.ws.rs.ext.Provider;
|
||||
|
||||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.hugegraph.config.ServerOptions;
|
||||
import org.apache.hugegraph.define.WorkLoad;
|
||||
import org.apache.hugegraph.util.Bytes;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.util.concurrent.RateLimiter;
|
||||
|
||||
@Provider
|
||||
@Singleton
|
||||
@PreMatching
|
||||
|
|
@ -52,7 +51,7 @@ public class LoadDetectFilter implements ContainerRequestFilter {
|
|||
|
||||
// Call gc every 30+ seconds if memory is low and request frequently
|
||||
private static final RateLimiter GC_RATE_LIMITER =
|
||||
RateLimiter.create(1.0 / 30);
|
||||
RateLimiter.create(1.0 / 30);
|
||||
|
||||
@Context
|
||||
private jakarta.inject.Provider<HugeConfig> configProvider;
|
||||
|
|
@ -72,9 +71,9 @@ public class LoadDetectFilter implements ContainerRequestFilter {
|
|||
// There will be a thread doesn't work, dedicated to statistics
|
||||
if (load.incrementAndGet() >= maxWorkerThreads) {
|
||||
throw new ServiceUnavailableException(String.format(
|
||||
"The server is too busy to process the request, " +
|
||||
"you can config %s to adjust it or try again later",
|
||||
ServerOptions.MAX_WORKER_THREADS.name()));
|
||||
"The server is too busy to process the request, " +
|
||||
"you can config %s to adjust it or try again later",
|
||||
ServerOptions.MAX_WORKER_THREADS.name()));
|
||||
}
|
||||
|
||||
long minFreeMemory = config.get(ServerOptions.MIN_FREE_MEMORY);
|
||||
|
|
@ -85,17 +84,17 @@ public class LoadDetectFilter implements ContainerRequestFilter {
|
|||
if (presumableFreeMem < minFreeMemory) {
|
||||
gcIfNeeded();
|
||||
throw new ServiceUnavailableException(String.format(
|
||||
"The server available memory %s(MB) is below than " +
|
||||
"threshold %s(MB) and can't process the request, " +
|
||||
"you can config %s to adjust it or try again later",
|
||||
presumableFreeMem, minFreeMemory,
|
||||
ServerOptions.MIN_FREE_MEMORY.name()));
|
||||
"The server available memory %s(MB) is below than " +
|
||||
"threshold %s(MB) and can't process the request, " +
|
||||
"you can config %s to adjust it or try again later",
|
||||
presumableFreeMem, minFreeMemory,
|
||||
ServerOptions.MIN_FREE_MEMORY.name()));
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isWhiteAPI(ContainerRequestContext context) {
|
||||
List<PathSegment> segments = context.getUriInfo().getPathSegments();
|
||||
E.checkArgument(!segments.isEmpty(), "Invalid request uri '%s'",
|
||||
E.checkArgument(segments.size() > 0, "Invalid request uri '%s'",
|
||||
context.getUriInfo().getPath());
|
||||
String rootPath = segments.get(0).getPath();
|
||||
return WHITE_API_LIST.contains(rootPath);
|
||||
|
|
@ -1,24 +1,22 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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 org.apache.hugegraph.define.WorkLoad;
|
||||
|
||||
import jakarta.inject.Singleton;
|
||||
import jakarta.ws.rs.container.ContainerRequestContext;
|
||||
import jakarta.ws.rs.container.ContainerResponseContext;
|
||||
|
|
@ -26,6 +24,8 @@ import jakarta.ws.rs.container.ContainerResponseFilter;
|
|||
import jakarta.ws.rs.core.Context;
|
||||
import jakarta.ws.rs.ext.Provider;
|
||||
|
||||
import org.apache.hugegraph.define.WorkLoad;
|
||||
|
||||
@Provider
|
||||
@Singleton
|
||||
public class LoadReleaseFilter implements ContainerResponseFilter {
|
||||
|
|
@ -15,25 +15,26 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hugegraph.config;
|
||||
package org.apache.hugegraph.api.filter;
|
||||
|
||||
public class ConfigException extends RuntimeException {
|
||||
import java.io.IOException;
|
||||
|
||||
private static final long serialVersionUID = -8711375282196157058L;
|
||||
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;
|
||||
|
||||
public ConfigException(String message) {
|
||||
super(message);
|
||||
}
|
||||
@Provider
|
||||
@Singleton
|
||||
@PreMatching
|
||||
public class PathFilter implements ContainerRequestFilter {
|
||||
|
||||
public ConfigException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
public static final String REQUEST_TIME = "request_time";
|
||||
|
||||
public ConfigException(String message, Object... args) {
|
||||
super(String.format(message, args));
|
||||
}
|
||||
|
||||
public ConfigException(String message, Throwable cause, Object... args) {
|
||||
super(String.format(message, args), cause);
|
||||
@Override
|
||||
public void filter(ContainerRequestContext context)
|
||||
throws IOException {
|
||||
context.setProperty(REQUEST_TIME, System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -82,16 +82,16 @@ public class RedirectFilter implements ContainerRequestFilter {
|
|||
return;
|
||||
}
|
||||
|
||||
GlobalMasterInfo globalNodeInfo = manager.globalNodeRoleInfo();
|
||||
if (globalNodeInfo == null || !globalNodeInfo.supportElection()) {
|
||||
GlobalMasterInfo globalMasterInfo = manager.globalMasterInfo();
|
||||
if (globalMasterInfo == null || !globalMasterInfo.isFeatureSupport()) {
|
||||
return;
|
||||
}
|
||||
GlobalMasterInfo.NodeInfo masterInfo = globalNodeInfo.masterInfo();
|
||||
if (masterInfo == null || masterInfo.isMaster() ||
|
||||
StringUtils.isEmpty(masterInfo.nodeUrl())) {
|
||||
GlobalMasterInfo.NodeInfo masterNodeInfo = globalMasterInfo.nodeInfo();
|
||||
if (masterNodeInfo == null || masterNodeInfo.isMaster() ||
|
||||
StringUtils.isEmpty(masterNodeInfo.url())) {
|
||||
return;
|
||||
}
|
||||
String url = masterInfo.nodeUrl();
|
||||
String url = masterNodeInfo.url();
|
||||
|
||||
URI redirectUri;
|
||||
try {
|
||||
|
|
@ -151,6 +151,5 @@ public class RedirectFilter implements ContainerRequestFilter {
|
|||
@NameBinding
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface RedirectMasterRole {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -34,7 +34,7 @@ public class StatusFilter implements ContainerResponseFilter {
|
|||
@Override
|
||||
public void filter(ContainerRequestContext requestContext,
|
||||
ContainerResponseContext responseContext)
|
||||
throws IOException {
|
||||
throws IOException {
|
||||
if (responseContext.getStatus() == 200) {
|
||||
for (Annotation i : responseContext.getEntityAnnotations()) {
|
||||
if (i instanceof Status) {
|
||||
|
|
@ -48,7 +48,6 @@ public class StatusFilter implements ContainerResponseFilter {
|
|||
@NameBinding
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Status {
|
||||
|
||||
int OK = 200;
|
||||
int CREATED = 201;
|
||||
int ACCEPTED = 202;
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.graph;
|
||||
|
|
@ -21,21 +21,21 @@ import java.util.Map;
|
|||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.hugegraph.HugeException;
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.tinkerpop.gremlin.structure.Element;
|
||||
import org.apache.hugegraph.config.ServerOptions;
|
||||
import org.apache.hugegraph.define.Checkable;
|
||||
import org.apache.hugegraph.define.UpdateStrategy;
|
||||
import org.apache.hugegraph.metrics.MetricsUtil;
|
||||
import org.apache.hugegraph.server.RestServer;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import org.apache.hugegraph.HugeException;
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.hugegraph.structure.HugeElement;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import org.apache.tinkerpop.gremlin.structure.Element;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import com.codahale.metrics.Meter;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
|
@ -49,13 +49,14 @@ public class BatchAPI extends API {
|
|||
|
||||
static {
|
||||
MetricsUtil.registerGauge(RestServer.class, "batch-write-threads",
|
||||
BATCH_WRITE_THREADS::intValue);
|
||||
() -> BATCH_WRITE_THREADS.intValue());
|
||||
}
|
||||
|
||||
private final Meter batchMeter;
|
||||
|
||||
public BatchAPI() {
|
||||
this.batchMeter = MetricsUtil.registerMeter(this.getClass(), "batch-commit");
|
||||
this.batchMeter = MetricsUtil.registerMeter(this.getClass(),
|
||||
"batch-commit");
|
||||
}
|
||||
|
||||
public <R> R commit(HugeConfig config, HugeGraph g, int size,
|
||||
|
|
@ -98,7 +99,8 @@ public class BatchAPI extends API {
|
|||
protected abstract Object[] properties();
|
||||
}
|
||||
|
||||
protected void updateExistElement(JsonElement oldElement, JsonElement newElement,
|
||||
protected void updateExistElement(JsonElement oldElement,
|
||||
JsonElement newElement,
|
||||
Map<String, UpdateStrategy> strategies) {
|
||||
if (oldElement == null) {
|
||||
return;
|
||||
|
|
@ -111,8 +113,8 @@ public class BatchAPI extends API {
|
|||
if (oldElement.properties.get(key) != null &&
|
||||
newElement.properties.get(key) != null) {
|
||||
Object value = updateStrategy.checkAndUpdateProperty(
|
||||
oldElement.properties.get(key),
|
||||
newElement.properties.get(key));
|
||||
oldElement.properties.get(key),
|
||||
newElement.properties.get(key));
|
||||
newElement.properties.put(key, value);
|
||||
} else if (oldElement.properties.get(key) != null &&
|
||||
newElement.properties.get(key) == null) {
|
||||
|
|
@ -122,7 +124,9 @@ public class BatchAPI extends API {
|
|||
}
|
||||
}
|
||||
|
||||
protected void updateExistElement(HugeGraph g, Element oldElement, JsonElement newElement,
|
||||
protected void updateExistElement(HugeGraph g,
|
||||
Element oldElement,
|
||||
JsonElement newElement,
|
||||
Map<String, UpdateStrategy> strategies) {
|
||||
if (oldElement == null) {
|
||||
return;
|
||||
|
|
@ -135,8 +139,8 @@ public class BatchAPI extends API {
|
|||
if (oldElement.property(key).isPresent() &&
|
||||
newElement.properties.get(key) != null) {
|
||||
Object value = updateStrategy.checkAndUpdateProperty(
|
||||
oldElement.property(key).value(),
|
||||
newElement.properties.get(key));
|
||||
oldElement.property(key).value(),
|
||||
newElement.properties.get(key));
|
||||
value = g.propertyKey(key).validValueOrThrow(value);
|
||||
newElement.properties.put(key, value);
|
||||
} else if (oldElement.property(key).isPresent() &&
|
||||
|
|
@ -147,7 +151,8 @@ public class BatchAPI extends API {
|
|||
}
|
||||
}
|
||||
|
||||
protected static void updateProperties(HugeElement element, JsonElement jsonElement,
|
||||
protected static void updateProperties(HugeElement element,
|
||||
JsonElement jsonElement,
|
||||
boolean append) {
|
||||
for (Map.Entry<String, Object> e : jsonElement.properties.entrySet()) {
|
||||
String key = e.getKey();
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.graph;
|
||||
|
|
@ -24,39 +24,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
|
||||
import org.apache.hugegraph.api.filter.DecompressInterceptor.Decompress;
|
||||
import org.apache.hugegraph.api.filter.StatusFilter.Status;
|
||||
import org.apache.hugegraph.backend.id.EdgeId;
|
||||
import org.apache.hugegraph.backend.id.Id;
|
||||
import org.apache.hugegraph.backend.query.ConditionQuery;
|
||||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.hugegraph.config.ServerOptions;
|
||||
import org.apache.hugegraph.core.GraphManager;
|
||||
import org.apache.hugegraph.define.UpdateStrategy;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
import org.apache.hugegraph.schema.EdgeLabel;
|
||||
import org.apache.hugegraph.schema.PropertyKey;
|
||||
import org.apache.hugegraph.schema.VertexLabel;
|
||||
import org.apache.hugegraph.structure.HugeEdge;
|
||||
import org.apache.hugegraph.structure.HugeVertex;
|
||||
import org.apache.hugegraph.traversal.optimize.QueryHolder;
|
||||
import org.apache.hugegraph.traversal.optimize.TraversalUtil;
|
||||
import org.apache.hugegraph.type.define.Directions;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
|
||||
import org.apache.tinkerpop.gremlin.structure.Direction;
|
||||
import org.apache.tinkerpop.gremlin.structure.Edge;
|
||||
import org.apache.tinkerpop.gremlin.structure.Vertex;
|
||||
import org.apache.tinkerpop.gremlin.util.function.TriFunction;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Singleton;
|
||||
|
|
@ -72,6 +39,39 @@ import jakarta.ws.rs.Produces;
|
|||
import jakarta.ws.rs.QueryParam;
|
||||
import jakarta.ws.rs.core.Context;
|
||||
|
||||
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
|
||||
import org.apache.tinkerpop.gremlin.structure.Direction;
|
||||
import org.apache.tinkerpop.gremlin.structure.Edge;
|
||||
import org.apache.tinkerpop.gremlin.structure.Vertex;
|
||||
import org.apache.tinkerpop.gremlin.util.function.TriFunction;
|
||||
import org.apache.hugegraph.config.ServerOptions;
|
||||
import org.apache.hugegraph.core.GraphManager;
|
||||
import org.apache.hugegraph.define.UpdateStrategy;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
|
||||
import org.apache.hugegraph.api.filter.DecompressInterceptor.Decompress;
|
||||
import org.apache.hugegraph.api.filter.StatusFilter.Status;
|
||||
import org.apache.hugegraph.backend.id.EdgeId;
|
||||
import org.apache.hugegraph.backend.id.Id;
|
||||
import org.apache.hugegraph.backend.query.ConditionQuery;
|
||||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
import org.apache.hugegraph.schema.EdgeLabel;
|
||||
import org.apache.hugegraph.schema.PropertyKey;
|
||||
import org.apache.hugegraph.schema.VertexLabel;
|
||||
import org.apache.hugegraph.structure.HugeEdge;
|
||||
import org.apache.hugegraph.structure.HugeVertex;
|
||||
import org.apache.hugegraph.traversal.optimize.QueryHolder;
|
||||
import org.apache.hugegraph.traversal.optimize.TraversalUtil;
|
||||
import org.apache.hugegraph.type.define.Directions;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@Path("graphs/{graph}/graph/edges")
|
||||
@Singleton
|
||||
@Tag(name = "EdgeAPI")
|
||||
|
|
@ -98,15 +98,18 @@ public class EdgeAPI extends BatchAPI {
|
|||
* NOTE: If the vertex id is correct but label not match with id,
|
||||
* we allow to create it here
|
||||
*/
|
||||
vertexLabel(g, jsonEdge.sourceLabel, "Invalid source vertex label '%s'");
|
||||
vertexLabel(g, jsonEdge.targetLabel, "Invalid target vertex label '%s'");
|
||||
vertexLabel(g, jsonEdge.sourceLabel,
|
||||
"Invalid source vertex label '%s'");
|
||||
vertexLabel(g, jsonEdge.targetLabel,
|
||||
"Invalid target vertex label '%s'");
|
||||
}
|
||||
|
||||
Vertex srcVertex = getVertex(g, jsonEdge.source, jsonEdge.sourceLabel);
|
||||
Vertex tgtVertex = getVertex(g, jsonEdge.target, jsonEdge.targetLabel);
|
||||
|
||||
Edge edge = commit(g, () -> {
|
||||
return srcVertex.addEdge(jsonEdge.label, tgtVertex, jsonEdge.properties());
|
||||
return srcVertex.addEdge(jsonEdge.label, tgtVertex,
|
||||
jsonEdge.properties());
|
||||
});
|
||||
|
||||
return manager.serializer(g).writeEdge(edge);
|
||||
|
|
@ -133,7 +136,7 @@ public class EdgeAPI extends BatchAPI {
|
|||
HugeGraph g = graph(manager, graph);
|
||||
|
||||
TriFunction<HugeGraph, Object, String, Vertex> getVertex =
|
||||
checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex;
|
||||
checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex;
|
||||
|
||||
return this.commit(config, g, jsonEdges.size(), () -> {
|
||||
List<Id> ids = new ArrayList<>(jsonEdges.size());
|
||||
|
|
@ -143,9 +146,12 @@ public class EdgeAPI extends BatchAPI {
|
|||
* then the label is correct and not matched id,
|
||||
* it will be allowed currently
|
||||
*/
|
||||
Vertex srcVertex = getVertex.apply(g, jsonEdge.source, jsonEdge.sourceLabel);
|
||||
Vertex tgtVertex = getVertex.apply(g, jsonEdge.target, jsonEdge.targetLabel);
|
||||
Edge edge = srcVertex.addEdge(jsonEdge.label, tgtVertex, jsonEdge.properties());
|
||||
Vertex srcVertex = getVertex.apply(g, jsonEdge.source,
|
||||
jsonEdge.sourceLabel);
|
||||
Vertex tgtVertex = getVertex.apply(g, jsonEdge.target,
|
||||
jsonEdge.targetLabel);
|
||||
Edge edge = srcVertex.addEdge(jsonEdge.label, tgtVertex,
|
||||
jsonEdge.properties());
|
||||
ids.add((Id) edge.id());
|
||||
}
|
||||
return manager.serializer(g).writeIds(ids);
|
||||
|
|
@ -173,16 +179,16 @@ public class EdgeAPI extends BatchAPI {
|
|||
|
||||
HugeGraph g = graph(manager, graph);
|
||||
Map<Id, JsonEdge> map = new HashMap<>(req.jsonEdges.size());
|
||||
TriFunction<HugeGraph, Object, String, Vertex> getVertex = req.checkVertex ?
|
||||
EdgeAPI::getVertex :
|
||||
EdgeAPI::newVertex;
|
||||
TriFunction<HugeGraph, Object, String, Vertex> getVertex =
|
||||
req.checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex;
|
||||
|
||||
return this.commit(config, g, 0, () -> {
|
||||
return this.commit(config, g, map.size(), () -> {
|
||||
// 1.Put all newEdges' properties into map (combine first)
|
||||
req.jsonEdges.forEach(newEdge -> {
|
||||
Id newEdgeId = getEdgeId(graph(manager, graph), newEdge);
|
||||
JsonEdge oldEdge = map.get(newEdgeId);
|
||||
this.updateExistElement(oldEdge, newEdge, req.updateStrategies);
|
||||
this.updateExistElement(oldEdge, newEdge,
|
||||
req.updateStrategies);
|
||||
map.put(newEdgeId, newEdge);
|
||||
});
|
||||
|
||||
|
|
@ -191,15 +197,19 @@ public class EdgeAPI extends BatchAPI {
|
|||
Iterator<Edge> oldEdges = g.edges(ids);
|
||||
oldEdges.forEachRemaining(oldEdge -> {
|
||||
JsonEdge newEdge = map.get(oldEdge.id());
|
||||
this.updateExistElement(g, oldEdge, newEdge, req.updateStrategies);
|
||||
this.updateExistElement(g, oldEdge, newEdge,
|
||||
req.updateStrategies);
|
||||
});
|
||||
|
||||
// 3.Add all finalEdges
|
||||
List<Edge> edges = new ArrayList<>(map.size());
|
||||
map.values().forEach(finalEdge -> {
|
||||
Vertex srcVertex = getVertex.apply(g, finalEdge.source, finalEdge.sourceLabel);
|
||||
Vertex tgtVertex = getVertex.apply(g, finalEdge.target, finalEdge.targetLabel);
|
||||
edges.add(srcVertex.addEdge(finalEdge.label, tgtVertex, finalEdge.properties()));
|
||||
Vertex srcVertex = getVertex.apply(g, finalEdge.source,
|
||||
finalEdge.sourceLabel);
|
||||
Vertex tgtVertex = getVertex.apply(g, finalEdge.target,
|
||||
finalEdge.targetLabel);
|
||||
edges.add(srcVertex.addEdge(finalEdge.label, tgtVertex,
|
||||
finalEdge.properties()));
|
||||
});
|
||||
|
||||
// If return ids, the ids.size() maybe different with the origins'
|
||||
|
|
@ -243,6 +253,7 @@ public class EdgeAPI extends BatchAPI {
|
|||
}
|
||||
|
||||
commit(g, () -> updateProperties(edge, jsonEdge, append));
|
||||
|
||||
return manager.serializer(g).writeEdge(edge);
|
||||
}
|
||||
|
||||
|
|
@ -270,7 +281,8 @@ public class EdgeAPI extends BatchAPI {
|
|||
Map<String, Object> props = parseProperties(properties);
|
||||
if (page != null) {
|
||||
E.checkArgument(offset == 0,
|
||||
"Not support querying edges based on paging and offset together");
|
||||
"Not support querying edges based on paging " +
|
||||
"and offset together");
|
||||
}
|
||||
|
||||
Id vertex = VertexAPI.checkAndParseVertexId(vertexId);
|
||||
|
|
@ -309,7 +321,8 @@ public class EdgeAPI extends BatchAPI {
|
|||
if (page == null) {
|
||||
traversal = traversal.range(offset, offset + limit);
|
||||
} else {
|
||||
traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page).limit(limit);
|
||||
traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page)
|
||||
.limit(limit);
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
@ -359,38 +372,42 @@ public class EdgeAPI extends BatchAPI {
|
|||
g.removeEdge(label, id);
|
||||
} catch (NotFoundException e) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"No such edge with id: '%s', %s", id, e));
|
||||
"No such edge with id: '%s', %s", id, e));
|
||||
} catch (NoSuchElementException e) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"No such edge with id: '%s'", id));
|
||||
"No such edge with id: '%s'", id));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void checkBatchSize(HugeConfig config, List<JsonEdge> edges) {
|
||||
private static void checkBatchSize(HugeConfig config,
|
||||
List<JsonEdge> edges) {
|
||||
int max = config.get(ServerOptions.MAX_EDGES_PER_BATCH);
|
||||
if (edges.size() > max) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Too many edges for one time post, " +
|
||||
"the maximum number is '%s'", max));
|
||||
"Too many edges for one time post, " +
|
||||
"the maximum number is '%s'", max));
|
||||
}
|
||||
if (edges.isEmpty()) {
|
||||
throw new IllegalArgumentException("The number of edges can't be 0");
|
||||
if (edges.size() == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"The number of edges can't be 0");
|
||||
}
|
||||
}
|
||||
|
||||
private static Vertex getVertex(HugeGraph graph, Object id, String label) {
|
||||
private static Vertex getVertex(HugeGraph graph,
|
||||
Object id, String label) {
|
||||
HugeVertex vertex;
|
||||
try {
|
||||
vertex = (HugeVertex) graph.vertices(id).next();
|
||||
} catch (NoSuchElementException e) {
|
||||
throw new IllegalArgumentException(String.format("Invalid vertex id '%s'", id));
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Invalid vertex id '%s'", id));
|
||||
}
|
||||
if (label != null && !vertex.label().equals(label)) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"The label of vertex '%s' is unmatched, users expect " +
|
||||
"label '%s', actual label stored is '%s'",
|
||||
id, label, vertex.label()));
|
||||
"The label of vertex '%s' is unmatched, users expect " +
|
||||
"label '%s', actual label stored is '%s'",
|
||||
id, label, vertex.label()));
|
||||
}
|
||||
// Clone a new vertex to support multi-thread access
|
||||
return vertex.copy();
|
||||
|
|
@ -402,7 +419,8 @@ public class EdgeAPI extends BatchAPI {
|
|||
return new HugeVertex(g, idValue, vl);
|
||||
}
|
||||
|
||||
private static VertexLabel vertexLabel(HugeGraph graph, String label, String message) {
|
||||
private static VertexLabel vertexLabel(HugeGraph graph, String label,
|
||||
String message) {
|
||||
try {
|
||||
// NOTE: don't use SchemaManager because it will throw 404
|
||||
return graph.vertexLabel(label);
|
||||
|
|
@ -419,8 +437,8 @@ public class EdgeAPI extends BatchAPI {
|
|||
return Direction.valueOf(direction);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Direction value must be in [OUT, IN, BOTH], " +
|
||||
"but got '%s'", direction));
|
||||
"Direction value must be in [OUT, IN, BOTH], " +
|
||||
"but got '%s'", direction));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -435,7 +453,8 @@ public class EdgeAPI extends BatchAPI {
|
|||
String sortKey = pk.name();
|
||||
Object sortKeyValue = newEdge.properties.get(sortKey);
|
||||
E.checkArgument(sortKeyValue != null,
|
||||
"The value of sort key '%s' can't be null", sortKey);
|
||||
"The value of sort key '%s' can't be null",
|
||||
sortKey);
|
||||
sortKeyValue = pk.validValueOrThrow(sortKeyValue);
|
||||
sortKeyValues.add(sortKeyValue);
|
||||
});
|
||||
|
|
@ -468,11 +487,14 @@ public class EdgeAPI extends BatchAPI {
|
|||
|
||||
private static void checkUpdate(BatchEdgeRequest req) {
|
||||
E.checkArgumentNotNull(req, "BatchEdgeRequest can't be null");
|
||||
E.checkArgumentNotNull(req.jsonEdges, "Parameter 'edges' can't be null");
|
||||
E.checkArgument(req.updateStrategies != null && !req.updateStrategies.isEmpty(),
|
||||
E.checkArgumentNotNull(req.jsonEdges,
|
||||
"Parameter 'edges' can't be null");
|
||||
E.checkArgument(req.updateStrategies != null &&
|
||||
!req.updateStrategies.isEmpty(),
|
||||
"Parameter 'update_strategies' can't be empty");
|
||||
E.checkArgument(req.createIfNotExist,
|
||||
"Parameter 'create_if_not_exist' dose not support false now");
|
||||
E.checkArgument(req.createIfNotExist == true,
|
||||
"Parameter 'create_if_not_exist' " +
|
||||
"dose not support false now");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -502,11 +524,15 @@ public class EdgeAPI extends BatchAPI {
|
|||
E.checkArgumentNotNull(this.source, "Expect source vertex id");
|
||||
E.checkArgumentNotNull(this.target, "Expect target vertex id");
|
||||
if (isBatch) {
|
||||
E.checkArgumentNotNull(this.sourceLabel, "Expect source vertex label");
|
||||
E.checkArgumentNotNull(this.targetLabel, "Expect target vertex label");
|
||||
E.checkArgumentNotNull(this.sourceLabel,
|
||||
"Expect source vertex label");
|
||||
E.checkArgumentNotNull(this.targetLabel,
|
||||
"Expect target vertex label");
|
||||
} else {
|
||||
E.checkArgument(this.sourceLabel == null && this.targetLabel == null ||
|
||||
this.sourceLabel != null && this.targetLabel != null,
|
||||
E.checkArgument(this.sourceLabel == null &&
|
||||
this.targetLabel == null ||
|
||||
this.sourceLabel != null &&
|
||||
this.targetLabel != null,
|
||||
"The both source and target vertex label " +
|
||||
"are either passed in, or not passed in");
|
||||
}
|
||||
|
|
@ -515,13 +541,15 @@ public class EdgeAPI extends BatchAPI {
|
|||
|
||||
@Override
|
||||
public void checkUpdate() {
|
||||
E.checkArgumentNotNull(this.properties, "The properties of edge can't be null");
|
||||
E.checkArgumentNotNull(this.properties,
|
||||
"The properties of edge can't be null");
|
||||
|
||||
for (Map.Entry<String, Object> entry : this.properties.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
E.checkArgumentNotNull(value, "Not allowed to set value of " +
|
||||
"property '%s' to null for edge '%s'", key, this.id);
|
||||
"property '%s' to null for edge '%s'",
|
||||
key, this.id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.graph;
|
||||
|
|
@ -25,37 +25,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
|
||||
import org.apache.hugegraph.api.filter.DecompressInterceptor.Decompress;
|
||||
import org.apache.hugegraph.api.filter.StatusFilter.Status;
|
||||
import org.apache.hugegraph.backend.id.Id;
|
||||
import org.apache.hugegraph.backend.id.SplicingIdGenerator;
|
||||
import org.apache.hugegraph.backend.query.ConditionQuery;
|
||||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.hugegraph.config.ServerOptions;
|
||||
import org.apache.hugegraph.core.GraphManager;
|
||||
import org.apache.hugegraph.define.UpdateStrategy;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
import org.apache.hugegraph.schema.PropertyKey;
|
||||
import org.apache.hugegraph.schema.VertexLabel;
|
||||
import org.apache.hugegraph.structure.HugeVertex;
|
||||
import org.apache.hugegraph.traversal.optimize.QueryHolder;
|
||||
import org.apache.hugegraph.traversal.optimize.Text;
|
||||
import org.apache.hugegraph.traversal.optimize.TraversalUtil;
|
||||
import org.apache.hugegraph.type.define.IdStrategy;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.JsonUtil;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
|
||||
import org.apache.tinkerpop.gremlin.structure.T;
|
||||
import org.apache.tinkerpop.gremlin.structure.Vertex;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Singleton;
|
||||
|
|
@ -71,6 +40,37 @@ import jakarta.ws.rs.Produces;
|
|||
import jakarta.ws.rs.QueryParam;
|
||||
import jakarta.ws.rs.core.Context;
|
||||
|
||||
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
|
||||
import org.apache.tinkerpop.gremlin.structure.T;
|
||||
import org.apache.tinkerpop.gremlin.structure.Vertex;
|
||||
import org.apache.hugegraph.config.ServerOptions;
|
||||
import org.apache.hugegraph.core.GraphManager;
|
||||
import org.apache.hugegraph.define.UpdateStrategy;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
|
||||
import org.apache.hugegraph.api.filter.DecompressInterceptor.Decompress;
|
||||
import org.apache.hugegraph.api.filter.StatusFilter.Status;
|
||||
import org.apache.hugegraph.backend.id.Id;
|
||||
import org.apache.hugegraph.backend.id.SplicingIdGenerator;
|
||||
import org.apache.hugegraph.backend.query.ConditionQuery;
|
||||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.hugegraph.exception.NotFoundException;
|
||||
import org.apache.hugegraph.schema.PropertyKey;
|
||||
import org.apache.hugegraph.schema.VertexLabel;
|
||||
import org.apache.hugegraph.structure.HugeVertex;
|
||||
import org.apache.hugegraph.traversal.optimize.QueryHolder;
|
||||
import org.apache.hugegraph.traversal.optimize.Text;
|
||||
import org.apache.hugegraph.traversal.optimize.TraversalUtil;
|
||||
import org.apache.hugegraph.type.define.IdStrategy;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.JsonUtil;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@Path("graphs/{graph}/graph/vertices")
|
||||
@Singleton
|
||||
@Tag(name = "VertexAPI")
|
||||
|
|
@ -148,7 +148,7 @@ public class VertexAPI extends BatchAPI {
|
|||
HugeGraph g = graph(manager, graph);
|
||||
Map<Id, JsonVertex> map = new HashMap<>(req.jsonVertices.size());
|
||||
|
||||
return this.commit(config, g, 0, () -> {
|
||||
return this.commit(config, g, map.size(), () -> {
|
||||
/*
|
||||
* 1.Put all newVertices' properties into map (combine first)
|
||||
* - Consider primary-key & user-define ID mode first
|
||||
|
|
@ -156,7 +156,8 @@ public class VertexAPI extends BatchAPI {
|
|||
req.jsonVertices.forEach(newVertex -> {
|
||||
Id newVertexId = getVertexId(g, newVertex);
|
||||
JsonVertex oldVertex = map.get(newVertexId);
|
||||
this.updateExistElement(oldVertex, newVertex, req.updateStrategies);
|
||||
this.updateExistElement(oldVertex, newVertex,
|
||||
req.updateStrategies);
|
||||
map.put(newVertexId, newVertex);
|
||||
});
|
||||
|
||||
|
|
@ -165,7 +166,8 @@ public class VertexAPI extends BatchAPI {
|
|||
Iterator<Vertex> oldVertices = g.vertices(ids);
|
||||
oldVertices.forEachRemaining(oldVertex -> {
|
||||
JsonVertex newVertex = map.get(oldVertex.id());
|
||||
this.updateExistElement(g, oldVertex, newVertex, req.updateStrategies);
|
||||
this.updateExistElement(g, oldVertex, newVertex,
|
||||
req.updateStrategies);
|
||||
});
|
||||
|
||||
// 3.Add finalVertices and return them
|
||||
|
|
@ -175,7 +177,8 @@ public class VertexAPI extends BatchAPI {
|
|||
});
|
||||
|
||||
// If return ids, the ids.size() maybe different with the origins'
|
||||
return manager.serializer(g).writeVertices(vertices.iterator(), false);
|
||||
return manager.serializer(g)
|
||||
.writeVertices(vertices.iterator(), false);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -235,7 +238,8 @@ public class VertexAPI extends BatchAPI {
|
|||
Map<String, Object> props = parseProperties(properties);
|
||||
if (page != null) {
|
||||
E.checkArgument(offset == 0,
|
||||
"Not support querying vertices based on paging and offset together");
|
||||
"Not support querying vertices based on paging " +
|
||||
"and offset together");
|
||||
}
|
||||
|
||||
HugeGraph g = graph(manager, graph);
|
||||
|
|
@ -261,11 +265,13 @@ public class VertexAPI extends BatchAPI {
|
|||
if (page == null) {
|
||||
traversal = traversal.range(offset, offset + limit);
|
||||
} else {
|
||||
traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page).limit(limit);
|
||||
traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page)
|
||||
.limit(limit);
|
||||
}
|
||||
|
||||
try {
|
||||
return manager.serializer(g).writeVertices(traversal, page != null);
|
||||
return manager.serializer(g).writeVertices(traversal,
|
||||
page != null);
|
||||
} finally {
|
||||
if (g.tx().isOpen()) {
|
||||
g.tx().close();
|
||||
|
|
@ -313,10 +319,10 @@ public class VertexAPI extends BatchAPI {
|
|||
g.removeVertex(label, id);
|
||||
} catch (NotFoundException e) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"No such vertex with id: '%s', %s", id, e));
|
||||
"No such vertex with id: '%s', %s", id, e));
|
||||
} catch (NoSuchElementException e) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"No such vertex with id: '%s'", id));
|
||||
"No such vertex with id: '%s'", id));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -334,19 +340,22 @@ public class VertexAPI extends BatchAPI {
|
|||
return uuid ? Text.uuid((String) id) : HugeVertex.getIdValue(id);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"The vertex id must be formatted as Number/String/UUID" +
|
||||
", but got '%s'", idValue));
|
||||
"The vertex id must be formatted as Number/String/UUID" +
|
||||
", but got '%s'", idValue));
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkBatchSize(HugeConfig config, List<JsonVertex> vertices) {
|
||||
private static void checkBatchSize(HugeConfig config,
|
||||
List<JsonVertex> vertices) {
|
||||
int max = config.get(ServerOptions.MAX_VERTICES_PER_BATCH);
|
||||
if (vertices.size() > max) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Too many vertices for one time post, the maximum number is '%s'", max));
|
||||
"Too many vertices for one time post, " +
|
||||
"the maximum number is '%s'", max));
|
||||
}
|
||||
if (vertices.isEmpty()) {
|
||||
throw new IllegalArgumentException("The number of vertices can't be 0");
|
||||
if (vertices.size() == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"The number of vertices can't be 0");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -364,7 +373,8 @@ public class VertexAPI extends BatchAPI {
|
|||
String propertyKey = g.propertyKey(pkId).name();
|
||||
Object propertyValue = vertex.properties.get(propertyKey);
|
||||
E.checkArgument(propertyValue != null,
|
||||
"The value of primary key '%s' can't be null", propertyKey);
|
||||
"The value of primary key '%s' can't be null",
|
||||
propertyKey);
|
||||
pkValues.add(propertyValue);
|
||||
}
|
||||
|
||||
|
|
@ -392,7 +402,8 @@ public class VertexAPI extends BatchAPI {
|
|||
E.checkArgumentNotNull(req, "BatchVertexRequest can't be null");
|
||||
E.checkArgumentNotNull(req.jsonVertices,
|
||||
"Parameter 'vertices' can't be null");
|
||||
E.checkArgument(req.updateStrategies != null && !req.updateStrategies.isEmpty(),
|
||||
E.checkArgument(req.updateStrategies != null &&
|
||||
!req.updateStrategies.isEmpty(),
|
||||
"Parameter 'update_strategies' can't be empty");
|
||||
E.checkArgument(req.createIfNotExist,
|
||||
"Parameter 'create_if_not_exist' " +
|
||||
|
|
@ -417,13 +428,14 @@ public class VertexAPI extends BatchAPI {
|
|||
|
||||
@Override
|
||||
public void checkUpdate() {
|
||||
E.checkArgumentNotNull(this.properties, "The properties of vertex can't be null");
|
||||
E.checkArgumentNotNull(this.properties,
|
||||
"The properties of vertex can't be null");
|
||||
|
||||
for (Map.Entry<String, Object> e : this.properties.entrySet()) {
|
||||
String key = e.getKey();
|
||||
Object value = e.getValue();
|
||||
E.checkArgumentNotNull(value, "Not allowed to set value of " +
|
||||
"property '%s' to null for vertex '%s'",
|
||||
"property '%s' to null for vertex '%s'",
|
||||
key, this.id);
|
||||
}
|
||||
}
|
||||
|
|
@ -450,7 +462,7 @@ public class VertexAPI extends BatchAPI {
|
|||
}
|
||||
if (this.id != null) {
|
||||
newProps[appendIndex++] = T.id;
|
||||
// Note: Here we keep value++ to avoid code trap
|
||||
// Keep value++ to avoid code trap
|
||||
newProps[appendIndex++] = this.id;
|
||||
}
|
||||
return newProps;
|
||||
|
|
@ -1,32 +1,23 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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 org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
|
||||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.hugegraph.metrics.MetricsUtil;
|
||||
import org.apache.hugegraph.util.E;
|
||||
|
||||
import com.codahale.metrics.Histogram;
|
||||
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;
|
||||
import jakarta.ws.rs.POST;
|
||||
|
|
@ -38,6 +29,14 @@ import jakarta.ws.rs.core.MultivaluedMap;
|
|||
import jakarta.ws.rs.core.Response;
|
||||
import jakarta.ws.rs.core.UriInfo;
|
||||
|
||||
import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
|
||||
import org.apache.hugegraph.api.filter.RedirectFilter;
|
||||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.hugegraph.metrics.MetricsUtil;
|
||||
import com.codahale.metrics.Histogram;
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import jakarta.inject.Singleton;
|
||||
|
||||
@Path("gremlin")
|
||||
@Singleton
|
||||
@Tag(name = "GremlinAPI")
|
||||
|
|
@ -53,6 +52,7 @@ 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) {
|
||||
|
|
@ -78,7 +78,6 @@ public class GremlinAPI extends GremlinQueryAPI {
|
|||
@Context UriInfo uriInfo) {
|
||||
String auth = headers.getHeaderString(HttpHeaders.AUTHORIZATION);
|
||||
String query = uriInfo.getRequestUri().getRawQuery();
|
||||
E.checkArgumentNotNull(query, "The request query can't be empty");
|
||||
MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
|
||||
Response response = this.client().doGetRequest(auth, params);
|
||||
GREMLIN_INPUT_HISTOGRAM.update(query.length());
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* 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.List;
|
||||
import java.util.Map;
|
||||
|
||||
import jakarta.ws.rs.client.Entity;
|
||||
import jakarta.ws.rs.client.WebTarget;
|
||||
import jakarta.ws.rs.core.HttpHeaders;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
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;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public Response doGetRequest(String auth,
|
||||
MultivaluedMap<String, String> params) {
|
||||
WebTarget target = this.webTarget;
|
||||
for (Map.Entry<String, List<String>> entry : params.entrySet()) {
|
||||
E.checkArgument(entry.getValue().size() == 1,
|
||||
"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));
|
||||
}
|
||||
return target.request()
|
||||
.header(HttpHeaders.AUTHORIZATION, auth)
|
||||
.accept(MediaType.APPLICATION_JSON)
|
||||
.acceptEncoding(CompressInterceptor.GZIP)
|
||||
.get();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -24,7 +24,6 @@ import org.apache.hugegraph.api.API;
|
|||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.hugegraph.config.ServerOptions;
|
||||
import org.apache.hugegraph.exception.HugeGremlinException;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
|
|
@ -37,7 +36,8 @@ import jakarta.ws.rs.core.Response;
|
|||
public class GremlinQueryAPI extends API {
|
||||
|
||||
private static final Set<String> FORBIDDEN_REQUEST_EXCEPTIONS =
|
||||
ImmutableSet.of("java.lang.SecurityException", "jakarta.ws.rs.ForbiddenException");
|
||||
ImmutableSet.of("java.lang.SecurityException",
|
||||
"jakarta.ws.rs.ForbiddenException");
|
||||
private static final Set<String> BAD_REQUEST_EXCEPTIONS = ImmutableSet.of(
|
||||
"java.lang.IllegalArgumentException",
|
||||
"java.util.concurrent.TimeoutException",
|
||||
|
|
@ -55,7 +55,6 @@ public class GremlinQueryAPI extends API {
|
|||
if (this.client != null) {
|
||||
return this.client;
|
||||
}
|
||||
|
||||
HugeConfig config = this.configProvider.get();
|
||||
String url = config.get(ServerOptions.GREMLIN_SERVER_URL);
|
||||
int timeout = config.get(ServerOptions.GREMLIN_SERVER_TIMEOUT) * 1000;
|
||||
|
|
@ -100,7 +99,6 @@ public class GremlinQueryAPI extends API {
|
|||
if (exClass == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (BAD_REQUEST_EXCEPTIONS.contains(exClass)) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.job;
|
||||
|
|
@ -36,7 +36,6 @@ import org.slf4j.Logger;
|
|||
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;
|
||||
|
|
@ -48,7 +47,6 @@ import jakarta.ws.rs.core.Context;
|
|||
|
||||
@Path("graphs/{graph}/jobs/algorithm")
|
||||
@Singleton
|
||||
@Tag(name = "AlgorithmAPI")
|
||||
public class AlgorithmAPI extends API {
|
||||
|
||||
private static final Logger LOG = Log.logger(RestServer.class);
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.job;
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.job;
|
||||
|
|
@ -190,11 +190,11 @@ public class GremlinAPI extends API {
|
|||
String gremlin = (String) map.get("gremlin");
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> bindings = (Map<String, Object>)
|
||||
map.get("bindings");
|
||||
map.get("bindings");
|
||||
String language = (String) map.get("language");
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> aliases = (Map<String, String>)
|
||||
map.get("aliases");
|
||||
map.get("aliases");
|
||||
|
||||
GremlinRequest request = new GremlinRequest();
|
||||
request.gremlin(gremlin);
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.job;
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.job;
|
||||
|
|
@ -92,7 +92,7 @@ public class TaskAPI extends API {
|
|||
// Set limit to NO_LIMIT to ignore limit when query task by ids
|
||||
limit = NO_LIMIT;
|
||||
List<Id> idList = ids.stream().map(IdGenerator::of)
|
||||
.collect(Collectors.toList());
|
||||
.collect(Collectors.toList());
|
||||
iter = scheduler.tasks(idList);
|
||||
} else {
|
||||
if (status == null) {
|
||||
|
|
@ -136,12 +136,11 @@ public class TaskAPI extends API {
|
|||
@RedirectFilter.RedirectMasterRole
|
||||
public void delete(@Context GraphManager manager,
|
||||
@PathParam("graph") String graph,
|
||||
@PathParam("id") long id,
|
||||
@DefaultValue("false") @QueryParam("force") boolean force) {
|
||||
@PathParam("id") long id) {
|
||||
LOG.debug("Graph [{}] delete task: {}", graph, id);
|
||||
|
||||
TaskScheduler scheduler = graph(manager, graph).taskScheduler();
|
||||
HugeTask<?> task = scheduler.delete(IdGenerator.of(id), force);
|
||||
HugeTask<?> task = scheduler.delete(IdGenerator.of(id));
|
||||
E.checkArgument(task != null, "There is no task with id '%s'", id);
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +158,7 @@ public class TaskAPI extends API {
|
|||
|
||||
if (!ACTION_CANCEL.equals(action)) {
|
||||
throw new NotSupportedException(String.format(
|
||||
"Not support action '%s'", action));
|
||||
"Not support action '%s'", action));
|
||||
}
|
||||
|
||||
TaskScheduler scheduler = graph(manager, graph).taskScheduler();
|
||||
|
|
@ -173,8 +172,8 @@ public class TaskAPI extends API {
|
|||
|
||||
assert task.completed() || task.cancelling();
|
||||
throw new BadRequestException(String.format(
|
||||
"Can't cancel task '%s' which is completed or cancelling",
|
||||
id));
|
||||
"Can't cancel task '%s' which is completed or cancelling",
|
||||
id));
|
||||
}
|
||||
|
||||
private static TaskStatus parseStatus(String status) {
|
||||
|
|
@ -182,8 +181,8 @@ public class TaskAPI extends API {
|
|||
return TaskStatus.valueOf(status.toUpperCase());
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Status value must be in %s, but got '%s'",
|
||||
Arrays.asList(TaskStatus.values()), status));
|
||||
"Status value must be in %s, but got '%s'",
|
||||
Arrays.asList(TaskStatus.values()), status));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -70,7 +70,6 @@ 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;
|
||||
|
|
@ -104,7 +103,6 @@ public class MetricsAPI extends API {
|
|||
@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());
|
||||
}
|
||||
|
|
@ -114,7 +112,6 @@ public class MetricsAPI extends API {
|
|||
@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<String, Map<String, Object>> results = InsertionOrderUtil.newMap();
|
||||
for (String graph : manager.graphs()) {
|
||||
|
|
@ -137,7 +134,6 @@ public class MetricsAPI extends API {
|
|||
@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());
|
||||
|
|
@ -148,7 +144,6 @@ public class MetricsAPI extends API {
|
|||
@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());
|
||||
|
|
@ -159,7 +154,6 @@ public class MetricsAPI extends API {
|
|||
@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());
|
||||
|
|
@ -170,7 +164,6 @@ public class MetricsAPI extends API {
|
|||
@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());
|
||||
|
|
@ -181,7 +174,6 @@ public class MetricsAPI extends API {
|
|||
@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());
|
||||
|
|
@ -191,7 +183,6 @@ public class MetricsAPI extends API {
|
|||
@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)) {
|
||||
|
|
@ -206,7 +197,6 @@ public class MetricsAPI extends API {
|
|||
@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<String, Map<String, Object>> metricMap = statistics();
|
||||
|
||||
|
|
@ -362,6 +352,7 @@ public class MetricsAPI extends API {
|
|||
Counter successCounter = reporter.counters().get(
|
||||
joinWithSlash(metricsName, METRICS_PATH_SUCCESS_COUNTER));
|
||||
|
||||
|
||||
Histogram histogram = entry.getValue();
|
||||
Map<String, Object> entryMetricsMap = new HashMap<>();
|
||||
entryMetricsMap.put(MetricsKeys.MAX_RESPONSE_TIME.name(),
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -22,23 +22,6 @@ import java.util.HashSet;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.auth.HugeAuthenticator.RequiredPerm;
|
||||
import org.apache.hugegraph.auth.HugePermission;
|
||||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.hugegraph.core.GraphManager;
|
||||
import org.apache.hugegraph.type.define.GraphMode;
|
||||
import org.apache.hugegraph.type.define.GraphReadMode;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.JsonUtil;
|
||||
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.tags.Tag;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Singleton;
|
||||
|
|
@ -47,8 +30,8 @@ import jakarta.ws.rs.DELETE;
|
|||
import jakarta.ws.rs.ForbiddenException;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.NotSupportedException;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.PUT;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.Produces;
|
||||
|
|
@ -56,6 +39,23 @@ import jakarta.ws.rs.QueryParam;
|
|||
import jakarta.ws.rs.core.Context;
|
||||
import jakarta.ws.rs.core.SecurityContext;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.hugegraph.core.GraphManager;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.auth.HugeAuthenticator.RequiredPerm;
|
||||
import org.apache.hugegraph.auth.HugePermission;
|
||||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.hugegraph.type.define.GraphMode;
|
||||
import org.apache.hugegraph.type.define.GraphReadMode;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.JsonUtil;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
@Path("graphs")
|
||||
@Singleton
|
||||
@Tag(name = "GraphsAPI")
|
||||
|
|
@ -154,7 +154,7 @@ public class GraphsAPI extends API {
|
|||
File file = config.file();
|
||||
if (file == null) {
|
||||
throw new NotSupportedException("Can't access the api in " +
|
||||
"a node which started with non local file config.");
|
||||
"a node which started with non local file config.");
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
|
@ -255,9 +255,9 @@ public class GraphsAPI extends API {
|
|||
@Produces(APPLICATION_JSON_WITH_CHARSET)
|
||||
@RolesAllowed("admin")
|
||||
public Map<String, GraphReadMode> graphReadMode(
|
||||
@Context GraphManager manager,
|
||||
@PathParam("name") String name,
|
||||
GraphReadMode readMode) {
|
||||
@Context GraphManager manager,
|
||||
@PathParam("name") String name,
|
||||
GraphReadMode readMode) {
|
||||
LOG.debug("Set graph-read-mode to: '{}' of graph '{}'",
|
||||
readMode, name);
|
||||
|
||||
|
|
@ -275,8 +275,8 @@ public class GraphsAPI extends API {
|
|||
@Produces(APPLICATION_JSON_WITH_CHARSET)
|
||||
@RolesAllowed({"admin", "$owner=$name"})
|
||||
public Map<String, GraphReadMode> graphReadMode(
|
||||
@Context GraphManager manager,
|
||||
@PathParam("name") String name) {
|
||||
@Context GraphManager manager,
|
||||
@PathParam("name") String name) {
|
||||
LOG.debug("Get graph-read-mode of graph '{}'", name);
|
||||
|
||||
HugeGraph g = graph(manager, name);
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -24,21 +24,6 @@ import java.util.Set;
|
|||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.hugegraph.config.HugeConfig;
|
||||
import org.apache.hugegraph.config.ServerOptions;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.InsertionOrderUtil;
|
||||
import org.apache.hugegraph.util.JsonUtil;
|
||||
import org.apache.hugegraph.version.CoreVersion;
|
||||
import org.apache.tinkerpop.shaded.jackson.annotation.JsonProperty;
|
||||
import org.glassfish.jersey.model.Parameter.Source;
|
||||
import org.glassfish.jersey.server.model.Parameter;
|
||||
import org.glassfish.jersey.server.model.Resource;
|
||||
import org.glassfish.jersey.server.model.ResourceMethod;
|
||||
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.inject.Singleton;
|
||||
import jakarta.ws.rs.GET;
|
||||
|
|
@ -48,6 +33,20 @@ import jakarta.ws.rs.core.Application;
|
|||
import jakarta.ws.rs.core.Context;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.tinkerpop.shaded.jackson.annotation.JsonProperty;
|
||||
import org.glassfish.jersey.model.Parameter.Source;
|
||||
import org.glassfish.jersey.server.model.Parameter;
|
||||
import org.glassfish.jersey.server.model.Resource;
|
||||
import org.glassfish.jersey.server.model.ResourceMethod;
|
||||
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.InsertionOrderUtil;
|
||||
import org.apache.hugegraph.util.JsonUtil;
|
||||
import org.apache.hugegraph.version.CoreVersion;
|
||||
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
|
||||
@Path("/")
|
||||
@Singleton
|
||||
@Tag(name = "ProfileAPI")
|
||||
|
|
@ -56,7 +55,6 @@ public class ProfileAPI {
|
|||
private static final String SERVICE = "hugegraph";
|
||||
private static final String DOC = "https://hugegraph.apache.org/docs/";
|
||||
private static final String API_DOC = DOC + "clients/";
|
||||
private static final String SWAGGER_UI = "/swagger-ui/index.html";
|
||||
|
||||
private static String SERVER_PROFILES = null;
|
||||
private static String API_PROFILES = null;
|
||||
|
|
@ -64,7 +62,7 @@ public class ProfileAPI {
|
|||
@GET
|
||||
@Timed
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getProfile(@Context HugeConfig conf, @Context Application application) {
|
||||
public String getProfile(@Context Application application) {
|
||||
// May init multi times by multi threads, but no effect on the results
|
||||
if (SERVER_PROFILES != null) {
|
||||
return SERVER_PROFILES;
|
||||
|
|
@ -75,7 +73,6 @@ public class ProfileAPI {
|
|||
profiles.put("version", CoreVersion.VERSION.toString());
|
||||
profiles.put("doc", DOC);
|
||||
profiles.put("api_doc", API_DOC);
|
||||
profiles.put("swagger_ui", conf.get(ServerOptions.REST_SERVER_URL) + SWAGGER_UI);
|
||||
Set<String> apis = new TreeSet<>();
|
||||
for (Class<?> clazz : application.getClasses()) {
|
||||
if (!isAnnotatedPathClass(clazz)) {
|
||||
|
|
@ -153,8 +150,8 @@ public class ProfileAPI {
|
|||
categories = this.apis.computeIfAbsent(category.dir,
|
||||
k -> new TreeMap<>());
|
||||
List<APIProfile> profiles = categories.computeIfAbsent(
|
||||
category.category,
|
||||
k -> new ArrayList<>());
|
||||
category.category,
|
||||
k -> new ArrayList<>());
|
||||
profiles.add(profile);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +1,24 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.Map;
|
||||
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.version.ApiVersion;
|
||||
import org.apache.hugegraph.version.CoreVersion;
|
||||
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import jakarta.inject.Singleton;
|
||||
|
|
@ -33,6 +26,12 @@ import jakarta.ws.rs.GET;
|
|||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.version.ApiVersion;
|
||||
import org.apache.hugegraph.version.CoreVersion;
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
@Path("versions")
|
||||
@Singleton
|
||||
@Tag(name = "VersionAPI")
|
||||
|
|
@ -44,9 +43,9 @@ public class VersionAPI extends API {
|
|||
@PermitAll
|
||||
public Object list() {
|
||||
Map<String, String> versions = ImmutableMap.of("version", "v1",
|
||||
"core", CoreVersion.VERSION.toString(),
|
||||
"gremlin", CoreVersion.GREMLIN_VERSION,
|
||||
"api", ApiVersion.VERSION.toString());
|
||||
"core", CoreVersion.VERSION.toString(),
|
||||
"gremlin", CoreVersion.GREMLIN_VERSION,
|
||||
"api", ApiVersion.VERSION.toString());
|
||||
return ImmutableMap.of("versions", versions);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -37,8 +37,6 @@ 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;
|
||||
|
|
@ -52,7 +50,6 @@ 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);
|
||||
|
|
@ -61,7 +58,6 @@ public class WhiteIpListAPI extends API {
|
|||
@Timed
|
||||
@Produces(APPLICATION_JSON_WITH_CHARSET)
|
||||
@RolesAllowed("admin")
|
||||
@Operation(summary = "list white ips")
|
||||
public Map<String, Object> list(@Context GraphManager manager) {
|
||||
LOG.debug("List white ips");
|
||||
AuthManager authManager = manager.authManager();
|
||||
|
|
@ -75,9 +71,7 @@ public class WhiteIpListAPI extends API {
|
|||
@Consumes(APPLICATION_JSON)
|
||||
@Produces(APPLICATION_JSON_WITH_CHARSET)
|
||||
@RolesAllowed("admin")
|
||||
@Operation(summary = "update white ip list")
|
||||
public Map<String, Object> updateWhiteIPs(@Context GraphManager manager,
|
||||
Map<String, Object> actionMap) {
|
||||
public Map<String, Object> updateWhiteIPs(@Context GraphManager manager, Map<String, Object> actionMap) {
|
||||
E.checkArgument(actionMap != null,
|
||||
"Missing argument: actionMap");
|
||||
Set<String> whiteIpList = manager.authManager().listWhiteIPs();
|
||||
|
|
@ -137,9 +131,7 @@ public class WhiteIpListAPI extends API {
|
|||
@Timed
|
||||
@Produces(APPLICATION_JSON_WITH_CHARSET)
|
||||
@RolesAllowed("admin")
|
||||
@Operation(summary = "enable/disable the white ip list")
|
||||
public Map<String, Object> updateStatus(@Context GraphManager manager,
|
||||
@QueryParam("status") String status) {
|
||||
public Map<String, Object> updateStatus(@Context GraphManager manager, @QueryParam("status") String status) {
|
||||
LOG.debug("Enable or disable white ip list");
|
||||
E.checkArgument("true".equals(status) ||
|
||||
"false".equals(status),
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.raft;
|
||||
|
|
@ -21,25 +21,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.hugegraph.HugeException;
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.api.filter.RedirectFilter;
|
||||
import org.apache.hugegraph.api.filter.StatusFilter.Status;
|
||||
import org.apache.hugegraph.backend.id.Id;
|
||||
import org.apache.hugegraph.backend.store.raft.RaftAddPeerJob;
|
||||
import org.apache.hugegraph.backend.store.raft.RaftGroupManager;
|
||||
import org.apache.hugegraph.backend.store.raft.RaftRemovePeerJob;
|
||||
import org.apache.hugegraph.core.GraphManager;
|
||||
import org.apache.hugegraph.job.JobBuilder;
|
||||
import org.apache.hugegraph.util.DateUtil;
|
||||
import org.apache.hugegraph.util.JsonUtil;
|
||||
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.tags.Tag;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Singleton;
|
||||
|
|
@ -53,6 +34,25 @@ import jakarta.ws.rs.Produces;
|
|||
import jakarta.ws.rs.QueryParam;
|
||||
import jakarta.ws.rs.core.Context;
|
||||
|
||||
import org.apache.hugegraph.api.filter.RedirectFilter;
|
||||
import org.apache.hugegraph.core.GraphManager;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import org.apache.hugegraph.HugeException;
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.api.filter.StatusFilter.Status;
|
||||
import org.apache.hugegraph.backend.id.Id;
|
||||
import org.apache.hugegraph.backend.store.raft.RaftAddPeerJob;
|
||||
import org.apache.hugegraph.backend.store.raft.RaftGroupManager;
|
||||
import org.apache.hugegraph.backend.store.raft.RaftRemovePeerJob;
|
||||
import org.apache.hugegraph.job.JobBuilder;
|
||||
import org.apache.hugegraph.util.DateUtil;
|
||||
import org.apache.hugegraph.util.JsonUtil;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
@Path("graphs/{graph}/raft")
|
||||
@Singleton
|
||||
@Tag(name = "RaftAPI")
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.schema;
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.schema;
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.schema;
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.schema;
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.schema;
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -20,6 +20,16 @@ package org.apache.hugegraph.api.traversers;
|
|||
import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_ELEMENTS_LIMIT;
|
||||
import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
|
||||
|
||||
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;
|
||||
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.api.graph.EdgeAPI;
|
||||
|
|
@ -30,20 +40,9 @@ import org.apache.hugegraph.traversal.algorithm.PredictionTraverser;
|
|||
import org.apache.hugegraph.type.define.Directions;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.JsonUtil;
|
||||
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* AdamicAdar is one of the prediction algorithms in graph, you can get more
|
||||
* info and definition in:
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -25,23 +25,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
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.CountTraverser;
|
||||
import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep;
|
||||
import org.apache.hugegraph.type.define.Directions;
|
||||
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.JsonAlias;
|
||||
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.POST;
|
||||
|
|
@ -50,6 +33,23 @@ import jakarta.ws.rs.PathParam;
|
|||
import jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.core.Context;
|
||||
|
||||
import org.apache.hugegraph.core.GraphManager;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import org.apache.hugegraph.HugeGraph;
|
||||
import org.apache.hugegraph.api.API;
|
||||
import org.apache.hugegraph.backend.id.Id;
|
||||
import org.apache.hugegraph.structure.HugeVertex;
|
||||
import org.apache.hugegraph.traversal.algorithm.CountTraverser;
|
||||
import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep;
|
||||
import org.apache.hugegraph.type.define.Directions;
|
||||
import org.apache.hugegraph.util.E;
|
||||
import org.apache.hugegraph.util.Log;
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
@Path("graphs/{graph}/traversers/count")
|
||||
@Singleton
|
||||
@Tag(name = "CountAPI")
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
@ -114,6 +114,7 @@ public class CustomizedCrosspointsAPI extends API {
|
|||
measure.addIterCount(traverser.vertexIterCounter.get(),
|
||||
traverser.edgeIterCounter.get());
|
||||
|
||||
|
||||
Iterator<?> iterVertex;
|
||||
Set<Id> vertexIds = new HashSet<>();
|
||||
if (request.withPath) {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue