Compare commits

...

588 Commits

Author SHA1 Message Date
Aph-CUG 0b794c9ab9 增加一个link_buf类,以及log写入机制 2024-08-27 09:20:02 +08:00
V_Galaxy 7be8e6b1dd
feat(common): add a tool method encode (common #146, #2647)
Co-authored-by: John <thespica@qq.com>
2024-08-24 16:07:26 +08:00
V_Galaxy 0b24aca3cd
chore(store): translate CJK comments to English for store-dist, store-grpc, store-node, store-rocksdb, store-test (#2645)
Co-authored-by: Peng Junzhi <78788603+Pengzna@users.noreply.github.com>
2024-08-23 14:35:16 +08:00
imbajin f88fad4711
Merge pull request #2646 from apache/fixup-commons
chore(ci): disable merge button & rename ci job name
2024-08-23 11:00:23 +08:00
VGalaxies a767d73182 setup 2024-08-22 20:09:42 +08:00
imbajin 0a0f2c3bfa
Merge pull request #2628 from apache/intro-commons-v2
**TODO:**
After this PR merged, change the README in commons & pin a [issue](https://github.com/hugegraph/hugegraph-hubble/issues/371) to notify all users/devs to know the context (also update the repo description...)

Finally, we may need start a discussion for marking commons repo in achieved status
2024-08-22 19:07:20 +08:00
V_Galaxy 7dc6a86a7d
chore(dist): intro additional Dockerfile to build the server image & skip init-hstore backend (#2642) 2024-08-22 14:04:06 +08:00
VGalaxies b087f085c1 chore(commons): basic adapt for commons migration 2024-08-21 16:09:00 +08:00
YangJiaqi 58f58ee094
fix(hstore): enable JRaft MaxBodySize config (#2633)
* enable JRaft MaxBodySize config
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.apache.hugegraph.store.node.AppConfig$Raft': Unsatisfied dependency expressed through field 'maxBodySize'; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "512*1024"

---------

Co-authored-by: V_Galaxy <vgalaxies@apache.org>
2024-08-18 14:47:11 +08:00
YangJiaqi ba5b89e374
fix(hstore): print time for hstore gc log #2636 2024-08-17 11:39:30 +08:00
V_Galaxy 1c577de9ba
chore(api): support ignore graphspaces segment in url (#2612)
For forwards compatibility with the "graphspace" mode

---------

Co-authored-by: imbajin <jin@apache.org>
2024-08-13 20:56:53 +08:00
V_Galaxy 4f0e4442ab
fix: correct server docker copy source path (#2637) 2024-08-13 20:53:20 +08:00
YangJiaqi a038d2341c
fix(hstore): JRaft maxEntriesSize configuration parameters do not take effect (#2630)
Co-authored-by: imbajin <jin@apache.org>
2024-08-11 13:04:34 +08:00
V_Galaxy df921e915d
refact(server): enlarge bytes write limit & remove param `big` when encode/decode string id length (#2622)
As title, change limit:
- vid max to 16KB
- eid max to 64kb (128k as backup)
- property max to 10MB (keep consistent)

fix #1593 #2291

---------

Co-authored-by: imbajin <jin@apache.org>
2024-08-10 17:02:30 +08:00
V_Galaxy 7df736a77c
chore(hstore): translate CJK comments to English (#2616)
* trans server-core
2024-08-10 15:31:25 +08:00
V_Galaxy c231a6fddb
chore(store): translate CJK comments to English for store-cli, store-client, store-common, store-core (#2623)
* fixup Chinese punctuation
2024-08-10 12:47:09 +08:00
V_Galaxy 2e27c583b4
chore(pd): translate CJK punctuations to English (#2625) 2024-08-10 12:16:51 +08:00
VGalaxies 459d4413b4 Merge remote-tracking branch 'commons/migrate-commons' into intro-commons-v2 2024-08-10 12:14:58 +08:00
V_Galaxy dc3070f45b
chore(dist): tar source and binary package for hugegraph with pd-store (#2594)
tar source and binary package for hugegraph with pd-store
2024-08-06 21:21:14 +08:00
VGalaxies 162a104ebd git mv to hugegraph-commons 2024-08-03 20:34:23 +08:00
YangJiaqi 91f5b33bac
fix(hstore): JRaft Timer Metrics BUG (#2602) 2024-08-02 23:47:56 +08:00
John 53f0e18216
doc(server): enhance rest-server.properties comment (#2610)
---------

Co-authored-by: imbajin <jin@apache.org>
2024-08-02 19:14:25 +08:00
haohao0103 3427f42b81
refact(pd): remove redundant property in LogMeta & PartitionMeta (#2598)
Co-authored-by: V_Galaxy <vgalaxies@apache.org>
2024-08-02 18:37:06 +08:00
haohao0103 24ebe9da26
fix(pd/store): log files do not scroll with the process (#2589)
close #2581 GRPC Java defaults to using java. til.rogging (JUL) as its logging framework,

---------

Co-authored-by: VGalaxies <vgalaxies@apache.org>
2024-08-02 17:58:12 +08:00
imbajin 7b9fd21d2a
chore: enable up-to-date for UI(CI) (#2609) 2024-08-02 11:21:54 +08:00
V_Galaxy d36e05ece8
chore: temporarily ignore failure core tests for hstore & simplify ci name (#2599)
* ignore tests for hstore rename ci
2024-07-31 16:40:53 +08:00
haohao0103 9baef8b255
fix(commons):fixed memory leaks occur in HugeGraph Server during data writing (#144)
* #2578
fixed memory leaks occur in HugeGraph Server during data writing
2024-07-30 17:46:59 +08:00
haohao0103 86e1003c16
fix(pd): partition IDs always empty in Shards List (#2596) 2024-07-22 15:15:00 +08:00
Peng Junzhi edb59ebaeb
feat(store): integrate rest of store-test submodule (#2563)
Co-authored-by: imbajin <jin@apache.org>
2024-07-20 18:10:38 +08:00
V_Galaxy 73a4c9d028
chore: intro `editorconfig-maven-plugin` for verifying code style defined in `.editorconfig` (#2591)
* exclude .flattened-pom.xml
2024-07-17 16:03:27 +08:00
V_Galaxy d6bc24e0f2
fix(dist): update build artifact path for docker deployment (#2590)
* fix path
2024-07-16 20:25:02 +08:00
haohao0103 5dfcc3f694
feat: support disable RocksDB auto-compaction by configuration (#2586) 2024-07-16 16:40:44 +08:00
haohao0103 899dc8e0f0
doc(pd): add `initial-store-count` comments in `application.yml` (#2587)
PD cluster will assess the overall health of the cluster. If the number of store nodes is less than the initial-store-count, the cluster will be unavailable
2024-07-16 16:33:58 +08:00
haohao0103 85e096698a
refact: enhance cache invalidation of the partition -> leader shard in ClientCache (#2588) 2024-07-15 23:07:30 +08:00
V_Galaxy bd83741f24
chore: minor improve for pom properties (#2574) 2024-07-15 14:59:10 +08:00
V_Galaxy 882f3b7d65
feat(dist): support docker deployment for PD and Store (#2573)
Co-authored-by: imbajin <jin@apache.org>
2024-07-15 11:12:25 +08:00
HaoJin Yang 03b40a5244
fix(server): random generate default value (#2568)
Co-authored-by: imbajin <jin@apache.org>
2024-07-14 17:05:35 +08:00
V_Galaxy cedc000215
chore: upgrade revision to 1.5.0 (#2585)
* set revision to 1.5.0
2024-07-13 17:00:43 +08:00
V_Galaxy 9f89afc39a
feat(server): support new backend Hstore (#2560)
subtask of #2483
2024-07-10 16:35:44 +08:00
Frosky Lrupotkin 37e71c4858
chore: migrate the `hg-style.xml` to `.editorconfig` (#2561) 2024-06-28 22:34:07 +08:00
Peng Junzhi e82a91ca1a
feat(store): integrate store-dist and store-cli submodule (#2562)
* refact: prepare for integrating rest of store module

* feat(store): integrate store-dist and store-cli submodule

* fix(store): support and fix for store-dist and store-cli submodule

* fix(store): update deps

* fix(store): update deps

* reformat hg-store-cli

---------

Co-authored-by: VGalaxies <vgalaxies@apache.org>
2024-06-25 00:07:02 +08:00
V_Galaxy 1e9752109e
chore: intro `install-dist` module in root (#2552)
* init dist in root

* adapt path & regenerate deps

* add comment

* add comment

* fix pd dir

* fix server dir

* improve hugegraph-pd/.gitignore

* improve

* rename dist -> install-dist

* fix path

* regenerate known dependencies
2024-06-13 17:06:37 +08:00
V_Galaxy 506850caea
chore: reset license header for file declared in LICENSE (#2550) 2024-06-11 10:08:23 +08:00
sheli00 1a8959575c
feat(store): integrate `store-node` submodule (#2537) 2024-06-11 00:19:07 +08:00
Peng Junzhi ac93deebc6
feat(store): integrate `store-core` submodule (#2548)
* feat(store): integrate store-core submodule
2024-06-07 17:25:42 +08:00
Zee Huang 93c2e08780
Update 'How to Contribute' link and remove duplicate 'Guidelines' link in README (#143)
* Update 'How to Contribute' link and remove duplicate 'Guidelines' link in README

This PR makes the following changes to the README file to streamline the contribution guidelines and avoid redundancy:

- Updated the 'How to Contribute' link to ensure it directs contributors to the correct resource.
- Removed the 'Guidelines' link as it duplicated the information provided in 'How to Contribute'.

* Update contribution link from markdown to website

- Changed the contribution guide link in the README.md from the markdown file to the corresponding section on the official website.
- This change ensures that the link remains stable and is not impacted by the frequent changes to Markdown files.
2024-05-28 15:22:43 +08:00
V_Galaxy b056c5facd
chore(pd): translate CJK comments to English (#2536) 2024-05-13 16:16:02 +08:00
V_Galaxy c1e8ea5aba
feat(server): integrate `server-hstore` into hugegraph (#2534)
subtask of #2265

When introducing hstore, server-core needs corresponding modifications. Except for BytesBuffer.java in hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/, other files should be consistent with the pd-store branch.

---------

Co-authored-by: imbajin <jin@apache.org>
2024-05-06 20:09:12 +08:00
V_Galaxy 253b8d38b8
feat(pd): integrate `pd-dist` into hugegraph & add core tests, client tests, and REST tests for PD (#2532)
subtask of #2265

---------

Co-authored-by: imbajin <jin@apache.org>
2024-05-06 20:08:48 +08:00
V_Galaxy 2b3bc4f28b
feat(pd): integrate `pd-service` into hugegraph (#2528)
subtask of #2265

For detailed module analysis documentation, please refer to fs doc/link/wiki

TODO: Update the getPomVersion implement in the common-module

---------

Co-authored-by: imbajin <jin@apache.org>
2024-04-22 14:53:45 +08:00
V_Galaxy 43cae1d2e3
feat(pd): integrate `pd-core` into hugegraph (#2478)
The corresponding tests will be merged after pd-service

subtask of https://github.com/apache/incubator-hugegraph/issues/2265

---

During the code review, I found the following issues:

1. Similar functionality appears multiple times, such as stub connection-related code, with redundancy between `PDClient.StubProxy` and `AbstractClientStubProxy`.
2. Package partitioning:
    1. `PDPulse`, `PDPulseImpl` should in `pulse`
    2. `PDWatch`, `PDWatchImpl` should in `watch`
3. Unused code, see below

---------

Co-authored-by: imbajin <jin@apache.org>
2024-04-19 23:27:46 +08:00
Peng Junzhi b4bc1f066a
feat(store): integrate `store-rocksdb` submodule (#2513)
TODO: delete "hugegraph-store/hg-store-rocksdb/src/main/java/place-holder.txt" later

---------

Co-authored-by: imbajin <jin@apache.org>
2024-04-19 11:11:44 +08:00
Hongjun Li 7d335b2c72
chore: config *.md max length (#2525) 2024-04-16 21:15:39 +08:00
Emmanuel Ferdman 543bbfeb74
fix: update resource references (#2522) 2024-04-16 15:10:49 +08:00
Liu Xiao 906112c080
chore: make IDEA support IssueNavigationLink and add icon (#2521) 2024-04-15 15:31:12 +08:00
V_Galaxy 6be756919b
fix(server): avoid overriding backend config in gremlin example script (#2519) 2024-04-14 23:57:07 +08:00
V_Galaxy 3783247c74
fix(server): switch rocksdb backend to memory when executing gremlin example (#2518) 2024-04-12 16:32:08 +08:00
imbajin 1228dec04d fix: maven rat plugin exist partial failure
fix: maven rat plugin exist partial failure
2024-04-05 23:53:09 +08:00
Peng Junzhi d0a3ccc045 feat(store): integrate `store-test` submodule 2024-04-05 23:53:09 +08:00
Peng Junzhi 6c72ca5f63 feat(store): integrate `store-client` submodule 2024-04-05 23:53:09 +08:00
Peng Junzhi f0d9d12ca7 feat(store): integrate `store-grpc` submodule 2024-04-05 23:53:09 +08:00
Peng Junzhi e605f732e2 feat(store): integrate `store-common` submodule 2024-04-05 23:53:09 +08:00
Peng Junzhi 52f3d64b6a refact: prepare for integrating store modules 2024-04-05 23:53:09 +08:00
VGalaxies 3a1618faa2 feat(pd): integrate `pd-client` submodule 2024-04-04 17:37:15 +08:00
VGalaxies bd1d9db77b feat(pd): integrate `pd-test` submodule
prepare tests for `pd-common`
2024-04-04 17:37:15 +08:00
VGalaxies b5d9dd2f02 feat(pd): integrate `pd-common` submodule 2024-04-04 17:37:15 +08:00
VGalaxies a560a6efee feat(pd): integrate `pd-grpc` submodule 2024-04-04 17:37:15 +08:00
VGalaxies 37e4405c04 refact: prepare for integrating pd modules
1. prepare pom and CI for pd-client, pd-common, pd-grpc and pd-test
2. drop support for java8
2024-04-04 17:37:15 +08:00
Peng Junzhi 483bca52ef
chore: remove required ci with java8 (#2503) 2024-04-03 23:17:30 +08:00
Simon Cheung 27cf52b007
chore: add swagger-ui LICENSE relative files (#2495)
* Create LICENSE-swagger-ui.txt
* Update NOTICE
2024-03-30 14:17:17 +08:00
imbajin 6a4041e21c chore: upgrade to 1.3.0 (last major version support Java8)
fix
2024-03-22 10:51:57 +08:00
imbajin 713d88d1fd refact: enhance auth logic
fix
2024-03-22 10:51:57 +08:00
imbajin ef8f6128a3 fix: multi graph error in rocksdb with same path/fd 2024-03-22 10:51:57 +08:00
SunnyBoy-WYH 277f76ef03
chore(server): clear context after req done (#2470)
Co-authored-by: vaughn.zhang <vaughn.zhang@zoom.us>
Co-authored-by: imbajin <jin@apache.org>
2024-03-19 17:43:33 +08:00
Bond 7b33574fd0
feat: added the OpenTelemetry trace support (#2477)
TODO: we need enhance our shell experience
---------

Co-authored-by: imbajin <jin@apache.org>
Co-authored-by: VGalaxies <vgalaxies@apache.org>
2024-03-15 17:30:16 +08:00
imbajin c883f56a4e
chore: disable clean flatten for deploy (#141) 2024-03-13 20:27:00 +08:00
小宇 0cfd8daed3
feat: support user defined RestClientConfig/HTTPClient params (#140)
- add builderCallback param for client to add custom config
- add params connectTimeout and readTimeout to instead the param time
- update version to 1.3.0

---------

Co-authored-by: imbajin <jin@apache.org>
2024-03-13 20:13:01 +08:00
vaughn c09982b0df
fix(auth): enhance the URL check (#2422)
Co-authored-by: imbajin <jin@apache.org>
2024-03-09 21:04:30 +08:00
V_Galaxy eb6570c992
fix(server): 'serverStarted' error when execute gremlin example (#2473) 2024-03-05 15:21:42 +08:00
SunnyBoy-WYH 6861ed5e94
fix(server): fix the bug which promtheus cant collect hg metric (#2462) 2024-03-03 13:05:10 +08:00
SunnyBoy-WYH 3f127f01f1
fix(server): add tip for gremlin api NPE with empty query (#2467)
fix #2426
2024-03-02 01:23:01 +08:00
Hongjun Li 2e3adcde02
chore: Add a newline formatting configuration and a comment for warning (#2464)
- Add a newline formatting configuration
- Add a comment for the IDEA unsupported warning about `continuation_indent_size`
2024-02-29 20:35:52 +08:00
Hongjun Li 47a68f098a
chore: refine the hg-style.xml specification (#2457)
- Change the maximum wrap text length for XML to 120 (via `hg-style.xml`)
- Add a blank line between method definitions, inner class definitions, and static code blocks (via `hg-style.xml`)
- Add `<p>` tags to Javadoc blank lines (via `hg-style.xml`)
- `.xml` file leaves a blank line at the end (via `.editorconfig`)
- Class declaration requires a blank line before and after each line (via `hg-style.xml`)
- Javadoc line comment not in line (via `hg-style.xml`)
- `.properties` file leaves empty lines (via `hg-style.xml`)
- `.yaml` file braces `{}`, brackets `[]` remove spaces (via `hg-style.xml`)
2024-02-27 12:53:29 +08:00
Z-HUANT d0f63c8ac3
feat(api): optimize adjacent-edges query (#2408)
Relevant issue: #2255

Gremlin Query: For adjacency edge queries, if a vertex does not belong to the adjacent vertices of this edge, filter out that vertex.

---------

Co-authored-by: imbajin <jin@apache.org>
2024-02-26 12:29:13 +08:00
M dfee5bf6aa
fix(server): remove extra blank lines (#2459)
* remove extra blank lines in api

* remove extra blank lines in core

* remove extra blank lines in scylladb
2024-02-25 11:45:00 +08:00
Jermy Li eef3b355f6
chore: unify to call SchemaLabel.getLabelId() (#2458)
Change-Id: I31bcc0d1ee99f3c443f8f4f0d458e06ca89977ef
2024-02-24 22:45:23 +08:00
V_Galaxy bc421bb197
chore: improve license header checker confs and pre-check header when validating (#2445)
* improve license header checker confs

* typo

* verify -> validate

* update rat exclude files

* empty commit

* update rat exclude files

* update rat exclude files
2024-02-23 16:42:01 +08:00
V_Galaxy f6da2ee6cb
fix: protobuf file header (#2448) 2024-02-23 16:39:30 +08:00
M e79f1a5e73
fix(server): clean up the code (#2456)
- replace `size() == 0` with `isEmpty()`
- remove unnecessary unboxing
- remove unnecessary boxing
- replace for loop with enhanced for loop
- replace lambda with method reference
2024-02-22 17:26:15 +08:00
M 5cb9aad6ee
fix: format and clean code in modules (#2439)
Format & clean code in submodels:

1. API
2. Scylladb
3. Postgresql
4. Rocksdb
5. Palo
6. Mysql
7. Hbase
8. Cassandra
9. Test

---------

Co-authored-by: imbajin <jin@apache.org>
2024-02-20 17:22:54 +08:00
M 0b70e897f0
fix: format and clean code in core module (#2440) 2024-02-20 17:22:28 +08:00
M 0ee9a9b788
fix: format and clean code in dist and example modules (#2441) 2024-02-20 17:22:07 +08:00
M 75867796b7
fix(server): unify the license headers (#2438)
subtask of #2435

---------

Co-authored-by: imbajin <jin@apache.org>
Co-authored-by: VGalaxies <vgalaxies@apache.org>
2024-02-07 12:53:57 +08:00
Peng Junzhi 3f7dc2a8b2
fix(server): make CacheManager constructor private to satisfy the singleton pattern (#2432) 2024-02-01 23:58:44 +08:00
SunnyBoy-WYH 1d4532cd62
chore(server): update swagger info for default server profile (#2423) 2024-01-28 14:03:38 +08:00
Dandelion b980df8697
fix(chore): remove zgc in dockerfile for ARM env (#2421)
* remove zgc

* Apply suggestions from code review

Co-authored-by: imbajin <jin@apache.org>

* add comment for hugegraph-server.sh

* fix enable-auth.sh

* init store in entrypoint

* use flag file to skip re-init

* delete tar.gz

* simply dockerfile

* mvn optimize

* simply dockerfile

* add init log in docker

---------

Co-authored-by: imbajin <jin@apache.org>
2024-01-26 16:48:41 +08:00
Z-HUANT 1dd0580d30
fix(server): reinitialize the progress to set up graph auth friendly (#2411) 2024-01-17 20:56:25 +08:00
Dandelion de5904a600
feat: support docker use the auth when starting (#2403)
- allow user to set env for docker to set auth mode
- download keystore when package
- fix a curl error (also use curl first in `function` download)

---------

Co-authored-by: imbajin <jin@apache.org>
2024-01-15 20:50:24 +08:00
imbajin 57cd0e8dd7
doc: enhance NOTICE info to keep it clear (#2409) 2024-01-09 18:44:08 +08:00
Caican Cai 7965aac70d
chore: add license link (#2398) 2024-01-04 12:50:24 +08:00
xiaoleizi2016 cf9ba8b310
fix(core): task restore interrupt problem on restart server (#2401)
* Update StandardTaskScheduler.java
2023-12-29 12:04:54 +08:00
SunnyBoy-WYH 7635c67865
chore(server): update license for 1.2.0 (#2391)
---------

Co-authored-by: liuxiao <liuxiao2103@qq.com>
Co-authored-by: Simon Cheung <ming@apache.org>
2023-12-19 15:22:35 +08:00
V_Galaxy 965d6c137a
fix: incorrect path in hugegraph assembly scripts (#2392)
* fix: typo

* fix: assembly hugegraph path

* reset
2023-12-18 12:33:33 +08:00
Dandelion cb4427d9f1
doc: adjust docker desc in readme (#2390)
* fix(dist): update relative path for the 1.2.0

* add docker policy and run server in daemon

* fix: use tail to avoid container exit

* adjuest the order of quick start

* Update hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy

* adjust desc

* Update README.md

* Update pom.xml

---------

Co-authored-by: imbajin <jin@apache.org>
2023-12-17 15:59:28 +08:00
小宇 33fa9ed45d
update licence (#139) 2023-12-17 15:35:03 +08:00
vaughn 4346b44f80
fix: TinkerPop unit test lack some lables (#2387) 2023-12-14 17:59:31 +08:00
Dandelion 2c6fcdc719
add maven args for stage or other args (#2386) 2023-12-13 16:00:50 +08:00
imbajin 44f99e968c
doc: update README for release (#138) 2023-12-12 17:21:28 +08:00
conghuhu b52517cc47
feat(core): add IntMapByDynamicHash V1 implement (#2377)
* feat(WIP): add IntMapByDynamicHash (#2294)

* feat: add values & keys in IntMapByDynamicHash

* add some basic comment & fix some style

* feat: fix pr review

* fix: fix some review

---------

Co-authored-by: imbajin <jin@apache.org>
2023-12-12 12:25:51 +08:00
imbajin bd5d68f0f2
refact(rocksdb): clean & reformat some code (#2200)
* chore: merge master to clean-rocksdb for synchronization (#2383)

---------

Co-authored-by: V_Galaxy <dyc1904821183@gmail.com>
2023-12-11 22:21:08 +08:00
V_Galaxy bfe9fae150
chore: reset hugegraph version to 1.2.0 (#2382)
* chore: reset version to 1.2.0

* chore: add README for three submodules

* fix: README.md

* fix: README.md

* fix: README.md

* fix: README.md
2023-12-09 22:02:49 +08:00
M c997f35b04
fix(api): correct the vertex id in the edge-existence api (#2380) 2023-12-08 15:59:28 +08:00
小宇 47aa8be850
refact(api): update common 1.2 & fix jersey client code problem (#2365)
* update common version and fix rest client problem

* use stage

* fix dependency issue

* test

* test

* test

* test

* fix

* chore:  improve the ci logic

* fix core-version

* Empty test

* fix code issue

* fix: 3rd party changes

* code optimize

* refactor the AbsJerseyRestClient

* fix code issue

---------

Co-authored-by: imbajin <jin@apache.org>
2023-12-07 12:26:22 +08:00
Simon Cheung e8fb2696d6
chore: fix curl failed to request https urls (#2378) 2023-12-05 21:50:02 +08:00
小宇 dcf3752515
fix the json param convert (#137) 2023-12-05 10:56:12 +08:00
imbajin 10f0a87c7b
refact(common): rename jsonutil to avoid conflicts with server (#136)
fix https://github.com/apache/incubator-hugegraph/actions/runs/7082354080/job/19273001614?pr=2365

Also add some comment for it
2023-12-04 14:55:56 +08:00
Jermy Li 20d1e5228e
chore: move server info into GlobalMasterInfo (#2370)
* chore: move server info into GlobalMasterInfo

Change-Id: Id854892333115fd45d7c8b9799d255627541b2ad

* fix testClearAndInit() and export GlobalMasterInfo

Change-Id: Ic2878c5359e7f55fcd11986aa0bf79241c7ee9ab

* enhence ServerInfoManager.heartbeat()

Change-Id: I6932893c4be8331547f3b721083ca00430f85e58

* move RoleElectionStateMachineTest to UnitTestSuite

Change-Id: I7b3e8e2867dcf1063a726c8005f1c34dbd218f7c
2023-12-04 12:43:32 +08:00
Jermy Li 8c93652de7
fix: Assert.assertThrows() should check result of exceptionConsumer (#135)
* fix: Assert.assertThrows() should check result of exceptionConsumer

* fix some warnings

* remove assertThrowsFuture() from Assert
2023-11-30 16:25:31 +08:00
M ed493f3093
feat: optimize perf for adjacency-edges query (#2242) 2023-11-29 21:44:29 +08:00
haohao0103 d376b02dc5
fix HBase PrefixFilter bug (#2364)
* #2177

* #2177

* #2177

* #2177

* #2177

* #2177
2023-11-29 19:11:28 +08:00
lzyxx 197e8a00ed
chore(ci): add stage profile settings (#2361)
* Update LICENSE

* Update install-cassandra.sh

* add stage profile settings

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update licence-checker.yml

---------

Co-authored-by: imbajin <jin@apache.org>
2023-11-28 17:33:56 +08:00
SunnyBoy-WYH 0c01475843
feat(server):swagger support auth for standardAuth mode (#2360)
* feat(server):swagger support auth for standardAuth mode and try to fix arthas odd test

* chore(api): update api version & swagger token auth mode
2023-11-28 17:01:54 +08:00
imbajin c0ea21eed6
chore: disable raft test in normal PR due to timeout problem (#2349)
And replace it in pd/store module
2023-11-24 19:59:24 +08:00
小宇 5ad55fb82f
feat(common): replace jersey dependencies with OkHttp (Breaking Change) (#133)
* remove jersey

* Update ci.yml

* refact: replace params okhttp3.Headers to internal RestHeaders

* fix: licence dependency

* fix: test error

* fix: code format issue

* fix: unit test error


---------

Co-authored-by: imbajin <jin@apache.org>
2023-11-22 09:37:02 +08:00
Chong Shen 12b4940563
fix(api): remove redirect-to-master from synchronous Gremlin (#2356)
* fix: remove redirect master role to align with behaviour of VertexApi and EdgeApi

* chore: add back necessary annotation
2023-11-22 09:33:04 +08:00
Dandelion 25301f6228
feat: adapt Dockerfile for new project structure (#2344)
* feat: dockerfile adapt the project structure

* change the version

---------

Co-authored-by: imbajin <jin@apache.org>
2023-11-13 19:30:24 +08:00
imbajin a6e1f232c2
fix(api): refactor/downgrade record logic for slow log (#2347)
* fix(api): refactor/downgrade record logic for slow log

add some TODOs & assign @SunnyBoy-WYH to address it

* fix typo

* enhance the perf
2023-11-13 18:03:21 +08:00
imbajin a7ad7ea100 Update PerfExampleBase.java 2023-11-13 12:50:49 +08:00
imbajin a9445ca3c3 fix(api): clean some code for release
separate from slow log
2023-11-13 12:50:49 +08:00
V_Galaxy bce6d058f5
refact: adjust project structure for merge PD & Store[Breaking Change] (#2338)
## Purpose of the PR

Subtask of #2265.

Adjust the project structure of this repository to include three sub-modules: hugegraph-server, hugegraph-pd, hugegraph-store at the root level.

## Main Changes

Roll back to the moment when https://github.com/apache/incubator-hugegraph/pull/2266 was merged on `pd-store` and incorporate the latest changes in `master`.

For more detailed information, please refer to https://github.com/apache/incubator-hugegraph/pull/2266#issue-1834369489.


---------

Co-authored-by: M <87920097+msgui@users.noreply.github.com>
2023-11-08 18:08:08 +08:00
SunnyBoy-WYH 69e6b461ad
feat(api): support recording slow query log (#2327)
* chore(api): code style for cr

---------

Co-authored-by: imbajin <jin@apache.org>
2023-11-06 14:34:12 +08:00
SunnyBoy-WYH 4d5f4195db
chore(api): add swagger desc for Arthas & Metric & Cypher & White API (#2337)
add swagger belong for arthas API

---------

Co-authored-by: imbajin <jin@apache.org>
2023-11-06 14:15:32 +08:00
lzyxx 70ab14e3e6
feat(cassandra): adapt cassandra from 3.11.12 to 4.0.10 (#2300) 2023-10-28 23:58:17 +08:00
conghuhu e90489f361
fix(core): handle schema Cache expandCapacity concurrent problem (#2332) 2023-10-25 17:25:07 +08:00
Wu Chencan 8db0a9b195
feat(core): support batch+parallel edges traverse (#2312)
## Main Changes

- Enhance Consumers.java, supporting ExceptionHandle and `Future` to handle InterruptedException when awaiting
- Add Nested Iterator Edge and support batch execution
- Support batch execution & thread parallel in KoutTraverser and Kneighbor
2023-10-24 19:33:24 +08:00
Dandelion b43526da60
fix: always wait for storage if rocksdb is selected (#2333) 2023-10-24 17:24:43 +08:00
Dandelion d4b95ca323
feat: support Cassandra with docker-compose in server (#2307)
## Main Changes

1. change the dockerfile, adding the shell to wait for storage backend and use a docker-entrypoint.sh to manage the starting process.
2. delete a deprecated class in  gremlin-console.sh (reference: [doc of ScriptExecutor](https://tinkerpop.apache.org/javadocs/3.2.3/full/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptExecutor.html))
3. add a healthy check in docker-compose
4. add an example folder where we can put all the template docker-compose.yml here
5. add `*swagger-ui*` in gitignore, which appears after you compile the source code locally.

---------

Co-authored-by: imbajin <jin@apache.org>
2023-10-23 16:29:42 +08:00
Dandelion 73329ce4f5
doc: README.md tiny improve (#2331) 2023-10-23 16:17:36 +08:00
SunnyBoy-WYH 869fc81811
feat(api): support embedded arthas agent in hugegraph-server (#2278) 2023-10-20 10:15:51 +08:00
Jermy Li 45636a0489
README.md tiny improve (#2320) 2023-10-13 13:47:01 +08:00
SunnyBoy-WYH fc9bc2866e
feat(api): support metric API Prometheus format & add statistic metric api (#2286) 2023-10-08 20:21:09 +08:00
SunnyBoy-WYH 30ef2f7c6b
feat: support White IP List (#2299)
tips:
- this feat works when auth mode was set.
- this feat works when white ip status was enabled.

because now PD is unavailable,just use java list; when pd ready , we can checkout pd.
2023-10-02 13:25:45 +08:00
Dandelion d7c1c2149c
doc: update README about start server with example graph (#2315) 2023-10-02 13:14:01 +08:00
M b49be05171
add: dependency-review (#134)
* add: dependency-review

* tiny improve

* fix

Co-authored-by: imbajin <jin@apache.org>

---------

Co-authored-by: imbajin <jin@apache.org>
2023-09-20 17:47:01 +08:00
M 4ceef1ab0c
fix: base-ref/head-ref missed in dependency-review on master (#2308) 2023-09-11 10:48:37 +08:00
Wu Chencan 8e99d85d33
feat(api-core): support label & property filtering for both edge and vertex & support kout dfs mode (#2295)
- Support label & property filtering for both edge and vertex and the filtering is implemented in Kout Post and Kneighbor - Post Apis, reducing unnecessary graph searches through pruning
- Support Kout dfs mode in Kout Post Api

Originally only edge label filtering was supported, now label and property filtering for edge and vertex is supported.
- add classes VEStepEntity and VEStep to support serialization in request
- add class Steps to support filtering of edge and vertex in runtime(core)
- add new method edgesOfVertex(Id source, Steps steps) to support label and property filtering for both edge and vertex in HugeTraverser.java

---------

Co-authored-by: imbajin <jin@apache.org>
2023-09-10 16:47:45 +08:00
Dandelion 1d0969dede
fix(dist): avoid var PRELOAD cover environmnet vars (#2302)
Update hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh

---------

Co-authored-by: imbajin <jin@apache.org>
2023-09-08 22:07:57 +08:00
Chong Shen aaf67cf81c
fix(core): close flat mapper iterator after usage (#2281)
close [Bug] FlatMapperIterator should be closed after usage #2280
2023-08-29 16:09:31 +08:00
Dandelion 8a515f20db
feat(dist): support pre-load test graph data in docker container (#2241)
- Provide the related conf and groovy for user to pre load some data.
- Change the start-hugegraph.sh to get the environment variables to decide to pre-load or not.

---------

Co-authored-by: imbajin <jin@apache.org>
2023-08-28 15:36:21 +08:00
V_Galaxy 77c76124af
chore(dist): replace wget to curl to download swagger-ui (#2277)
Main Changes:
1. replace `wget` by `curl` when downloading `swagger-ui`
2. silence the output of `curl` and `tar` commands
3. reuse the existing `v4.15.5.tar.gz` before downloading
4. avoid downloading `swagger-ui` in non-Linux platforms to prevent build failures (there might be a cross-platform build approach available 🤔)
5. wrapp the script content within `<![CDATA[ ... ]]>` blocks ensures that the script retains its original format when generating the `dist.sh` script (also suppresses automatic indentation)
6. remove intermediate files at the end of the script

**An alternative approach**, during the generation of the `dist.sh` script, only the `${final.name}` property from the build process is utilized. It might be possible to separately store a `dist.sh` script within hugegraph-dist, then use `sed` during the build process to replace the value of `${final.name}`, **thereby avoiding the need to embed script content within the pom file**.

---------

Co-authored-by: imbajin <jin@apache.org>
2023-08-25 15:20:44 +08:00
lzyxx 4d7ad86776
fix checkstyle: Update StandardStateMachineCallback.java (#2290)
During the compilation of your code, an informational message was displayed indicating an issue with the file /home/lzy/hugegraph/hugegraph-core/src/main/java/org/apache/hugegraph/masterelection/StandardStateMachineCallback.java at line 36. The specific problem was that the length of this line exceeded 100 characters, with a total of 101 characters.

To address this issue, I have made modifications to this class. I have split the originally long line into multiple lines to ensure that each line's length adheres to the coding standards' specified limits. This action not only aligns with the requirements of the code style, but also improves the readability and maintainability of the code.
2023-08-22 14:07:34 +08:00
DanGuge d12f5734e6
feat(api&core): in oltp apis, add statistics info and support full info about vertices and edges (#2262)
* chore: improve gitignore file

* feat: add ApiMeasure to collect runtime data

ApiMeasure will count the number of vertices and edges traversed at runtime, and the time the api takes to execute

* feat: Add ApiMeasure to JsonSerializer and Modify the Serializer interface

* JsonSerializer: return measure information in api response

* Serializer: fit the feature that returns complete information about vertices and edges

* refactor: format code based on hugegraph-style.xml

* feat: Add statistics information in all oltp restful apis response and Support full information about vertices and edges

Statistics information:

* add vertexIterCounter and edgeIterCounter in HugeTraverser.java to track traversed vertices and edges at run time

* modify all oltp restful apis to add statistics information in response

Full information about vertices and edges:

* add 'with_vertex' and 'with_edge' parameter option in apis

* modify oltp apis to support vertex and edge information in api response

* add EdgeRecord in HugeTraverser.java to record edges at run time and generate the edge information returned in api response

* modify Path and PathSet in HugeTraverser.java to support full edge information storage

* modify all traversers to support track of edge information at run time

* fix: numeric cast

* fix: Jaccard Similarity api test

* fix: adjust the code style and naming convention

* Empty commit

* Empty commit

* fix:
1. change System.currentTimeMillis() to System.nanoTime();
2. modify addCount()

* fix: rollback change in .gitignore

* fix: rollback ServerOptions.java code style

* fix: rollback API.java code style and add exception in else branch

* fix: fix code style

* fix: name style & code style
* rename edgeRecord to edgeResults
* fix Request class code style in SameNeighborsAPI.java
2023-08-19 13:41:08 +08:00
DanGuge b02c2bdaa7
fix(api): incorrect use of 'NO_LIMIT' variable (#2253)
* replace Query.NO_LIMIT with HugeTraverser.NO_LIMIT
2023-07-23 10:51:58 +08:00
Z-HUANT 7927335303
fix: asf invalid notification scheme 'discussions_comment' (#2250)
* fix:asf invalid notification scheme 'discussions_status'

---------

Co-authored-by: zhuangpengtao <zhuangpengtao@joyy.com>
Co-authored-by: imbajin <jin@apache.org>
2023-07-20 18:08:53 +08:00
Z-HUANT c922b10c31
fix:asf invalid notification scheme 'discussions_status' (#2247) 2023-07-20 10:32:56 +08:00
ustcer c31a53641f
add some construction methods for more convenient use (#132)
Co-authored-by: chengxin05 <chengxin05@baidu.com>
2023-07-19 21:06:52 +08:00
conghuhu 5df28fa2ca
feat(perf): support JMH benchmark in HG-test module (#2238)
* chore: add param to max cap

* chore: add non argument constructor to IntMapByEcSegment

---------

Co-authored-by: shiyi <congguoqing.cgq@alibaba-inc.com>
2023-07-17 16:50:35 +08:00
Z-HUANT 23776a7686
fix: optimizing ClassNotFoundException error message for MYSQL (#2246) 2023-07-17 16:49:37 +08:00
KeeProMise 8ee3d32b4f
doc: modify ASF and remove meaningless CLA (#2237) 2023-07-01 18:44:49 +08:00
Liu Xiao 5227248799
fix(core): support order by id (#2233)
* revert sslmode
2023-06-21 18:12:02 +08:00
Liu Xiao 80a4cd6877
chore: add pr template (#2234)
* update close/fix synx

* uniform case

---------

Co-authored-by: imbajin <jin@apache.org>
2023-06-21 18:11:18 +08:00
Liu Xiao 324cbb2c1f
collect option ssl_mode for hugegraph-test (#2235) 2023-06-21 17:46:21 +08:00
KeeProMise 258d1812ff
add com.janeluo.ikkanalyzer dependency to core model (#2206)
* put the third-party dependency license file and Declare the dependency in LICENSE info
2023-06-20 21:45:04 +08:00
Lionztt b836426db0
chore: improve the UI & content in README (#2227)
* feat: change contributor img size to normal size

---------

Co-authored-by: imbajin <jin@apache.org>
2023-06-13 00:04:28 +08:00
V_Galaxy b4e67e1dfb
fix: error when start gremlin-console with sample script (#2231)
* fix: add `-i` parameter in `gremlin-console.sh`, add `serverStarted` in `example.groovy`

* fix: modify hugegraph conf path

* fix: remove unnecessary index on properties on [name]
2023-06-12 16:25:47 +08:00
Liu Xiao b8c7743616
fix: jdbc ssl mode parameter (#2224) 2023-06-06 19:58:58 +08:00
M bcf2a395cf
doc: update README & add QR code (#2218)
Co-authored-by: imbajin <jin@apache.org>
2023-06-05 13:54:38 +08:00
imbajin a946ad1de4
chore: update .asf.yaml for mail rule (#2221) 2023-05-31 22:56:58 +08:00
vaughn e1d9607410
refact(core): optimized batch removal of remaining indices consumed by a single consumer (#2203) 2023-05-31 12:36:52 +08:00
starry-sky_down-to-earth f23c648937
refact(core): early stop unnecessary loops in edge cache (#2211) 2023-05-17 00:23:45 +08:00
KeeProMise 0f2faf48dc
fix: remove dup 'From' in filterExpiredResultFromFromBackend (#2207) 2023-05-08 20:55:02 +08:00
zoulei 297e491232
fix commons dependency conflict (#131)
* fix commons dependency conflict
* upgrade commons version to 1.0.1
* upgrade grpc-core version to 1.28.1

Co-authored-by: imbajin <jin@apache.org>
2023-04-21 00:07:05 +08:00
vaughn 267ff6d3a8
chore: async remove left index shouldn't effect query (#2199) 2023-04-19 21:19:01 +08:00
Simon Cheung 7b6a4bd136
fix exception of vertex-drop with index (#2181)
note only the vertex with index data needs forceLoad
2023-03-29 22:35:58 +08:00
zoulei 6997a87d0c
move validate release to hugegraph-doc (#2109) 2023-03-27 16:32:06 +08:00
zoulei 9e4fb9647e
chore: remove stage-repo in pom due to release done & update mail rule (#2128)
* add new issues mailbox and move some mails to it

---------

Co-authored-by: imbajin <jin@apache.org>
2023-03-16 13:16:38 +08:00
Bond 4b74ab6cec
feat: use an enhanced CypherAPI to refactor it (#2143)
Co-authored-by: lynn.bond <liyan75@baidu.com>
Co-authored-by: imbajin <jin@apache.org>
2023-03-15 22:36:13 +08:00
vaughn 6409d9277d
optimize: remove lock of globalMasterInfo (#2151) 2023-03-14 18:55:29 +08:00
Rocky 82c7e78a8c
feat: support parallel compress snapshot (#2136)
* add raft default config

* delete useless final

* fix import style

---------

Co-authored-by: imbajin <jin@apache.org>
2023-03-14 18:50:35 +08:00
Jermy Li 901da45e59
fix query dirty edges of a vertex with cache (#2166)
fix #2163
Change-Id: I58b26f8a791885800e42821a3d4b2724f4e647a0
2023-03-14 17:59:11 +08:00
vaughn 31c6c6df13
feat: support task auto manage by server role state machine (#2130) 2023-03-08 23:20:36 +08:00
Jermy Li a0f34d5973
chore: disable up-to-date in PR (#2150) 2023-03-08 22:53:52 +08:00
imbajin d968deb124
refact: use a slim way to build docker image on latest code & support zgc (#2118)
* also modify shell
2023-03-08 12:14:37 +08:00
imbajin 6c0d596eac
refact: use standard UTF-8 charset & enhance CI configs (#2095) 2023-03-07 23:10:31 +08:00
YangJiaqi 76fa64498a
add github token for license check comment (#2139) 2023-03-02 21:22:16 +08:00
vaughn 1d524760eb
chore: cmn algorithm optimization (#2134) 2023-03-01 08:19:04 +08:00
imbajin 271d72c9f3
doc: update issue template & README file (#2131)
* doc: update issue template & README file
* replace outdated url
2023-02-28 00:16:32 +08:00
Simon Cheung 614d47159d
fix: transfer add_peer/remove_peer command to leader (#2112) 2023-02-20 19:04:15 +08:00
imbajin 82f2a6539f Update license-checker.yml 2023-02-10 14:46:48 +08:00
imbajin f9593d494b chore: refactor the license check CI 2023-02-10 14:46:48 +08:00
vaughn c8e0f0c3e1
chore(license): add ProcessBasicSuite and SturctureBasicSuite license (#2106)
* chore(license): add ProcessBasicSuite and SturctureBasicSuite license

* chore: add snowflake license to binary release

* Update LICENSE-jna.txt
---------

Co-authored-by: imbajin <jin@apache.org>
2023-02-10 14:45:48 +08:00
Simon Cheung 6aa01af49e Update NOTICE 2023-02-09 19:19:11 +08:00
Simon 6f9493a517 1 2023-02-09 19:19:11 +08:00
Simon Cheung effedb0c23
chore: fix snowflake license (#2093) 2023-02-09 19:18:47 +08:00
vaughn eed6103359
fix: some reference url and 3rd-party file license (#2100) 2023-02-07 23:44:05 +08:00
imbajin e1cb3eb16c
chore(license): fix 3rd party refer code (#127)
* fix 3rd party refer in LICENSE
* add sky-walking action to check license header
* Update pom.xml
2023-02-04 01:52:42 +08:00
Simon Cheung e4633e1cdb
chore: choose proper license & remove GPL/CC in multiple licenses (#2099) 2023-02-03 18:41:18 +08:00
imbajin fc6e3702da
refact: update with release branch (#2091)
* fix: add style file back for building

* fix: script no permission

* chore: add NOTICE and LICENSE to binary package and add DISCLAIMER file

Co-authored-by: Simon Cheung <ming@apache.org>
Co-authored-by: vaughn <vaughn@apache.org>
Co-authored-by: 青年 <1043706593@qq.com>
2023-01-17 01:51:26 +08:00
青年 91a616bb38
fix: support null value for gremlin test (#2061)
* fix(core): adapt HugeVertex.property() with null values

Co-authored-by: imbajin <jin@apache.org>
2023-01-16 22:53:24 +08:00
vaughn f49b2b808d
chore: remove hugegraph-server.store & jacoco jar & LicenseVerify (#2092) 2023-01-16 14:10:59 +08:00
imbajin f6018d1071
chore: remove unnecessary binary files & add rat check in ci (#2086) 2023-01-14 23:50:01 +08:00
imbajin 958193d797
chore: support validate apache release automatically (#2076) 2023-01-14 17:50:40 +08:00
Simon Cheung 3427625379
chore: modify NOTICE & LICENSE path (#2084)
Co-authored-by: imbajin <jin@apache.org>
2023-01-14 13:51:36 +08:00
imbajin 8724b12032 chore: fix copyright year and format 2023-01-14 02:07:18 +08:00
imbajin 1f64e8afb0 chore: remove copyright in file header & fix some files 2023-01-14 02:07:18 +08:00
imbajin c28f8c8977 chore: add DISCLAIMER & NOTICE & LICENSE file to binary package 2023-01-14 02:07:18 +08:00
imbajin e339fed6c9 fix(dist): generate doc & exit script when upload files failed 2023-01-14 02:07:18 +08:00
Simon Cheung 04112774d4
remove swagger-ui source (#2089) 2023-01-14 01:51:08 +08:00
imbajin e400e4d22b
refact(test): download binary file for https test (#126) 2023-01-13 23:44:21 +08:00
青年 b385c45c35
chore:remove copyright in license header (#2090)
Co-authored-by: imbajin <jin@apache.org>
2023-01-13 23:26:52 +08:00
vaughn c37556919b
fix: parent dir on project be deleted (#2085) 2023-01-11 23:33:38 +08:00
Jermy Li 62d52a20ba
fix: shutdown exception overrides the original exception (#2072)
Change-Id: I8398ae50197cab7ffe06fa17781300303e385dc9
2023-01-11 22:52:31 +08:00
vaughn 52807b0aa0
chore: remove unknown license and fix source name (#2073) 2023-01-11 19:21:06 +08:00
vaughn b3949997fd
chore: add DISCLAIMER & NOTICE & LICENSE file to binary package (#2071)
* chore: add NOTICE and LICENSE to binary package and add DISCLAIMER file

* Update DISCLAIMER

* Update .licenserc.yaml

Co-authored-by: imbajin <jin@apache.org>
2023-01-06 22:44:43 +08:00
Jermy Li 7efcf879c1
fix: check uncommit due gremlin partition test silently fails (#2065) 2023-01-04 23:18:55 +08:00
vaughn 93614cf29d
fix: scripts no permission (#2069) 2023-01-04 19:54:06 +08:00
Simon Cheung 80bd82bde1
chore: add NOTICE file (#2066) 2023-01-04 02:08:43 +08:00
青年 0239a1e174
fix: add style files back (#125)
* add style
* Update .gitattributes

Co-authored-by: imbajin <jin@apache.org>
2023-01-01 13:18:07 +08:00
seagle fb48e831f7
fix: empty label exception should be labelCanNotBeNull() (#2063) 2022-12-30 11:57:37 +08:00
Jermy Li eb7a65c440
refact: fallback queryNumber() if there are uncommitted records (#2060) 2022-12-29 15:26:53 +08:00
vaughn 6c3170c496
chore: fix TinkerPop unit test (#2055)
* chore: don't support persistence for memory backend
* chore: setup graph by first step graph when graph is null
* chore: apply relations optimize logic
* chore: don't support null properties
* fix: g.V().has(empty).count() and g.V().count().as('a').select('a')
* fix: specify the code generation directory for raft.proto (#2057)
* fix: tinkerpop unit schema no define
* fix the style & clean some outdated code

Co-authored-by: Simon Cheung <ming@apache.org>
Co-authored-by: imbajin <jin@apache.org>
2022-12-26 22:41:46 +08:00
Simon Cheung fc27f2c200
fix: specify the code generation directory for raft.proto (#2057) 2022-12-21 16:23:42 +08:00
Simon Cheung 8047fe7d9e
license (#2053) 2022-12-15 21:21:12 +08:00
imbajin 9463119a67
chore: update release script & add mailing lists (#123) 2022-12-15 16:14:29 +08:00
vaughn 85499f389b
fix: keep binary file (#2052) 2022-12-15 16:07:34 +08:00
imbajin 9cbb61862c
chore: prepare for apache v1.0.0 release (#2048)
* chore: apache release

* chore: update release script & remove redundant pom config
2022-12-14 17:52:01 +08:00
vaughn 73bf516630
FIX: security (#2050)
Co-authored-by: Jermy Li <jermy@apache.org>
2022-12-14 10:01:57 +08:00
Simon Cheung 7d84f01a31
improve check-dependencies (#2051)
improve check-dependencies
2022-12-13 23:03:28 +08:00
imbajin a40774e484
chore: prepare for release v1.0.0 (#122) 2022-12-06 15:41:56 +08:00
zyxxoo ea888d11d8
FIX: rat ignore protobuf generate file check (#2045) 2022-12-05 23:23:20 +08:00
Simon Cheung 510b12ed6e
chore: update mysql scope to test (#2043)
* remove mysql dependency
* add mysql for hugegraph-test
* update run-api-test.sh
2022-12-05 20:23:38 +08:00
imbajin c86e38a8ac
chore: enable rebase option (#121) 2022-12-05 00:05:14 +08:00
zyxxoo 627a028dab
fix: hugegraph script error (#2044) 2022-12-04 21:19:52 +08:00
seagle d01c8737d7
fix: solve antrun plugin bug (#2042) 2022-12-02 10:15:30 +08:00
imbajin 2251adf073
refact(dist): fix "restart" script not work & clean for script (#2041)
- fix "restart" script not work
- clean shell script to avoid error in high-version bash/sh
2022-12-01 23:38:45 +08:00
seagle 927b67324e
chore: update antrun plugin & fix building problem in windows (#2038) 2022-12-01 16:15:02 +08:00
seagle 37e221a712
delete blankspace of licenses filename (#120)
Co-authored-by: yuanbingze <yuanbingze@yy.com>
2022-11-30 15:45:16 +08:00
青年 be6ee386b9
rename binary package name (#2037)
* rename binary package name

* rename binary package name v2

* rename binary package name v3

Co-authored-by: Jermy Li <jermy@apache.org>
2022-11-30 10:25:18 +08:00
青年 df05b2b1b0
let sub-modules use revision (#2039) 2022-11-30 00:32:17 +08:00
Zonglei Dong ccade5ac47
chore(apache): add license checker for CI. (#2034)
Co-authored-by: imbajin <jin@apache.org>
2022-11-27 23:13:08 +08:00
青年 3b44568e8b
fix outdated manifest version & use project.version instead (#2033)
Co-authored-by: imbajin <jin@apache.org>
2022-11-26 22:40:33 +08:00
Cong Zhao 6c9fe3a874
Fix tx leak in tests (#2031) 2022-11-25 18:57:56 +08:00
青年 5bc993fe79
manifest version use project.version (#119) 2022-11-23 21:17:02 +08:00
imbajin d340420341 refact(cassandra): update pom & ApiVersion & fix style
TODO: and we need also check the 0.69 in pom
2022-11-23 21:16:14 +08:00
青年 67a689c86c refact: adapt all to apache package and dependencies (Breaking Changes) 2022-11-23 21:16:14 +08:00
seagle 44bea37187
delete blankspace of filename (#2023)
Co-authored-by: yuanbingze <yuanbingze@yy.com>
2022-11-22 21:24:48 +08:00
Cong Zhao 7acd496e0b
[fix][cli] Fix start cli error (#2024) 2022-11-22 20:56:06 +08:00
Cong Zhao 4c232a6167
Shutdown log when shutdown process (#2028) 2022-11-22 20:35:52 +08:00
imbajin aa0d8dac47
fix(dist): start server with java 11 (#2020) 2022-11-20 21:50:47 +08:00
青年 57462b057e
Feat/fix codeql (#2022)
* fix ConfigUtil.java CodeQL

* fix code checkstyle

Co-authored-by: Jermy Li <jermy@apache.org>
2022-11-20 18:39:43 +08:00
Jermy Li 109495e9be
mac m1: fix JNA UnsatisfiedLinkError by upgrade to v5.12.1 (#2013) 2022-11-18 23:47:32 +08:00
vamossagar12 b79a690cd4
Adding try-with-resources block around PredictionTraverser (#2016)
Co-authored-by: Sagar Rao <sagarrao@Sagars-MacBook-Pro.local>
2022-11-15 21:07:51 +08:00
vamossagar12 833ce2f0b7
Fix bug: Closing iterators on errors for CassandraTable and MysqlTable (#2014)
Co-authored-by: Sagar Rao <sagarrao@Sagars-MacBook-Pro.local>
2022-11-14 23:06:42 +08:00
Jade Peng 020b7dc00a
refactor(core): improve code by flow idea suggests (#2000)
Co-authored-by: jadepeng <jqpeng@iflytek.com>
2022-11-11 23:34:00 +08:00
Simon Cheung 4dbe157ecb
Add thrid-party dependency licenses (#117)
* add dep licenses

* Update LICENSE-JavaHamcrest.txt

Co-authored-by: imbajin <jin@apache.org>
2022-11-09 21:58:18 +08:00
imbajin b1b12098fe adapt the latest version & clean code
also fix the sec alert
2022-11-09 18:24:54 +08:00
Jermy Li 75e004a4e3 fix lpa not exist c_label property when a request pass source_label (#78)
Change-Id: Ib2a9766e29708fa4fcbaec152f5c9e571c96a0a6
2022-11-09 18:24:54 +08:00
zhoney c3e9f8ec06 fix fusiform and kcore min_groups args default value (#79)
Change-Id: I843c595172d7b45b894d764bf859dec61a35c8b5
2022-11-09 18:24:54 +08:00
zhoney b4fa2a16ac fix ap compile error for edition 0.11 (#72)
Change-Id: Ibf0f415ee6bd9cf0ff8b598e2166cc70667c49b7
2022-11-09 18:24:54 +08:00
houzhizhen f63f056034 performance improvement: the meetNode is invoked only when node.distance is parent.distance() + 1 (#69) 2022-11-09 18:24:54 +08:00
houzhizhen 476477bb7b add StressCentrality v2 (#65)
* add StressCentralityAlgorithmV2
* add BfsTraverser and ClosenessCentralityAlgorithmV2
2022-11-09 18:24:54 +08:00
Jermy Li 6c5e204c38 add depth-first version betweennes centrality (#68)
Change-Id: Id4fc070268d8957ef2764bffbb3c762d9c034a0d
2022-11-09 18:24:54 +08:00
Jermy Li f1ad2e5623 fix closeness distance: 1 extra length is calculated (#67)
Change-Id: I35bc20698bf93002a530b95688cd0359a9154fdf
2022-11-09 18:24:54 +08:00
houzhizhen 708ace7deb add betweenness algorithm (#63)
* add betweenness BetweennessCentralityAlgorithmV2
2022-11-09 18:24:54 +08:00
houzhizhen 71f6e81796 update Betweenness with Stressness (#60) 2022-11-09 18:24:54 +08:00
Jermy Li 9926fc6e05 add export_community for lounvain (#43)
Change-Id: I01e402fc99669f53544279c752f81d886c6ce28f
2022-11-09 18:24:54 +08:00
Jermy Li 4caf261216 add with_boundary parameter for betweeness (#42)
* improve betweeness by remove boundary vertex of path

Change-Id: I76924daf8d9da113ab7a1aeac536c6080eccb296

* add with_boundary parameter for betweeness

also fix lpa count comms with limit

Change-Id: Iaf675cd87a8dc0b5ef75476144bc8141f2dd4385
2022-11-09 18:24:54 +08:00
Jermy Li 37bd251708 fix DegreeCentrality degree count limit OOL (#39)
Change-Id: I1b055130c75edce039a97822d9154e1214bc80c2
2022-11-09 18:24:54 +08:00
Jermy Li 148d6250dc add skipi_isolated param for louvain (#37)
Change-Id: Ib24ede9c20bb2c23a3f06fe72c53be2342295fd4
2022-11-09 18:24:54 +08:00
houzhizhen eb6398c4b7 add parameter top to print the top result in job result (#32)
* add parameter top to print the top result in job result
2022-11-09 18:24:54 +08:00
Jermy Li 7ef0305da7 fix server id/role NPE in initServerInfo when truncate temp graph (#28)
Change-Id: Iedbafa9a31ed3f5b3fb35ccb0c583ec0a0cfc6ac
2022-11-09 18:24:54 +08:00
Jermy Li 353d90698f fix no auth with worker thread of olap algo (#27)
call graph close instead of closeTx

Change-Id: I0e329280b067f34daec69c9b1b2b81a6cd3309bf
2022-11-09 18:24:54 +08:00
Zhangmei Li 0d6b871aba rebase master(0.11.1)
Change-Id: I565602945a26c2a575baaa3f17d084b65399a009
2022-11-09 18:24:54 +08:00
Jermy Li 53025bd43b add BOTH direction support for triangle_count/cluster_coeffcient (#24)
change log:
1. add BOTH direction support for triangle_count/cluster_coeffcientith.
2. fix extra triangle count with multi edges between tow adjacent vertices.
3. set default value of direction to BOTH for degree_centrality and cluster_coeffcient .
4. add workers for triangle_count and cluster_coeffcient.
5. fix closeness: multi shortest paths cause results illogical.
6. rename rings_detect to rings, rename limit to each_limit which means limit number of rings of each source vertex, and don't do dedup if passed each_limit > 0.
7. unify top for 4 centrality algos: sorted results when top = -1, unsorted results when top = 0.
8. fusiform: rename top to top_similars (expected >= 0).
9. fusiform/rings: add limit param which means max number of results, and remove capacity param and hardcode to 100000000.

Change-Id: I9ddf8553e6d86b99adbff8b972890d69d623fa1a
2022-11-09 18:24:54 +08:00
Jermy Li 6ef3c0e291 add subgraph_stat algorithm (#23)
Change-Id: If4faafc1a952186c17314c599f611f7ab6132b7b
2022-11-09 18:24:54 +08:00
houzhizhen 8385db2177 add weak connected component analysis (#21) 2022-11-09 18:24:54 +08:00
houzhizhen 31ae32b67a add page rank algorithm (#19) 2022-11-09 18:24:54 +08:00
Jermy Li 71109cffde fix algorithm can't stop caused by threads exception (#18)
Change-Id: I546682b19fb5a84a65dc2a3bd77d62b386722bfa
2022-11-09 18:24:54 +08:00
zhoney 464d99080f Support ring detect count (#17)
* support rings count for rings-detect ap algo
* fix direction can't be null or Both for triangle and clusterCoeffcient
* fix source_clabel error for rings-detect, fusiform and kcore
* change limit meaning for fusiform similarity

Change-Id: I5a4ccbf46b47c13ea2eafe7f3e335dc6aea4a83c
2022-11-09 18:24:54 +08:00
Jermy Li beda055142 fix parallel LPA not commit by threads (#16)
Change-Id: I8eaaeccaa0b23048a9d0f597080186c069b9799b
2022-11-09 18:24:54 +08:00
Jermy Li 4763e876bc support parallel: Louvain,LPA,Rings,K-Core,Fusiform (#15)
* optimize louvain by multi threads
* implement louvain threads
* fix race condition
* implement merge community by multi threads
* remove debug info
* fix genId race condition
* compatible with serial and parallel computing
* support parallel lpa
* support parallel: Louvain,LPA,Rings,K-Core,Fusiform

Change-Id: I2425d1da58581ea7a61dce72a88355ae3d2dd610
2022-11-09 18:24:54 +08:00
Jermy Li 9c9c26c3cb louvain: add modularity parameter and fix isolated community lost (#14)
* add modularity parameter for louvain
* fix: louvain lost isolated community from one to next pass

Change-Id: I6a7dadc80635429aa2898939aa337aae01bc8d12
2022-11-09 18:24:54 +08:00
Jermy Li bc9822d7bb add direction and label parameter for centrality algorithms (#13)
Change-Id: I20b72ea0da673359e2bd21888010290efca81441
2022-11-09 18:24:54 +08:00
Jermy Li 7a72d7df60 optimize filterNonShortestPath() for betweeness_centrality (#12)
network10000 dataset test:
                   before  after
(depth=4 sample=1) 395s    25s
(depth=3 sample=2) 4300s   35s

same as the closeness_centrality

Change-Id: Ia0c557434bf25f9d13a0b1dc19f66024e08c89df
2022-11-09 18:24:54 +08:00
Jermy Li fa3ace6865 fix inconsistent error messages with clabel (#10)
also improve error message cause reason

Change-Id: I15ea8dd651e01ff678a32f19efd3584cd20ffc10
2022-11-09 18:24:54 +08:00
Jermy Li c96d4e94e1 set louvain max community members limit 10w (#9)
Change-Id: I5cc3be846ff4536ebfba1f9bf54a0adda7409036
2022-11-09 18:24:54 +08:00
zhoney c89b0690dd add fusiform_similarity,rings_detect and kcore ap algorithm (#5)
* improve
* move c_label to lower layer and add appendRow(value)
* add community limit 100w for louvain
* improve louvain log
* fix louvain bug

Change-Id: I886ac3e7a3f0dfd49e66fdf544f97f6f7db615df
2022-11-09 18:24:54 +08:00
Jermy Li 9e4e33f41a implement 8 olap algorithms (#4)
* add olap algo api
* improve source filter
* fix louvain shaking with limit degree
* catch exception for lpa and louvain
* add 3 params for lpa: label,source_label,percision
* improve louvain node store
* remove vertices from class Community
* move showCommunity to AbstractCommAlgorithm
* add some parameters to AbstractAlgorithm
* improve louvain log
* improve clearPass and communities check
* split louvain cache
* fix degreeCentrality bug: degree is always < 500

Change-Id: I2341b981dab44f43ac50ae0f8fa5e51b7acc1b5a
2022-11-09 18:24:54 +08:00
imbajin caa4b26a98
refact: address some code alert (#115) 2022-11-09 17:50:27 +08:00
imbajin 8869c9ea4a
chore: enable rebase merge (#2003) 2022-11-09 14:56:20 +08:00
青年 0dfb124314
add flatten plugin (#2004) 2022-11-08 22:13:53 +08:00
Simon Cheung 89ebbfdffb
Add thrid-party dependency licenses (#2008)
Co-authored-by: imbajin <jin@apache.org>
2022-11-08 21:14:48 +08:00
Simon Cheung 952975a3c7
add dep check ci (#116) 2022-11-08 21:13:45 +08:00
Simon Cheung 2fc8869347
check dependencies (#2006) 2022-11-07 21:30:39 +08:00
青年 7347b17a47
fix apache revision (#114) 2022-11-04 20:56:00 +08:00
Jade Peng 09619597d6
refactor: improve rocksdb code (#2002)
Co-authored-by: jadepeng <jqpeng@iflytek.com>
2022-11-03 23:47:32 +08:00
青年 16602cc839
support custom content-type (#113)
* support custom content-type

* support custom content-type v2
2022-11-01 18:16:44 +08:00
zyxxoo 19ef0ac203
remove word dependency to remove GPL license (#1998) 2022-10-31 12:05:22 +08:00
zyxxoo 66b167422f
fix: User-controlled data in numeric cast [#1987] (#1996)
* fix: User-controlled data in numeric cast [#1987]
2022-10-30 23:29:50 +08:00
imbajin c1d32a8bd0
chore: update ci version & enable it (#1892)
* chore: enable required ci

* Update .asf.yaml

* Update .asf.yaml

* update ci version

* Update .asf.yaml

* Update .asf.yaml

* Update codeql-analysis.yml

* Update .asf.yaml
2022-10-30 22:23:33 +08:00
seagle cc80d27745
fix redundant Checkstyle (#1896)
* add redundant

* add redundant check

* merge line

* update alignment

* delete duplicates check MissingSwitchDefault

* update wrap line

* update code style

* merge dev

* merge master
2022-10-30 16:16:21 +08:00
imbajin 3a22263621
chore: improve gitignore file (#1994) 2022-10-30 16:14:44 +08:00
Jermy Li 1fbd5ffcb5
fix TraversalStrategyProxy() compile error on java 11 (#1982)
compile error on java 11:
  Cannot infer type arguments for new TraversalStrategyProxy<>(strategy)

Change-Id: I6a31cb24d4f37cc6af9ae9769a986593301ea1ff
2022-10-28 00:00:22 +08:00
imbajin 4361a51d9d
chore: fix missing mail address & other configs (#112) 2022-10-27 00:39:09 +08:00
Jade Peng 07810249a5
refact(core): update dependencies version & adopt the new analyzer (#1989)
jraft 1.3.9->1.3.11
ohc-core 0.7.0->0.7.4
org.apdplat.word 1.3->1.3.1
hanlp portable-1.5.0->portable-1.8.3
lucene-analyzers-smartcn,lucene-core 7.4.0->8.11.2
jcseg-core->2.2.0 ->2.6.2
lz4-java 1.7.1->1.8.0
eclipse-collections 10.4.0->11.1.0
fastutil 8.1.0->8.4.0
jjwt 0.11.2->0.11.5

Co-authored-by: jadepeng <jqpeng@iflytek.com>
2022-10-26 23:11:30 +08:00
Jade Peng 88a8d782b8
improve analyzer code (#1990)
Co-authored-by: jadepeng <jqpeng@iflytek.com>
2022-10-26 22:57:41 +08:00
青年 8abf3d5524
chore: support check license header with RAT & fill the gaps (#1988) 2022-10-26 19:43:41 +08:00
imbajin dc3e9e2bbd
chore: enable ci in all prs (#111) 2022-10-26 19:38:51 +08:00
imbajin ae54f28308
refact: upgrade a string of dependencies to address CVEs report & clean code (#110)
Note: after use junit-2.13, some assert-api's error messages has changed, check it in other repos (and avoid use long & fixed error message)
2022-10-26 19:02:36 +08:00
Jade Peng 9b5950e4be
fix(api): fix remoting rpc server not started (#1975)
Co-authored-by: jadepeng <jqpeng@iflytek.com>
2022-10-21 21:40:28 +08:00
imbajin b783da5bde
feat(apache): support check license header with RAT (#108)
use "mvn apache-rat:check" to see the report, and use find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt
2022-10-20 12:18:49 +08:00
imbajin be72d20f8a
chore: setup for apache maven release (#107) 2022-10-19 23:42:31 +08:00
dependabot[bot] 99d4481e94
build(deps): bump protobuf-java from 3.21.2 to 3.21.7 (#1973)
Bumps [protobuf-java](https://github.com/protocolbuffers/protobuf) from 3.21.2 to 3.21.7.
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf/blob/main/generate_changelog.py)
- [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.21.2...v3.21.7)

---
updated-dependencies:
- dependency-name: com.google.protobuf:protobuf-java
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-13 23:08:16 +08:00
NankeXXX 7621aa71d2
fix(sec): upgrade netty-all to 4.1.44.Final (#1971) 2022-10-08 19:33:26 +08:00
Simon Cheung 767bdfc397
chore: fix GraphOfTheMoviesExample exception (#1953) 2022-10-08 19:31:36 +08:00
xiaoleizi2016 b699c5cd62
refact: modify abnormal logs (#1948) 2022-10-08 19:27:38 +08:00
dependabot[bot] 8f4e95d3ec
build(deps): bump postgresql in /hugegraph-postgresql (#1960)
Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.1.4 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.1.4...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-01 18:21:18 +08:00
zyxxoo 51d29ac3a0
feat(core): cluster role automatic management (#1943)
* #1869 cluster role automatic management

* improve code

* FIX bug

* improve code

* improve code

* improve code

* improve code

* improve code

* improve code
2022-09-16 10:53:06 +08:00
imbajin e85ab38c6b
refact: clean code & typo & update the name of getTimeZone (#105)
* refact:  clean code & typo & update the name of getTimeZone

Typo: getTimeZome() -> getTimeZone()

And we need check/update the class used it later

* Update RestClient.java
2022-09-15 16:36:13 +08:00
ShouJing 3b1bcb1a99
rename package name `com.baidu` to `org.apache` (#104) 2022-09-08 17:28:03 +08:00
DamonXue(Fibonacci) 42ef9c4d95
chore: upgrade CodeQL version to v2 (#106) 2022-09-06 19:14:59 +08:00
DamonXue(Fibonacci) 4c8069dbaa
chore: upgrade CodeQL version to v2 (#1958) 2022-09-06 00:04:00 +08:00
Simon Cheung 5172f773a8
fix: args count of ACTION_CLEARED error (#1941) 2022-08-22 00:04:20 +08:00
Jermy Li 7274a5f67d
fix possible extra comma before where statement (#1924)
* fix: possible extra comma before where statement

add ',' before the next key construct & just skip thr first key

fix #1923
Change-Id: I095311942c3633a5978930e35fecd9fd47b08796
2022-07-19 11:25:30 +08:00
YangJiaqi 2f11ea530f
Fix start RpcServer NPE (#1921) 2022-07-09 17:32:45 +08:00
Jermy Li 6861f12662
support updateIfPresent/updateIfAbsent operation (#1897)
* support updateIfPresent/updateIfAbsent operation

Change-Id: I63f179e0b6c2e2f86e6ae185ce3a7115a4da7657

* implement for other backends

Change-Id: Iab9ab42ba0504664ce3320c8905b2d92d01d849a

* fix mysql/pgsql

Change-Id: I397fd5d300c563cd9298b76ab336bff78f2564ea

* call updateIfAbsent() for schema insert

Change-Id: I02989962791fa369600f8dedbfd56e2b40c79077

* add updateSchema() api for schema tx

Change-Id: I760db3c964f913d3c552c1d85193d9f3e0d401a4

* Do schema update in the lock block

Change-Id: I2daad8825939b04ff9b1374fff930ac9c4173f72

* fix '~task_status' not indexed in label '~task'

Change-Id: I6383df825a003ff0e3f619398ee7c2873194eb56
2022-07-06 19:50:30 +08:00
ZhangJian He 70cf9d0234
Bump grpc version to support build on apple m1 (#1914) 2022-07-04 19:44:41 +08:00
Jermy Li 1d4b834c59
fix: can't shutdown when starting with exception (#1902)
Change-Id: If312aa4368bfd7af540818bc299ed219f4e9f335
2022-07-04 17:43:59 +08:00
dependabot[bot] 4702cea415
build(deps): bump cassandra-all in /hugegraph-cassandra (#1910)
Bumps cassandra-all from 3.10 to 3.11.12.

---
updated-dependencies:
- dependency-name: org.apache.cassandra:cassandra-all
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-01 14:48:35 +08:00
Jermy Li a1055fe866
fix: Traversal.graph is empty in StepStrategy.apply() with `count().is(0)` (#1903) 2022-07-01 14:48:01 +08:00
Simon Cheung b54fba6bd1
chore: bump Dockerfile SERVER_VERSION to 0.12.0 (#1901) 2022-06-25 17:58:52 +08:00
jakevin 3328964ff6
Minor: add editorconfig (#1904) 2022-06-24 11:10:37 +08:00
dependabot[bot] 8afca00690
build(deps): bump mysql-connector-java in /hugegraph-mysql (#1905)
Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 5.1.45 to 8.0.28.
- [Release notes](https://github.com/mysql/mysql-connector-j/releases)
- [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES)
- [Commits](https://github.com/mysql/mysql-connector-j/compare/5.1.45...8.0.28)

---
updated-dependencies:
- dependency-name: mysql:mysql-connector-java
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-21 15:29:53 +08:00
seagle 09b18191ed
update checkstyle (#97)
Co-authored-by: yuanbingze <yuanbingze@yy.com>
Co-authored-by: imbajin <jin@apache.org>
2022-06-13 20:37:54 +08:00
dependabot[bot] dadbc7b59a
build(deps): bump protobuf-java from 3.3.0 to 3.16.1 (#1899)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-13 10:41:27 +08:00
seagle 98dc91efef
fix protobuf Checkstyle (#1881) 2022-06-08 19:17:07 +08:00
Jermy Li bc43e5e943
bump up rocksdb version to 6.22 (#1742)
* bump up rocksdb version to 6.22
* comment siged delete-range key test due to rocksdb issue #8239
* bump to rocksdb 7.2.2
* add memtable_whole_key_filtering option
* add index_type option

Change-Id: I357f0c2ced0c63d1e357b52f7397fb936255b411
2022-06-07 11:21:32 +08:00
imbajin 745bd861af
chore: use .asf.yaml for apache workflow rule (#98)
* add asf.yaml file

* Update .asf.yaml

* add required
2022-06-07 09:54:42 +08:00
zyxxoo 2af01bc92d
Add system schema store (#1891)
* Add meta table into system store
* Add system schema store
* Add test case for read version
* Let AbstractBackendStore impl default storedVersion()
* fix small bug og HugeProject
* add test for SystemSchemaStore
* fix initStore schema missed

Change-Id: I5c9d65c4ae022cb84592e8f2aa57bd7485cd12e4
Co-authored-by: liningrui <liningrui@baidu.com>
2022-06-02 16:42:46 +08:00
leo65535 b9266b2f23
fix: add build package to ignore file (#1894) 2022-06-01 17:31:04 +08:00
ShouJing 1118418585
fix: fix ProfileApi url check (#1893) 2022-05-28 13:52:31 +08:00
Jermy Li 4af14a9998
add Cnm and Anm to CollectionUtil (#101)
* add Cmn to CollectionUtil

Change-Id: I873e5c41229a8743ca5753d11c3b5e608b2e9298

* add Anm function

Change-Id: Idcb24ba80c61fb53c9744d7ab5d2a379e16a4ad3
2022-05-27 14:21:09 +08:00
Jermy Li 589ee2ca10
support assert-throws return future (#102)
Change-Id: I8fe115a7518dd84e22c9e28f777515e74e48d5d2
2022-05-27 14:19:10 +08:00
Simon Cheung 88d71e75b1
chore: replace `APPLICATION_JSON` with `TEXT_PLAIN` in dynamic create graph api (#1888) 2022-05-18 17:39:55 +08:00
wangyao 335f0ea4f0
feat: support swagger UI to viewing API (#1880)
implement #1879
Co-authored-by: Yao Wang <wangyao_yewu@cmss.chinamobile.com>
2022-05-16 20:19:00 +08:00
Linary 8609968e66
Improve some action for install snapshot and add peer (#1527)
1. Fix bug that relative path need normalize when load snapshot
2. Use zip decompresser since decompress tar file may lead dead loop
3. Move raft.group_peers from graph-config into rest-server-config
4. Pass raft.endpoint and raft.group_peers from server to core
5. Let RestServer start before GremlinServer
6. Use read-index to ensure the raft log caught up for new node
7. Let add_peer and remove_peer API work in async job
8. Use shared rpc server and delete raft.endpoint

Change-Id: I7de3d98cb51c3b7c32a4f19a0d99ed622f78d331
Co-authored-by: Zhangmei Li <lizhangmei@baidu.com>
2022-05-16 19:34:25 +08:00
YangJiaqi bb88c36976
fix checkstyle : CypherApiTest (#1877) 2022-05-13 17:00:10 +08:00
wangyao 239b06e8b0
improve allow role for drop graph (#1878)
Co-authored-by: Yao Wang <wangyao_yewu@cmss.chinamobile.com>
2022-05-13 16:59:43 +08:00
seagle 664eb260ce
fix checkstyle: delete unused import (#1874) 2022-05-13 16:58:51 +08:00
Jade Peng cd09304f39
feat: support query data by use cypher language (#1866)
implement #1748

Co-authored-by: jadepeng <jqpeng@iflytek.com>
2022-05-12 14:38:56 +08:00
wangyao 97694063c1
doc: update git repo for CONTRIBUTING.md (#1872)
Co-authored-by: Yao Wang <wangyao_yewu@cmss.chinamobile.com>
2022-05-12 12:34:07 +08:00
YangJiaqi 2d25938370
refact: move java class to test/java & fix test code check-style (#1842) 2022-05-12 12:29:21 +08:00
seagle d4304b635c
fix core-backend checkstyle issue (#1852) 2022-05-12 12:01:54 +08:00
seagle f6f8c3eda6
fix checkstyle core-util issue (#1855) 2022-05-11 15:34:17 +08:00
青年 f2bdedd43f
fix cassandra&rocksdb&scylladb code checkstyle (#1847) 2022-05-10 15:58:15 +08:00
imbajin 8d4b1eea8c
doc: update apache site link (#1867) 2022-05-09 19:31:52 +08:00
imbajin 58f08d5e58
chore: use .asf.yaml for apache workflow rule (#1839) 2022-05-09 17:46:59 +08:00
May cf767dc2d2
fix hugegraph-hbase and hugegraph-example checkstyle issue (#1864)
Co-authored-by: imbajin <17706099+imbajin@users.noreply.github.com>
2022-05-09 17:40:48 +08:00
seagle c128b4a25c
fix checkstyle equals and hashcode issue (#1856) 2022-05-07 19:47:00 +08:00
seagle 2e313e0a52
fix cmd module checkstyle issue (#1858) 2022-05-07 19:45:10 +08:00
seagle 6328b8d691
fix checkstyle of core-task issue (#1854) 2022-05-05 18:55:18 +08:00
seagle c9714df75c
fix checkstyle setting issue (#1857) 2022-05-05 16:29:09 +08:00
Jermy Li 044a15e569
cassandra metrics workaround: translate ipv4 to ipv6 (#1853)
* log cassandra probe host

* Translate IPv4 to IPv6 to fix issue #1843

* enable cassandra/scylladb metrics test case

* resume debug log
2022-04-29 14:53:28 +08:00
imbajin db84121d5d
refact: unify pom & remove useless file (#100) 2022-04-29 12:33:19 +08:00
Jermy Li deac513c43
improve Whitebox.setInternalState() (#99)
* add Whitebox.setInternalFinalState()

* delete Whitebox.setInternalFinalState() method since ineffective
2022-04-27 10:27:59 +08:00
seagle 0ed2e3b807
fix checkstyle IdHolder&AuthManager issue (#1846) 2022-04-26 17:05:53 +08:00
Fizell be7c0838a5
fix hugegraph-api code checkstyle (#1851) 2022-04-26 16:19:13 +08:00
seagle b991b6a13d
fix checkstyle for core/EntityManager (#1841) 2022-04-26 13:46:05 +08:00
seagle 44847756b4
improve ClassTypeParameterName check (#1850) 2022-04-25 22:43:56 +08:00
May 5b48b3b4ba
fix hugegraph-example/Example checkstyle issue (#1838)
Co-authored-by: imbajin <17706099+imbajin@users.noreply.github.com>
2022-04-25 22:39:54 +08:00
zyxxoo 85b01b2333
chore: java 11 version support (#1653) 2022-04-25 19:13:30 +08:00
Jermy Li e6a24fc6a4
fix cassandra metrics: Malformed IPv6 address at index (#1844)
* log cassandra probe host

Change-Id: Ida6b7f2675c86b6b241977075f0ef137a38fdd8d

* log error info

Change-Id: I18314c3b713304048e1570584ab81998c66366b3

* Translate IPv4 to IPv6 to fix issue #1843

Change-Id: I1e04122d9e0cd7cd5986e9b33b0fad74d22c1937

* remove '[]' from NodeProbe.fmtUrl

Change-Id: I1a8ef310227acfc00c023104c172779a5a511cbe

* log Patch NodeProbe.fmtUrl

Change-Id: I20291e6a00875f4287d2ae1960693cae354f4f38

* revert setFinalInternalState() since ineffective

Change-Id: I5627e9af13f89e0593ffed320f213c8b5b330735

* disable cassandra/scylladb metrics test case as workaround

Change-Id: I35b6f99468cfbb1ecc0dc066fbc8f1f95498a3da
2022-04-25 14:31:29 +08:00
Jermy Li 9a8259ef3f
fix schema label: addIndexLabel/removeIndexLabel race condition (#1807) 2022-04-21 18:59:56 +08:00
Jermy Li 7d46524b1c
improve raft module (#1802) 2022-04-21 18:41:44 +08:00
Jermy Li 8d52abb2a0
HugeGraph-622: Bump up to version 0.13.0 (#1740) 2022-04-21 14:15:46 +08:00
imbajin 28ed873360
doc: add repository urls for other modules (#1831) 2022-04-20 23:45:26 +08:00
imbajin d85ee50d5f
chore: replace mysql actions by official docker image (#1834)
* chore: replace mysql actions by official docker image

* update codecov v3

* move traivis file
2022-04-20 22:41:05 +08:00
Jermy Li 1f5d502e0e
fix: query by within + Text.contains (#1803)
fix #1794
2022-04-19 19:11:58 +08:00
Jermy Li 74c0e2dc8a
BackendEntry.columns() var-arg to single-arg avoid array-construct (#1787) 2022-04-18 14:35:22 +08:00
Jermy Li 9ec3c3c66c
CONTRIBUTING.md: correct how to sign the CLA (#1819)
* correct how to sign the CLA
2022-04-18 13:49:17 +08:00
Jermy Li 345c4c3101
StringEncoding: improve empty bytes decode (#1788) 2022-04-16 12:24:23 +08:00
seagle c904dcbbbd
chore: add check-style plugin (#1810)
Co-authored-by: yuanbingze <yuanbingze@yy.com>
2022-04-16 12:22:55 +08:00
Jermy Li 7438511faf
CONTRIBUTING.md: add how to create a GitHub token (#1820) 2022-04-16 12:21:11 +08:00
May c3c9f2a8b8
remove unused import (#1821) 2022-04-16 12:05:39 +08:00
青年 ad24359417
fix apache license conflicts: jnr-posix and jboss-logging (#1822)
fix apache license conflicts:

- jnr-posix (LGPL+GPL): cassandra-driver-core
- jboss-logging (LGPL): cassandra-all

fix #1632
2022-04-16 11:47:34 +08:00
Jermy Li 734d55436e
cache: fix assert node.next==empty (#1790) 2022-04-15 16:52:46 +08:00
Jermy Li 73a1f1f8e5
add contribution flowchart (#1791) 2022-04-15 11:12:49 +08:00
wuchaojing 0a3599db5d
Bugfix/export ConditionP (#1813)
fix #1812
2022-04-12 16:38:28 +08:00
zyxxoo f2e838443d
version 2.1.2 (#96) 2022-04-11 16:11:14 +08:00
zyxxoo d778eb1383
Fix close exception and server-info EXPIRED_INTERVAL (#1804) 2022-04-07 12:57:50 +08:00
imbajin 4a2c2d28e9
chore: support codeQL code security check (#1778) 2022-04-07 12:19:50 +08:00
Simon 7acd4fc0e4
Add `graphs.enable_dynamic_create_drop` option (#1809) 2022-04-06 17:46:42 +08:00
YangJiaqi 035a03e1df
feat(hbase): support hash rowkey struct & pre-init tables (#1696) 2022-04-06 17:17:49 +08:00
izliang ed1d6f88e1
fix: run g.V() is error when backend is MYSQL (#1801) 2022-04-06 17:10:45 +08:00
Josh Soref 0cc02e47b0
Proposal tweaks (#1797) 2022-03-30 17:30:52 +08:00
Josh Soref 5368f3205e
Spelling corrections (#1798)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-03-30 17:12:18 +08:00
zyxxoo d0e5971c7e
fix: can't delete conf file when drop graph (#93) 2022-03-21 19:47:40 +08:00
imbajin b591f7d8b3
refact: fix some bugs & clean code (#1741)
* feat(api): Support adamic-adar & resource-allocation algorithms

* split into 2 class

* enhance a string of code logic

* keep NO_LIMIT now

* Update EdgeStep.java

Co-authored-by: imbajin <imbajin@users.noreply.github.com>
2022-03-21 17:26:38 +08:00
imbajin 88d2f897ed
chore: support code security check with codeQL (#94) 2022-03-21 17:24:35 +08:00
zyxxoo 91f1cec07d
feat: add ingore security check api (#1784) 2022-03-21 14:32:57 +08:00
coderzc 14eb6cbfeb
fix release ci (#1770) 2022-03-21 13:54:47 +08:00
imbajin 0ca54c4097
feat(api): support adamic-adar & resource-allocation algorithms (#1763) 2022-03-18 12:07:31 +08:00
AisinGiorro 58b3ebe589
fix(core): edge cache not clear when update or delete associated vertex (#1780)
* Fix the bug when vertex updated, but the edge cache associated with that vertex
   was not updated. Here we simply clear all edge cache when  any vertex changes.
* Add two test case for the fixing

fix #1779
2022-03-14 16:07:55 +08:00
imbajin 856dc0d0ad
chore: use cla assistant to support robot pr (#1761) 2022-03-14 14:41:46 +08:00
Jermy Li 5bb860f2d2
Fix unexpected task status (#1767)
* fix unexpected task status

* fix task-manager become single-node mode due to server-info is missing

* fix don't auto save server-info on master node

* fix: create index label task
2022-03-11 17:40:15 +08:00
zhoney 6856cc21b0
fix edge batch update error (#1776)
Change-Id: I8742ca0e128e3c9bc3eb2ef99a52276045e17b79
2022-03-10 12:08:40 +08:00
imbajin 730f33263d
Update stale.yml (#1772)
Co-authored-by: imbajin <imbajin@users.noreply.github.com>
2022-03-07 12:18:09 +08:00
imbajin 05fe7a4c92
chore: use cla assistant to support robot pr (#92)
Co-authored-by: imbajin <imbajin@users.noreply.github.com>
2022-03-03 19:27:08 +08:00
Jermy Li 5cdf77043a
set timeout of raft api test to 60s (#1738)
* set timeout of raft api test to 60s
* improve test error log
* improve error message "Failed to list indexlabels"

Change-Id: Ifa93e46992e79cc9b0adc93ad529b72169ec7a7f
2022-02-21 15:58:29 +08:00
Jermy Li 88c7abdbb1
improve the submission process of further changes (#1757) 2022-02-21 15:56:34 +08:00
vincentshu 9eb55e58be
fix(core): gremlin tree() step has different result in v0.12 (#1755)
fix #1745
2022-02-17 21:07:50 +08:00
Jermy Li 72baa123b1
improve CachedGraphTransaction perf (#1743)
Change-Id: I9f60f68d2faedb099e89adc2b1c1f4948d177a40
2022-02-15 13:55:26 +08:00
Jermy Li 5c51a69ded
split unit/core/api tests into 3 stages (#1747) 2022-02-10 14:16:46 +08:00
Jermy Li cadeade476
fix: can't query edges by multi labels + properties (#1737)
* fix: can't query edges by multi labels + properties

fix: #1735 #1736
Change-Id: I28e3a209074abaab8c8271775679d54845e6e785
2022-01-21 17:25:50 +08:00
zyxxoo 848b8fb178
exclude log4j 1.x version (#1733) 2022-01-18 17:18:54 +08:00
zyxxoo 4b21e94ad2
chore: support java 11 (#83)
* chore: support java 17

* fix: unitest

* fix: server JAX-B API not found warning

* chore: improve code

* fix: hugeconfig test

* chore: resolve conflict

* fix: version unit test

* chore: improve code

* chore: improve impl version

* chore: improve code

* refactor: hugeconfig get

* chore: improve code
2022-01-14 10:55:34 +08:00
imbajin 1e83e37c01
doc: add logo picture for README (#1731)
also make subtitle clearly
2022-01-13 20:20:01 +08:00
imbajin e9cef7425d
fix: useless ring detection removed valid path (#1723)
* remove useless ring detection due to it will remove valid path
* limit max depth to 5000 to avoid stackoverflow
2022-01-12 20:08:59 +08:00
Jermy Li ace60537d0
improve raft module and test (#1721)
* improve raft moddule
* add raft-server test
* set safe_read=true and use_snapshot=false
* fix leader not wait for apply-task
* add auth support to raft-tools.sh
* don't clear non-shared-storage backend
* set task timer interval from 3s to 1s
* improve CachedSchemaTransaction
* improve update schema status
* remove truncate from project test
* fix codecov: api test report not been uploaded
* improve task cancel() test with cancelled status

Change-Id: I016d3fcc4ab50614afdf452e7c9691ee3cc3c70b
2022-01-12 16:00:58 +08:00
dependabot[bot] ee905d6598
Bump log4j-api from 2.17.0 to 2.17.1 (#1724)
Bumps log4j-api from 2.17.0 to 2.17.1.

---
updated-dependencies:
- dependency-name: org.apache.logging.log4j:log4j-api
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-12 14:11:50 +08:00
Jermy Li 60672b2fcc
enhance schema job module (#1729)
Change-Id: I32938d4a5ed595ceb0f2dc02eb7ee75141f4133a
2022-01-12 14:07:07 +08:00
Jermy Li 6924f36346
support hot set trace through /exception/trace API (#1727)
Change-Id: I78bbff56420be0a7c99dfc461913ed45d66725fc
2022-01-12 14:05:33 +08:00
Jermy Li 132582af6f
fix NoSuchMethodError Relations() (#1720)
Change-Id: I25b50a8d529d0292d700aaac0f63b4722a99160f
2021-12-31 20:07:43 +08:00
zhoney f19acccbf1
upgrade rpc and common version to 2.0.1 (#1719)
Change-Id: If90b56013b04f1e72de18dcd733471ef42955f98
2021-12-31 20:07:07 +08:00
Jermy Li d695bd494d
fix some test cases naming (#90)
Change-Id: I89eaf2b7ff13e6909e057970542fff60ab552785
2021-12-21 20:59:44 +08:00
zhoney 922a4f6334
upgrade log4j to version 2.17.0 (#89) 2021-12-21 17:51:38 +08:00
coderzc 8f0f2ba012
release maven package by actions (#88) 2021-12-21 14:12:35 +08:00
zhoney 4a1926fe40
improve java doc (#87) 2021-12-17 17:43:29 +08:00
Jermy Li fbb743afeb
bump up version to 2.0.0 (#86)
* refactor license module

Change-Id: Ia4041f88994490c1bc0519e0f8ff01d27577bafb
2021-12-17 10:57:40 +08:00
zhoney 3b8933c3d3
fix log4j error (#85) 2021-12-15 20:30:27 +08:00
Jermy Li f5383d5541
Merge pull request #84 (merge rpc module into commons)
refact(rpc): merge rpc module into commons
2021-12-07 16:26:18 +08:00
imbajin ee08712120 chore: new pom & README for module 2021-12-07 14:38:05 +08:00
imbajin 24c3390379 chore: merge license & checkstyle & ci
1. root pom.xml, license, checkstyle, ci,
2021-12-01 20:38:09 +08:00
imbajin 0789b1c8c1 merge rpc module into commons 2021-11-30 15:48:37 +08:00
imbajin c572c2bedd first rename 2021-11-30 15:29:35 +08:00
guoygang 1d27452994
add bearer token support (#81) 2021-11-02 19:43:38 +08:00
imbajin 53c6503cde
chore: update ubuntu version for ci actions (#79) 2021-10-09 11:40:54 +08:00
coderzc 3881b86697
fix: unable to close the rpc thread pool at destroy (#3) 2021-07-28 11:23:55 +08:00
imbajin 49e8599d8f
chore: add issue template & auto stale issues and pr (#78) 2021-07-02 16:35:24 +08:00
ShouJing 535ae072f4
add Auth Context to store request header(Authorization) (#76) 2021-06-24 16:00:29 +08:00
Linary efa8e97c4f
chore: use github action to run ci (#77) 2021-06-23 16:57:12 +08:00
dependabot[bot] 9101842200
Bump jackson.version from 2.10.2 to 2.12.1 (#63)
Bumps `jackson.version` from 2.10.2 to 2.12.1.

Updates `jackson-annotations` from 2.10.2 to 2.12.1
- [Release notes](https://github.com/FasterXML/jackson/releases)
- [Commits](https://github.com/FasterXML/jackson/commits)

Updates `jackson-core` from 2.10.2 to 2.12.1
- [Release notes](https://github.com/FasterXML/jackson-core/releases)
- [Commits](https://github.com/FasterXML/jackson-core/compare/jackson-core-2.10.2...jackson-core-2.12.1)

Updates `jackson-databind` from 2.10.2 to 2.12.1
- [Release notes](https://github.com/FasterXML/jackson/releases)
- [Commits](https://github.com/FasterXML/jackson/commits)

Updates `jackson-module-jaxb-annotations` from 2.10.2 to 2.12.1
- [Release notes](https://github.com/FasterXML/jackson-modules-base/releases)
- [Commits](https://github.com/FasterXML/jackson-modules-base/compare/jackson-modules-base-2.10.2...jackson-modules-base-2.12.1)

Updates `jackson-jaxrs-base` from 2.10.2 to 2.12.1
- [Release notes](https://github.com/FasterXML/jackson-jaxrs-providers/releases)
- [Commits](https://github.com/FasterXML/jackson-jaxrs-providers/compare/jackson-jaxrs-providers-2.10.2...jackson-jaxrs-providers-2.12.1)

Updates `jackson-jaxrs-json-provider` from 2.10.2 to 2.12.1

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-03 16:06:27 +08:00
dependabot[bot] 27dfd9d5a2
Bump commons-io from 2.4 to 2.7 (#75)
Bumps commons-io from 2.4 to 2.7.

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-03 15:50:56 +08:00
houzhizhen 74b954acf2
disable delimiter parsing when construct from MapConfiguration (#74) 2021-04-26 16:16:31 +08:00
Linary f72fac400f
Improve some license params (#73) 2021-04-16 14:58:22 +08:00
Linary 185a926a94
Fix senstive mail address (#71) 2021-04-15 18:05:21 +08:00
shzcore aecaf4e86a
remove inner hostname from cacerts.jks (#72) 2021-04-15 16:54:02 +08:00
Jermy Li fe190141cc
improve profile performance (#69)
* improve profile performance
* support profile nested class
* support total_wasted time
* calculate totalChildrenWasted time for echarts
* only profile super class in the same package
* improve perf through local-tree,local-timer,local-stack
* improve test case
* add Stopwatch remove-child test
* fix can't profile parent class with 2 class not in the same package
* add totalChildrenTimes
* improve LocalTimer perf
* add PerfUtil.useLightStopwatch(true)
* define behavior of switching light-stopwatch process
* ignore other threads if profileSingleThread(true) with multi-threads
* improve the empty judgment the first call in useLightStopwatch()

Change-Id: Id1ae075ddffec77b95b31142d7ebcdae87371943
2021-04-13 14:53:42 +08:00
Jermy Li d51efb6120
add some test cases for util package (#70)
* add check for CollectionUtil.subSet from > to

Change-Id: I32d83f5738250eca23ae16c2ccbf52059a874bf6
2021-04-12 16:28:18 +08:00
Jermy Li 6c800388a1
support random port to start rpc server (#2)
* add rpc.server_adaptive_port option
* use bolt v1.6.2 instead of v1.5.6 to get RemotingServer.port()
2021-03-25 14:06:05 +08:00
Jermy Li 159143c04d
add rpc framework based on sofa-rpc (#1)
* add rpc framework based on sofa-rpc
* allowed to start server or client separately
* add destroy() method for rpc client
* complete the supplement of test cases
* remove sleep in destroy-server and improve comments of test block
* add fanout exception test case
* travis use oraclejdk8
* fix log4j config and remove test/resources from pom to avoid including log4j2.xml in tar

Co-authored-by: Jermy Li <lizhangmei@baidu.com>
Co-authored-by: xuliguov5 <xuliguo@baidu.com>
2021-03-23 18:59:43 +08:00
Linary 265f74bb5f
Add checkstyle plugin (#67) 2021-03-19 21:21:25 +08:00
Jermy Li 98844d8c2a
add UnitUtil class (#66)
* upgrede version to 1.8.6

Change-Id: I67c7b38979b2c0603878d48929247ec0282d10d9
2021-03-19 20:44:46 +08:00
liningrui 3914813fb8 Add checkstyle plugin 2021-03-17 15:21:59 +08:00
liningrui 1114e94924 First commit 2021-03-16 18:56:15 +08:00
Linary 42e5260ba5
Add Class.class as an accept data type in TypedOption (#65) 2021-03-07 16:42:38 +08:00
Jermy Li ccc4d3bd6a
add LimitIterator class (#62)
* bump up version 1.8.4

Change-Id: I5d150e0c30f83200880cf8dd95e6e4b3678137b0
2021-03-01 21:46:06 +08:00
Jermy Li cde7763cc2
fix BatchMapperIterator stopped when fetched none in the middle batch (#64)
Change-Id: I658d8e95a68c8a9494efa98e88f350cf6d65b021
2021-02-25 20:05:39 +08:00
Linary c80f959579
Implement PausableScheduledThreadPool (#61) 2021-02-03 22:03:37 +08:00
houzhizhen f4e861b3a8
add BarrierEvent (#60) 2021-01-11 18:01:35 +08:00
Linary 37de7be0ee
Improve SafeDateFormat by joda DateTimeFormatter (#59)
Fix #58
2020-12-14 15:14:50 +08:00
zhoney 9962e0c9c9
fix https+auth bug (#57)
Change-Id: Ic791c21271c9c9ca60b0ff4294feb5fe2165452a
2020-11-17 17:19:23 +08:00
Linary 2d4a8eebf8
Upgrade version to 1.8.0 for release (#55) 2020-11-05 17:35:59 +08:00
Jermy Li 630e19f8bc
fix LockManager get/create race condition (#53)
* fix LockManager get/create race condition

Change-Id: I524a2d4d13a99f3943bfa0e4a44aa0ccf9c573a1

* add unit test

Change-Id: I17abf10b3c4e7f41fdd82ce9a9423b9ffc5a07fd

* fix not clear test license

Change-Id: I41f463a7e42a9b205c251ebc906cc850cdd4b7af
2020-07-24 08:50:03 +08:00
dependabot[bot] 9f329f5f3a
Bump log4j2.version from 2.8.2 to 2.13.3 (#52)
Bumps `log4j2.version` from 2.8.2 to 2.13.3.

Updates `log4j-api` from 2.8.2 to 2.13.3

Updates `log4j-core` from 2.8.2 to 2.13.3

Updates `log4j-slf4j-impl` from 2.8.2 to 2.13.3

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-02 12:05:58 +08:00
Linary 544599e316
Fix HugeConfig save to file is empty (#51) 2020-07-01 20:53:47 +08:00
Jermy Li b4fb1f7443
refactor RestClient as interface (#49)
Change-Id: Ib7153dc7b8d3bf3df9d19662b54cb05ff14c032b
2020-06-19 20:07:27 +08:00
zhoney 034e1a2513
Add dateutil (#48)
Change-Id: I783d4ba2af19114dafd921c4468d4dbb640964c1
2020-06-15 14:01:07 +08:00
shzcore c2c5ba4689
add https support (#47) 2020-06-11 21:46:38 +08:00
Jermy Li 0d90ae4331
add encodeSignedB64() method (#46)
Change-Id: I771dfaeb923b6f13c14ec1a66df6142eaf2e42ae
2020-03-19 16:06:19 +08:00
Linary fffccf1b2f
Upgrade jackson version to 2.10.2 (#45) 2020-02-23 20:37:09 +08:00
Linary 0a71d120f9
Add nodes and data size to extra param (#44) 2020-02-04 17:45:01 +08:00
Jermy Li 4bd64ce8b5 fix iterators may not be closed (#43)
Change-Id: I3709d96fd2114fa782d6f28f8853b32d65fbd22b
2020-01-08 15:13:38 +08:00
Jermy Li 24b8a33e9c support assert range conditions (#41)
add methods to Assert class:
  assertGt()
  assertGte()
  assertLt()
  assertLte()
  assertContains()

Change-Id: If4c5df19c937a8bb06fcdd60122ac54ab04f501b
2020-01-01 01:17:03 +08:00
Jermy Li 8268b755ef add generic parameter for RowLock (#42)
Change-Id: I309b89846ca15d58ea39095d406a0b0b5de510e7
2019-12-31 15:06:33 +08:00
Jermy Li d78b728aa2 Split ConfigOption read into two steps: parse() and convert() (#40)
also fix ConfigConvOption/ConfigListConvOption read bug

fix: github.com/hugegraph/hugegraph/issues/774
Change-Id: I716c9f187128be9b0d173f152da05e5bdc2208a3
2019-12-31 14:17:25 +08:00
zhoney 49bff5eadc Support RowLock in LockGroup (#39)
Change-Id: Ic25b7d81b5dd5ddc9d85b057e5f00a00763460c7
2019-10-11 20:07:27 +08:00
zhoney 4eda6313eb Support keyLock in LockGroup (#38)
Change-Id: I43360da8b4c701bf02d635a7270af96a433ca5c7
2019-09-25 21:17:19 +08:00
Linary 0ff4b0e234
Extract license common structures (#36) 2019-09-06 10:14:23 +08:00
Jermy Li 41bc25ce85 support calling superclass method for Whitebox.invoke() (#37)
Change-Id: I36b460d1a95b4f063ccd329d2058e4e80ebb71c0
2019-09-05 14:41:19 +08:00
Jermy Li f8e65f83bd add Bytes.toHex() method (#35)
Change-Id: I613cf44728b347634bda726c3376a6fe1f4d4b2f
2019-08-15 17:20:24 +08:00
zhoney cc463411ea improve LongEncoding.decodeSortable() (#34)
Change-Id: I7962ffe9f55a2ef33752a414262e89d5a7918cc1
2019-07-22 11:17:53 +08:00
Jermy Li 0436a14591 add methods Bytes.contains() & Bytes.indexOf() (#33)
Change-Id: I2ddca3eb233a9f9f9610850ceff3a7fadd1bb784
2019-07-17 21:46:50 +08:00
Linary ce75fb96e0 Enhance split in StringUtil (#32) 2019-07-09 21:12:56 +08:00
Linary 88d8838209 Support show time in readable format (#31) 2019-07-01 17:39:53 +08:00
zhoney b525aef026 add maxValueOf() for NumericUtil (#30)
Change-Id: Ie34be6a9aa187691b004391f956891b8c55554fb
2019-06-26 17:56:27 +08:00
Linary 85a6b7e24d Enhance ExecutorUtil to create ScheduledThreadPool (#29) 2019-06-24 15:18:21 +08:00
Jermy Li 48a39fcef8 improve exception message for InvocationTargetException (#28)
Change-Id: Id2bb1d4b90d1f091f4949d7ba4cb6d7df9efb8b0
2019-06-24 15:07:56 +08:00
Jermy Li 2f453c0af9 support typed option (#27)
Change-Id: I845d3e0f59b3de4eb086a57f206a02fae0aae549
2019-06-17 15:13:07 +08:00
Linary 64bd1543e8 RestClient support to close idle connection periodically (#26) 2019-06-11 18:43:20 +08:00
Linary 1a66a60897 Enhance toList and add toSet in CollectionUtil (#25) 2019-05-29 20:07:59 +08:00
Jermy Li 0822dd93f6 let subclass of ConfigOption be able to override parent options (#24)
also implement ConfigOption.toString()

Change-Id: I1f1fd5eeaa80252fc093e7cba5af525a32a23c99
2019-05-28 16:40:43 +08:00
Jermy Li 5ea077f13e add support of sortable negative number for NumericUtil (#23)
Change-Id: I93290d3c1f9f89913d31ec2e5b4293d4a1d1ce1f
2019-05-21 12:06:42 +08:00
Jermy Li 194ed53b85 add Whitebox.invoke() method (#22)
Change-Id: If246e9193a4c61621c942f4b88a703c28c9d2846
2019-05-07 14:35:33 +08:00
liningrui 1eb2414134 Add OrderLimitMap
Change-Id: I66956a0098373a9e8999a335c1d158b6aa482bb6
2019-04-17 19:26:42 +08:00
liningrui 87c5826480 Let RestClient can reuse connections
Implement #14

Change-Id: I49c0675566145e233e40f25fe0c30c9614bf2c14
2019-04-17 19:25:35 +08:00
Zhangmei Li 306b4f1829 fix NPE in EventHub.destroy()
fix: #18
Change-Id: I30f12a583c8168045a2b240995c5277b0efbaa4c
2019-04-08 16:17:59 +08:00
Zhangmei Li 95530cc4b3 add PerfUtil.clear()/Bytes.concat()/CollectionUtil.randomSet()
also add some unit tests: HugeConfigTest, PerfUtilTest,
NumericUtilTest, ReflectionUtilTest and TimeUtilTest.

Change-Id: Ida64154a0bdee62e281585836c5e7ccfc6061c06
2019-03-01 20:02:21 +08:00
zhangyi51 5bac575b29 Set origin iterator last one if all iterators of extendable iterator are empty
implemented: #360

Change-Id: I5586ea3626816c085af788830917759f653ed0c4
2019-02-28 21:54:48 +08:00
Zhangmei Li 5f6012cbe4 Support for sortable base64 encoding
implement #11

Change-Id: I39b8f26d025e095d9d654f655657df6d6dc2543f
2018-12-25 19:56:32 +08:00
liningrui bbbc8e70f5 Add CollectionUtil.sortByValue()
Change-Id: I9152cc7d8fc5a23e3407118ed09c9b6ac116eed9
2018-12-25 16:09:44 +08:00
liningrui 6f20cb8bdc Fix dependency conflict "InjectionManagerFactory not found"
Fix #9

Change-Id: I83f2074c431994f72a62e37ab4a6086c3142a1b5
2018-12-24 15:19:33 +08:00
liningrui 476bb78315 Add CollectionUtilTest to UnitTestSuite
Change-Id: I36f632f0e0b8e6680d4fe16b30cf54e87ef01780
2018-12-17 17:17:26 +08:00
Zhangmei Li 146e4bc362 add api for setting thread pool name
Change-Id: I93aeddc6783e6b03d2aa31aa8ca42059e253ba81
2018-10-23 10:39:25 +08:00
zhangyi51 904f4260b9 README improve
Change-Id: I4550093fb02a0156bc353ef33eaad97f3e63fb12
2018-10-15 10:20:42 +08:00
liningrui 16fbcb354d Optimize intersect action
improve #2

Change-Id: I9c4daeaf812ffdae84a83b2bc94bb114461bda45
2018-10-11 22:33:40 +08:00
Zhangmei Li 591d3f3834 HugeGraph-1399: let EventHub.notify() return Future to sync
Change-Id: If7412da120c9652946a9aff41b0df5571fac3145
2018-10-10 09:46:11 +08:00
zhangyi51 07793f9971 HugeGraph-622: Bump up to version 1.5.0
Change-Id: Id1a905adf907370a5e8c30ba0ae7a8327c519daf
2018-08-09 09:56:11 +08:00
zhangyi51 1c7c839d45 hugegraph-1364 add LICENSE for hugegraph-common
Change-Id: I1e494152aeef3c4ff2bd9a09aeb3ab64303eec29
2018-08-09 09:56:11 +08:00
liningrui a4121451ce HugeGraph-1349: Add some badges(licence, build, coverage and maven) in README
Change-Id: I4d8498adbcf4289ecc897ffe629080cd524d5004
2018-08-09 09:56:11 +08:00
zhangyi51 553cd60b8f hugegraph-889 add ACCEPTED to POST, PUT and DELETE for async
Change-Id: If0acdc33acb4ac1e50295d920e0b77b35d11b12f
2018-08-09 09:56:10 +08:00
liningrui 1db56cfd86 HugeGraph-1341: Upgrade version to 1.4.8(1.4.7 failed deploying to maven respority)
Change-Id: I7fedf79f96607a3e07cceba4bfa263ce56f36f71
2018-08-09 09:56:10 +08:00
Zhangmei Li 9db431015a HugeGraph-1336: move common tests from hugegraph-test to hugegraph-common
Change-Id: Id6698c6fa83a0a9338e6dba02180bd8ce0e73c4d
2018-08-09 09:56:10 +08:00
zhangyi51 eed956d931 hugegraph-81 add github link to README
Change-Id: I16f47975372a5cb88b3890407a6e9d5fd79e19f9
2018-08-09 09:56:10 +08:00
liningrui 50c7738056 HugeGraph-1312: Add config to deploy to sonatype maven respority
Change-Id: I981ecc2486b8091b6c1b039d79da9c05ee3aaa14
2018-08-09 09:56:10 +08:00
Zhangmei Li 92ad62a9fb HugeGraph-1330: add support for 128bits hash
Change-Id: I51b46d3a88e472757e4ca45e73e7d6011150ef2f
2018-08-09 09:56:09 +08:00
liningrui 4aae65cd4d HugeGraph-81: Small optimization of package structure
Change-Id: I84109719a0064ea0d53c26843fbe435b84655912
2018-08-09 09:56:09 +08:00
Zhangmei Li 8c76d5b0cf HugeGraph-1309: add remove() support to WrappedIterator
Change-Id: Iec68a94fed485852af8d1c838630a108794aac99
2018-08-09 09:56:09 +08:00
liningrui daa967d74d HugeGraph-1301: Move SafeDateFormat class to hugegraph-common module
Change-Id: I8bc07f5b01b400d48393a1dc744c1de2853e392f
2018-08-09 09:56:09 +08:00
liningrui 544b94c919 HugeGraph-1257: Let jersey client use preemptive credentials
Change-Id: Ica97e912e905c0c7ee1353e603651794408564d1
2018-08-09 09:56:09 +08:00
zhangyi51 140cf845b5 hugegraph-1234 add subset util
Change-Id: I1f7a0f5b989191459ae3409d1aeaeaefe2c10c92
2018-08-09 09:56:09 +08:00
Zhangmei Li 9346717bde HugeGraph-1236: add getMap() to HugeConfig
Change-Id: I46d3ea398246e771936a3f4c75adbcdd31d7ad98
2018-08-09 09:56:08 +08:00
liningrui d6d92e4896 HugeGraph-1229: add README.md for project hugegraph-common
Change-Id: Ic881b001c08e47e1fa6ead49ca064ecefd215691
2018-08-09 09:56:08 +08:00
liningrui aa222c4893 HugeGraph-1229: add README.md for project hugegraph-common
Change-Id: Ic1d328b03a1d7eb91d76af615d4146d3f175ef79
2018-08-09 09:56:08 +08:00
liningrui c2db8f55d6 HugeGraph-81: Fixed bug that message and cause placed error
Change-Id: Ic408f158cd814edcd5edffc21bc09ba347da9a8f
2018-08-09 09:56:08 +08:00
Liu Jie 887a4d5a9a HugeGraph-1196: Fix grammer at exits method
Change-Id: Iad9cc2b819684140a0a4509dd6c3331b4dcf86b8
2018-08-09 09:56:08 +08:00
liningrui 5183fb054a HugeGraph-1208: Move compareNumber() from core to common module
Change-Id: I426651f98c7645ccdfc20f04310769eacb6d442a
2018-08-09 09:56:08 +08:00
Liu Jie 1bf8d9e4c0 HugeGraph-1191: rewrite exception handling mechanism at register method
Change-Id: I041f1792f2a4806e73d2ebb93a2b019d9ad73b0b
2018-08-09 09:56:08 +08:00
Zhangmei Li 56a60dca53 HugeGraph-1190: add OptionSpace.keys() method
Change-Id: If43dbfce1926fea95ca99c63b0d5c5531bcd639c
2018-08-09 09:56:07 +08:00
liningrui 12c65918b3 HugeGraph-1183: Add common RestClient for server and client
Change-Id: Iec3c1d11bb57b913f5837af42050bb5b8b8c3705
2018-08-09 09:56:07 +08:00
liningrui cb33bbd436 HugeGraph-1174: Let config reload if some options contains comma
Change-Id: I1e6dd2124aa9f9c3d1a52160b58cbad90cd0c941
2018-08-09 09:56:07 +08:00
liningrui 154e03054e HugeGraph-1171: Modify the way for config options registration
Change-Id: I99a7dec4ac72ee5afa5ed9945fd27a9f536b57cd
2018-08-09 09:56:07 +08:00
Zhangmei Li 8d8333980c HugeGraph-1158: awllow empty Iterator add to ExtendableIterator
Change-Id: Ieabd7a243105c6875fe9adbcebb466daa73ff427
2018-08-09 09:56:07 +08:00
Zhangmei Li fde9c72a0f HugeGraph-1110: let iterators implement AutoCloseable and Metadatable
Change-Id: I5c5f0fe6cafd0dfdc33404613a071927332c6211
2018-08-09 09:56:07 +08:00
Zhangmei Li 749a2d9d1f HugeGraph-1097: fix check error when HugeConfig(Configuration config) with list options
Change-Id: I7a3d0c6a017513368717bed4b32f4501bc2a9049
2018-08-09 09:56:06 +08:00
Zhangmei Li 2ae8e1571b HugeGraph-1097: fix missing check for duplicated options
Change-Id: I542998a0024d83706b0d8c485b4ec8ef40fd310f
2018-08-09 09:56:06 +08:00
Zhangmei Li 8219a10e74 HugeGraph-1075: add allowValues() to OptionChecker
Change-Id: I7752b039c3d8332550e4daf9852bdf7f7610d161
2018-08-09 09:56:06 +08:00
Zhangmei Li 9f994b33de HugeGraph-1000: allow non-check of config options
Change-Id: Ida0a2d88818f0ca53e9ddf886cff88e7ceb52ed8
2018-08-09 09:56:06 +08:00
Zhangmei Li fe8b51d072 HugeGraph-976: add filter-iterator
Change-Id: I8291be7576b0fd1536cc5425c09e26dfda5c4ff0
2018-08-09 09:56:06 +08:00
liningrui 24ff820174 HugeGraph-994: Fixed bug that some key has more than one value will throw an assert exception
Change-Id: I72301a594afe311a6d744514fb8791ec6d6fc954
2018-08-09 09:56:06 +08:00
liningrui 8a44989e32 HugeGraph-990: Fixed bug that compile error when building project
Change-Id: I398165b3b022e55290781b366e2d008f516dfb46
2018-08-09 09:56:06 +08:00
Zhangmei Li 7789bc87d8 HugeGraph-989: add toHex()/fromHex() to class Bytes
Change-Id: I3ef03ea58cdf2fe379e1dbf5b3e0877b4c379745
2018-08-09 09:56:05 +08:00
liningrui 65032356e9 HugeGraph-986: Let prefixOf support generic type
Change-Id: I7f02d3c3556ae6ae9f63888af7f33fe52e505862
2018-08-09 09:56:05 +08:00
liningrui 1804fa7ee1 HugeGraph-984: Fixed bug that multi graphs has same name config option will be overrided
Change-Id: Ia35570b52e00407de7e29e6e38aaf55a88f72c7a
2018-08-09 09:56:05 +08:00
Zhangmei Li 3d3da162de HugeGraph-978: add prefixWith() for bytes
Change-Id: I17a493ef0097f9208f4cfa3aad8bbd159283f4bb
2018-08-09 09:56:05 +08:00
Zhangmei Li b01f3a35df HugeGraph-975: support conversion: number <==> bytes
Change-Id: I8da23ab89f0e3eda99ec744904dd7ef06571a8e2
2018-08-09 09:56:05 +08:00
liningrui 094f8bb56b HugeGraph-935: Add a method 'allUnique'
Change-Id: Iebbcb8acb90844e82ae8e70b559a600543aaf6d8
2018-08-09 09:56:05 +08:00
zhangyi51 d8d4b3eba5 hugegraph-911 add prefixOf method into CollectionUtil
Change-Id: Ia917fc5ec5492547dee6b0477d9c3f947cddb71f
2018-08-09 09:56:04 +08:00
liningrui 5e003a7f2f HugeGraph-830: Catch IOException if create new socket connection failed. Note that, we should try to avoid catch Throwable since it not only catch all exceptions but also catch errors.
Change-Id: I72ae39058d737b1bbbeb70f4f05737fe95ed4ffc
2018-08-09 09:56:04 +08:00
Zhangmei Li 5195740642 HugeGraph-762: add isSimpleType() method to class ReflectionUtil
Change-Id: I7372c982dda9241d3d7d7b688d37d0403268e173
2018-08-09 09:56:04 +08:00
Zhangmei Li 12c53cc17b fix EventHub bugs: HugeGraph-732 and HugeGraph-733
Change-Id: I9395193680b986e543a0af3c08ce434b2b0e329c
2018-08-09 09:56:04 +08:00
Zhangmei Li 4d6c421358 HugeGraph-726: add toList(array) method into class CollectionUtil
Change-Id: Ia8a06f002e66f11935986284f587563ebc0c2257
2018-08-09 09:56:04 +08:00
liningrui 281aab85f2 HugeGraph-645: Add space line between license and package for hugegraph-common
Change-Id: I92a66e429382695b0f2a5742fb16299faace1616
2018-08-09 09:56:01 +08:00
liningrui ca0a9832a6 HugeGraph-596: Passed env varibale from BCLOUD to agile module for hugegraph-common module
Change-Id: Id3b89cccd310625826ca8fc2502133146221b138
2018-08-09 09:55:36 +08:00
liningrui b4a6cc9ab4 HugeGraph-596: fixed bug that hugegraph-common deploy before merge
Change-Id: Ia52ab72006bd8a2ba58254fbf4266f1555ebb8cd
2018-08-09 09:55:36 +08:00
liningrui c24069ee26 HugeGraph-625: fixed bug that there is a line length of more than 80 characters in the license information for hugegraph-common
Change-Id: Ic7cecaa7535f149060701fa16ff8e80f06cf363a
2018-08-09 09:55:33 +08:00
Zhangmei Li 504069e17f HugeGraph-623: rename LoggerFactory.getLogger() to Log.logger()
Change-Id: If9c03e3588334207870d710eba63f8bbf983e14e
2018-08-09 09:54:45 +08:00
Zhangmei Li 705c27b986 HugeGraph-555: add lockAll() for KeyLock
Change-Id: Iac0a396077658b82b67547e3eea5793d54fa01fd
2018-08-09 09:54:45 +08:00
Liu Jie f6cdc8a3ca HugeGraph-547: replace tilNextMillis by tillNextMills as the later is more meaningfull
Change-Id: I4505c1335bfc6eeb03658597f6f6ae5e994a2cf2
Signed-off-by: Liu Jie <liujie23@baidu.com>
2018-08-09 09:54:45 +08:00
Zhangmei Li 8bdac2c758 HugeGraph-525: add the const NAME of component hugegraph-common into CommonVersion
Change-Id: I5bcd766bb3435de98833759efcba5d3fa0650499
2018-08-09 09:54:45 +08:00
Zhangmei Li a200deab56 HugeGraph-131: clean up some warnings in LockGroup
Change-Id: I55a359b799119c04ea0e89d013f1c034453c2ba4
2018-08-09 09:54:45 +08:00
Zhangmei Li 5cda854e8d HugeGraph-525: add vertion check util
Change-Id: I57305dd209416620758b5bf183e791f8734af711
2018-08-09 09:54:45 +08:00
Liu Jie f33c09385d HugeGraph-532: Rewrite checksocket class
Change-Id: Iadae3837c2e9e0fddadbebbee097000c281e267c
Signed-off-by: Liu Jie <liujie23@baidu.com>
2018-08-09 09:54:44 +08:00
Liu Jie dec8fe9a84 HugeGraph-531: Fix typo at OptionHolder class
Change-Id: I19ea584802edd469d503b9fb57f630bf0c660487
Signed-off-by: Liu Jie <liujie23@baidu.com>
2018-08-09 09:54:44 +08:00
liningrui dfd3190392 HugeGraph-527: First add the version to the common module.
Change-Id: I2fd816ba13978d3d4cf2cb7a9724fe2d5f29a010
2018-08-09 09:54:44 +08:00
liningrui b76e0eaeab HugeGraph-527: add customized implemention version to manifest.mf
Change-Id: I569d82397408fb255d8ad9653e8b561ba1a60c1e
2018-08-09 09:54:44 +08:00
zhangyi51 6052985c15 hugegraph-502
add read write lock support

Change-Id: Ic339f5d81c9f475ee11ada38167fe42169c10971
2018-08-09 09:54:44 +08:00
liningrui e05d13098a HugeGraph-482: upgrade log4j to log4j2
Change-Id: If0bfaf91c45eac055e3f851b7f1dd5647d58d175
2018-08-09 09:54:44 +08:00
zhangyi51 9faea02296 hugegraph-499
trivial grammar change.

Change-Id: Ice29a709b9a5b5d7f2f7838d79541f63cf00a0c5
2018-08-09 09:54:43 +08:00
Zhangmei Li 5252a7e481 HugeGraph-410: improve code style
Change-Id: Idce80465ea4cbe92ac836bbc8d293e77ad7c7c5c
2018-08-09 09:54:41 +08:00
Zhangmei Li 0c580690cc HugeGraph-501: fix EventHub ConcurrentModificationException
Change-Id: Idedff1ca762cd56f171152174bdbfb0bef4b8d4f
2018-08-09 09:53:56 +08:00
Liu Jie 315000a600 HugeGraph-503: using bit shift whenever, if not affect the code readability.
Change-Id: Ib36dc135241f77c99d39d458ee144dbe888c541b
Signed-off-by: Liu Jie <liujie23@baidu.com>
2018-08-09 09:53:56 +08:00
Liu Jie d3960c1da4 Always define long variable endwith 'L' indicator.
Change-Id: I5f4d4d5c823ea4e14a135b59fb2384299686b4d5
Signed-off-by: Liu Jie <liujie23@baidu.com>
2018-08-09 09:53:56 +08:00
Liu Jie 9778a8b4b3 HugeGrap-499: fix english grammer in lock
Change-Id: I36c123eb7dfb101f99a176fcd9b2ee1f0f0211d7
Signed-off-by: Liu Jie <liujie23@baidu.com>
2018-08-09 09:53:55 +08:00
Liu Jie 171e723f50 HugeGraph-494: refine logic of lock() menthod
Change-Id: Ic5298b36ecf68f3a2b87b35bd793953e6505a9ae
Signed-off-by: Liu Jie <liujie23@baidu.com>
2018-08-09 09:53:55 +08:00
zhangyi51 9a1417f3dc HugeGraph-487
Add lockManager for mutual exclusion of thread in long time operation.

Change-Id: I155e2b6bb6fffe88e4985c85d8ff68f9c49d04be
2018-08-09 09:53:55 +08:00
Zhangmei Li 9cc9cad29a HugeGraph-476: add destroy() method
Change-Id: I745465ef6f3942f1e6774bacc1e59a1e5a0b200e
2018-08-09 09:53:55 +08:00
Zhangmei Li e88f54a21e HugeGraph-462: add event manager
Change-Id: I471a115fca5c84f8f25c7026fe834be305ab39b6
2018-08-09 09:53:55 +08:00
zhangyi51 ec2599db9a HugeGraph-369
Add lockManager for mutual exclusion of thread in long time operation.

Change-Id: I155e2b6bb6fffe88e4965c85d8ff68f9c49d04be
2018-08-09 09:53:55 +08:00
Zhangmei Li d592690cf7 HugeGraph-254: improve utils class perf with final(inline)
Change-Id: I625be2f4691a7821dbf3107d0f28ce079d46dfee
2018-08-09 09:53:51 +08:00
liningrui 36959044a1 HugeGraph-410: fixed code style of hugegraph-common
Change-Id: I8e123a315e483ed66658ce93c3eaffa61d94cfb3
2018-08-09 09:52:44 +08:00
Zhangmei Li 7bdf878dd4 HugeGraph-407: add KeyLock class
Change-Id: I655bdf4da20e0c6b6d7796958485ab066f0020f1
2018-08-09 09:52:44 +08:00
liningrui 5603b9c6a3 HugeGraph-326: add slf4j-api that has been mistakenly deleted
Change-Id: I7fd0d4ee3b6957878ed2850dd389dd78f42de71e
2018-08-09 09:52:44 +08:00
liningrui cccef5d575 HugeGraph-357: modify return type of TriFunction
Change-Id: I8cfd2dce48e2901af4773ea0c8d867edd6d21562
2018-08-09 09:52:44 +08:00
liningrui db55e237a5 HugeGraph-351: fixed bug that CoreOption constructor has been removed
Change-Id: I04cc0107aec90440ee2ae8c5c6add8a7c787f4f4
2018-08-09 09:52:44 +08:00
liningrui 3e5f626d11 HugeGraph-351: code format and clean up some warnings
Change-Id: I16d328738ead94efcad9d82bb8f27be2c4ca84a9
2018-08-09 09:52:43 +08:00
liningrui 5f305526d7 HugeGraph-344: add distributionManagement to deploy baidu maven repository
Change-Id: I198cd1e8a7d34a85d08b93261f33f07bb29335c9
2018-08-09 09:52:43 +08:00
liningrui a5fa9016ec HugeGraph-341: First commit hugegraph-common code
Change-Id: Icc8f9121d56679b266459125afc33180d8b568bf
2018-08-09 09:52:28 +08:00
2090 changed files with 227232 additions and 35447 deletions

60
.asf.yaml Normal file
View File

@ -0,0 +1,60 @@
#
# 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.
#
github:
features:
# Enable issue management
issues: true
# Enable wiki for documentation
wiki: true
# Enable projects for project management boards
projects: true
description: A graph database that supports more than 100+ billion data, high performance and scalability (Include OLTP Engine & REST-API & Backends)
homepage: https://hugegraph.apache.org
del_branch_on_merge: true
#labels:
enabled_merge_buttons:
merge: false
rebase: true
squash: true
protected_branches:
master:
required_status_checks:
# strict means "Require PR to be up-to-date before merging". (enable when branch unstable)
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)
required_pull_request_reviews:
dismiss_stale_reviews: true
require_code_owner_reviews: false
required_approving_review_count: 2
# refer https://cwiki.apache.org/confluence/display/INFRA/Git+-+.asf.yaml+features#Git.asf.yamlfeatures-Notificationsettingsforrepositories
notifications:
# use https://selfserve.apache.org to manage it
pullrequests_status: issues@hugegraph.apache.org
pullrequests_comment: issues@hugegraph.apache.org
pullrequests_bot_dependabot: issues@hugegraph.apache.org
issues: issues@hugegraph.apache.org
issues_status: dev@hugegraph.apache.org
issues_comment: issues@hugegraph.apache.org
discussions: dev@hugegraph.apache.org

99
.editorconfig Normal file
View File

@ -0,0 +1,99 @@
#
# 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.
#
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

16
.gitattributes vendored Executable file
View File

@ -0,0 +1,16 @@
# ignored file when package to source.tgz
.gitattributes export-ignore
.gitignore export-ignore
.asf.yaml export-ignore
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

View File

@ -10,18 +10,18 @@ body:
value: >-
### Note (特别注意) :
> 1. 请先**搜索**现有的[Issues](https://github.com/hugegraph/hugegraph/issues) 与
[FAQ](https://hugegraph.github.io/hugegraph-doc/guides/faq.html) 中没有与您相同
> 1. 请先**搜索**现有的[Issues](https://github.com/apache/hugegraph/issues) 与
[FAQ](https://hugegraph.apache.org/docs/guides/faq/) 中没有与您相同
/ 相关的问题 (请勿重复提交)
> 2. 我们需要尽可能**详细**的信息来**复现**问题, 越详细的信息 (包括**日志 / 截图 / 配置**等)
会**越快**被响应和处理
> 3. Issue 标题请保持原有模板分类(例如:`[Bug]`), 长段描述之间可以增加`空行`或使用`序号`标记, 保持排版清晰
> 3. Issue 标题请保留原有分类标签 (例如:`[Bug]`), 长段描述请增加`空行`并使用`序号`标记, 保持排版清晰
> 4. 请在对应的模块提交 issue, 缺乏有效信息 / 长时间 (> 14 天) 没有回复的 issue 可能会被 **关闭**
(更新时会再开启)
- type: dropdown
attributes:
label: Bug Type (问题类型)
@ -31,36 +31,38 @@ body:
- other exception / error (其他异常报错)
- server status (启动/运行异常)
- logic (逻辑设计问题)
- performence (性能下降)
- performance (性能下降)
- others (please edit later)
- type: checkboxes
attributes:
label: Before submit
options:
- label: 我已经确认现有的 [Issues](https://github.com/hugegraph/hugegraph/issues) 与 [FAQ](https://hugegraph.github.io/hugegraph-doc/guides/faq.html) 中没有相同 / 重复问题
- label: '我已经确认现有的 [Issues](https://github.com/apache/hugegraph/issues) 与
[FAQ](https://hugegraph.apache.org/docs/guides/faq/) 中没有相同 / 重复问题 (I have confirmed
and searched that there are no similar problems in the historical issue and documents)'
required: true
- type: textarea
attributes:
label: Environment (环境信息)
description: |
> server version could get from [rest-api](https://hugegraph.github.io/hugegraph-doc/clients/restful-api/other.html) (http://localhost:8080/versions)
> server version could get from [rest-api](https://hugegraph.apache.org/docs/clients/restful-api/) (http://localhost:8080/versions)
value: |
- Server Version: v0.11.x
- Server Version: 1.0.0 (Apache Release Version)
- Backend: RocksDB x nodes, HDD or SSD
- OS: xx CPUs, xx G RAM, Centos 7.x
- OS: xx CPUs, xx G RAM, Ubuntu 2x.x / CentOS 7.x
- Data Size: xx vertices, xx edges <!-- (like 1000W 点, 9000W 边) -->
validations:
required: true
- type: textarea
attributes:
label: Expected & Actual behavior (期望与实际表现)
description: |
> we can refer [How to create a minimal reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) (如何提供最简的可复现用例)
> if possible, please provide screenshots or GIF (请提供清晰的截图, 动图录屏更佳)
placeholder: |
> if possible, please provide **screenshots** / Pic or `GIF` (请提供清晰的截图, 动图录屏更佳)
placeholder: |
type the main problem here
```java
@ -69,7 +71,7 @@ body:
```
validations:
required: true
- type: textarea
attributes:
label: Vertex/Edge example (问题点 / 边数据举例)
@ -84,7 +86,7 @@ body:
"vertex": { "id": "xxx" }
}
render: javascript
- type: textarea
attributes:
label: Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

View File

@ -2,9 +2,9 @@ blank_issues_enabled: false
# 设置提 issue 前的参考文档
contact_links:
- name: HugeGraph Server Doc
url: https://hugegraph.github.io/hugegraph-doc/quickstart/hugegraph-server.html
- name: HugeGraph Server Doc (EN/CN)
url: https://hugegraph.apache.org/docs/quickstart/hugegraph-server/
about: Please search question here before opening a new issue
- name: HugeGraph API Doc
url: https://hugegraph.github.io/hugegraph-doc/clients/hugegraph-api.html
- name: HugeGraph API Doc (EN/CN)
url: https://hugegraph.apache.org/docs/clients/
about: Please search usage here before opening a new issue

View File

@ -10,6 +10,6 @@ body:
label: Feature Description (功能描述)
description: |
> 请简要描述新功能 / 需求的使用场景或上下文, 最好能给个具体的例子说明
placeholder: type the feature description here
placeholder: type the feature description here
validations:
required: true

View File

@ -8,18 +8,18 @@ body:
value: >-
### Note (特别注意) :
> 1. 请先**搜索**现有的[Issues](https://github.com/hugegraph/hugegraph/issues) 与
[FAQ](https://hugegraph.github.io/hugegraph-doc/guides/faq.html) 中没有与您相同
> 1. 请先**搜索**现有的[Issues](https://github.com/apache/hugegraph/issues) 与
[FAQ](https://hugegraph.apache.org/docs/guides/faq/) 中没有与您相同
/ 相关的问题 (请勿重复提交)
> 2. 我们需要尽可能**详细**的信息来**复现**问题, 越详细的信息 (包括**日志 / 截图 / 配置**等)
会**越快**被响应和处理
> 3. Issue 标题请保持原有模板分类(例如:`[Bug]`), 长段描述之间可以增加`空行`或使用`序号`标记, 保持排版清晰
> 3. Issue 标题请保留原有分类标签 (例如:`[Bug]`), 长段描述请增加`空行`并使用`序号`标记, 保持排版清晰
> 4. 请在对应的模块提交 issue, 缺乏有效信息 / 长时间 (> 14 天) 没有回复的 issue 可能会被 **关闭**
(更新时会再开启)
- type: dropdown
attributes:
label: Problem Type (问题类型)
@ -29,37 +29,40 @@ body:
- server status (启动/运行异常)
- configs (配置项 / 文档相关)
- struct / logic (架构 / 逻辑设计问题)
- performence (性能优化)
- performance (性能优化)
- other exception / error (其他异常报错)
- others (please edit later)
- type: checkboxes
attributes:
label: Before submit
options:
- label: 我已经确认现有的 [Issues](https://github.com/hugegraph/hugegraph/issues) 与 [FAQ](https://hugegraph.github.io/hugegraph-doc/guides/faq.html) 中没有相同 / 重复问题
- label: '我已经确认现有的 [Issues](https://github.com/apache/hugegraph/issues) 与
[FAQ](https://hugegraph.apache.org/docs/guides/faq/) 中没有相同 / 重复问题 (I have confirmed
and searched that there are no similar problems in the historical issue and documents)'
required: true
- type: textarea
attributes:
label: Environment (环境信息)
description: |
> server version could get from [rest-api](https://hugegraph.github.io/hugegraph-doc/clients/restful-api/other.html) (http://localhost:8080/versions)
> server version could get from [rest-api](https://hugegraph.apache.org/docs/clients/restful-api/) (http://localhost:8080/versions)
value: |
- Server Version: v0.11.x
- Server Version: 1.0.0 (Apache Release Version)
- Backend: RocksDB x nodes, HDD or SSD
- OS: xx CPUs, xx G RAM, Centos 7.x
- OS: xx CPUs, xx G RAM, Ubuntu 2x.x / CentOS 7.x
- Data Size: xx vertices, xx edges <!-- (like 1000W 点, 9000W 边) -->
validations:
required: true
- type: textarea
attributes:
label: Your Question (问题描述)
description: |
> 图使用 / 配置相关问题,请优先参考 [REST-API 文档](https://hugegraph.github.io/hugegraph-doc/clients/hugegraph-api.html), 以及 [Server 配置文档](https://hugegraph.github.io/hugegraph-doc/config/config-option.html)
> if possible, please provide screenshots or GIF (请提供清晰的截图, 动图录屏更佳)
placeholder: |
> 图使用 / 配置相关问题,请优先参考 [REST-API 文档](https://hugegraph.apache.org/docs/clients/restful-api/),
> 以及 [Server 配置文档](https://hugegraph.apache.org/docs/config/)
> if possible, please provide **screenshots** / Pic or `GIF` (请提供清晰的截图, 动图录屏更佳)
placeholder: |
type the main problem here
```java
@ -68,7 +71,7 @@ body:
```
validations:
required: true
- type: textarea
attributes:
label: Vertex/Edge example (问题点 / 边数据举例)
@ -83,7 +86,7 @@ body:
"vertex": { "id": "xxx" }
}
render: javascript
- type: textarea
attributes:
label: Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

67
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,67 @@
<!--
Thank you very much for contributing to Apache HugeGraph, we are happy that you want to help us improve it!
Here are some tips for you:
1. If this is your first time, please read the [contributing guidelines](https://github.com/apache/hugegraph/blob/master/CONTRIBUTING.md)
2. If a PR fix/close an issue, type the message "close xxx" (xxx is the link of related
issue) in the content, GitHub will auto link it (Required)
3. Name the PR title in "Google Commit Format", start with "feat | fix | perf | refactor | doc | chore",
such like: "feat(core): support the PageRank algorithm" or "fix: wrong break in the compute loop" (module is optional)
skip it if you are unsure about which is the best component.
4. One PR address one issue, better not to mix up multiple issues.
5. Put an `x` in the `[ ]` to mark the item as CHECKED. `[x]` (or click it directly after
published)
-->
## Purpose of the PR
- 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.
e.g:
- If you propose a new API, clarify the use case for a new API.
- If you fix a bug, you can clarify why it is a bug, and should be associated with an issue.
-->
## 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.)
For example:
- If you introduce a new feature, please show detailed design here or add the link of design documentation.
- If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
- If there is a discussion in the mailing list, please add the link. -->
## Verifying these changes
<!-- Please pick the proper options below -->
- [ ] Trivial rework / code cleanup without any test coverage. (No Need)
- [ ] Already covered by existing tests, such as *(please modify tests here)*.
- [ ] Need tests and can be verified as follows:
- xxx
## Does this PR potentially affect the following parts?
<!-- 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) -->
- [ ] Modify configurations
- [ ] The public API
- [ ] Other affects (typed here)
- [ ] Nope
## Documentation Status
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `Doc - TODO` <!-- Your PR changes impact docs and you will update later -->
- [ ] `Doc - Done` <!-- Related docs have been already added or updated -->
- [ ] `Doc - No Need` <!-- Your PR changes don't impact/need docs -->

43
.github/configs/settings.xml vendored Normal file
View File

@ -0,0 +1,43 @@
<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>

View File

@ -115,7 +115,7 @@ env:
global:
- RELEASE_BRANCH=^release-.*$
- RELEASE_TAG=^v[0-9]\..*$
- TRAVIS_DIR=hugegraph-dist/src/assembly/travis
- TRAVIS_DIR=hugegraph-server/hugegraph-dist/src/assembly/travis
- DEPLOYED=0
- secure: dYmFTVeEtRzLNaHp9ToTV/+CkTD0/rEj+K7dRN8wsv/yg4pbqwnyWbSXcqMlj6iNFzAz3nPbmFLCvAWON9/SMN9iJIT6x/xfcf+LqCT8QWczo2nc9xeX144ij2VHX1Drvtk5fRTMaTXRfWEQIrjqx2yrJTIdrXWzWSaZLFv1CRCUizEiGGCePnzUWxx9dBypNyC6IaH6lIv8uN5E6+10SYhb7UJGjWUMDg1bCeW9X7X2wg4QpsGDzlGFXT2EBPU/dAb5attTAtW8dKxrCZqZJTPWe0BarXDBR4PO15BC+a0V1g8LwexedtDjJeFRcGPaJ5NN4d3jDSusCzt5Jf4U0Wa1gDRMVTU3jT+KYkm5eoV4wOZMySobjh6VpQH/LyL0QTDy5apRPAxw+wO+tc91P+nkJmnlr3pN8abtMZ6NciZizUBYQRgR/m2Ir0stvtbZxBQOATuPtBgNDKiDgVdSYcRJzSqYEMFOn35AvsDZ9aUsyC8k29PCUZ0gQO2Is6cV1ClFBnM52hfU9XX0gu+NviSnYNGvcokod8z9VjGtnM7V3LYjqXSFqO9kkMbOmkME1tD2Bh/klw2/OM+2tBBZiAgxB89st5jSUHI4a2hpUyaQBezJUcU9t2vVT/zAVEIqzw2PDxkMU7t0n6L1x+qUIUTG/WynfIni5msxuR7HoiU=
- secure: XbX6AX5zDPc2PcWYAMW+6fazqRRUqpgQkt4eXUugLuVIYZBmJ0WqncEhJ4+mdwOGPIhnP2HsOaSeK2eE/O+iLY2XpBFbugoBgm9VaZlCC4CY1gRNHaanYg64Lrm3NPY3n08IHRMazHqMpJwUqNO+OG/6QwkepULQLj5Rluf716AoXHa7IEJhAIrwr+OXQvdEaJdUXlS1lRycXVeYtOewl7qYxCO4dD4RMhPlNykh9KEK7fd5wnPkiUsp1SwF4g5XsaLvGXmT/qQ1nj8oa9Caej/iaj6HMKG3BO057mq4KK5JDxTPWhBueNpEkUwldAnrMhYWLRnNf4IyjUsaB/Pmi6HspzcaiORPLYwPmdvLGGSnYwbtO+fAHebgpgOnj/vGmRmY4YtIkYdFtbPBI0HpbGB77tqNRFCe/5deLrjx0hXJBfoKTy7d42SI1eBhNR0svZYUHkSfuXwly6hMTlH1DN/bumMFxfXDkY9PFHlzV1Mn3vb9BxKTaP88hJsWk7JqgniqUF7EWAc0EhHMbJct2gC0pDc95z4Yy9391n7/XWJErhIdYon1Ukds5+a43xFXoy76gR4LuMDpzzCnutMjhC2yDuGaZx/DfkPBb5JFU7SHtTKj05zb73Moogi7qqbH8jwcwoSfogAKyrIAWTcAgvJ2LVnRzwdsiLTc6MEagiM=

View File

@ -2,17 +2,17 @@
## Abstract
HugeGraph is a high performance scalable graph database.
HugeGraph is a high-performance scalable graph database.
## Proposal
HugeGraph is a large-scale and easy-to-use graph database. In the cases of 100+ billion data (vertices and edges), HugeGraph has complete HTAP capabilities built in its internal system. The design goal of HugeGraph is to achieve a balance between availability, performance and cost.
HugeGraph is a large-scale and easy-to-use graph database. In the cases of 100+ billion data (vertices and edges), HugeGraph has complete HTAP capabilities built into its internal system. The design goal of HugeGraph is to achieve a balance between availability, performance, and cost.
We believe that the HugeGraph project will benefit the open source community if HugeGraph is introduced into the Apache Software Foundation.
We believe that the HugeGraph project will benefit the open-source community if HugeGraph is introduced into the Apache Software Foundation.
### Background
HugeGraph graph database was initially developed at Baidu, the leading search engine company in China. HugeGraph was designed to solve the large-scale graph analysis requirements for the task of anti-fraud. Relational databases are usually at a disadvantage in dealing with relational analysis, due to slow join performance, especially in the case of a large-scale graph with multiple dimensions and deep association relationships. Graph databases are in general considered a good alternative in dealing with large scale relational analysis.
HugeGraph graph database was initially developed at Baidu, the leading search engine company in China. HugeGraph was designed to solve the large-scale graph analysis requirements for the task of anti-fraud. Relational databases are usually at a disadvantage in dealing with relational analysis, due to slow join performance, especially in the case of a large-scale graph with multiple dimensions and deep association relationships. Graph databases are in general considered a good alternative in dealing with large-scale relational analysis.
### Rationale
@ -23,7 +23,7 @@ Generally, most graph databases can only process up to 1-billion-scale graphs, b
Although most of the main development of HugeGraph has been completed, there are several areas that still need future development. Some areas we want to focus on in the Apache incubation stage include:
- Higher graph computing loading performance: the current architecture (especially the separation of computing and storage) brings greater flexibility and cost savings, but with some performance overhead, which needs to be improved.
- RocksDB-based sharding storage development, based on the affinity architecture of query and storage. Since RocksDB is known for its good performance, but currently HugeGraph only supports the raft-based replication mode. We plan to support scale-out and distributed atomic transactions for RocksDB-based storage.
- RocksDB-based sharding storage development, based on the affinity architecture of query and storage. Since RocksDB is known for its good performance, but currently HugeGraph only supports the raft-based replication mode, we plan to support scale-out and distributed atomic transactions for RocksDB-based storage.
- Parallel OLTP query: at present, HugeGraph can perform parallel OLAP graph-computing, but the OLTP query only supports parallel execution on a single machine. In certain scenarios, the OLTP query needs to be implemented in parallel on multiple machines.
- Higher-performance queries: such as supporting faster query optimization, parallel primitive collections, and fine-grained caching strategies.
- Better usability: more OLTP/OLAP algorithms, APIs and toolchains, rich UI, etc...
@ -34,57 +34,57 @@ Although most of the main development of HugeGraph has been completed, there are
#### Meritocracy
HugeGraph was incubated at Baidu in 2016 and open sourced on [GitHub](https://github.com/hugegraph/hugegraph) in 2018. The project(include sub-projects) now has 30+ contributors from many companies. Some of these contributors become committers, and the project has hundreds of known users around the world. We will follow Apache's Meritocracy way to re-organize the community roles. We have set up the PPMC Team and Committer Team. Of course, contributions are welcomed and highly valued. New contributors are guided and reviewed by existing PMC members. When an active contributor has submitted enough good patches, PMC will start a vote to promote him/her to become a member of Committer Team or PMC Team.
HugeGraph was incubated at Baidu in 2016 and open-sourced on [GitHub](https://github.com/hugegraph/hugegraph) in 2018. The project (including sub-projects) now has 30+ contributors from many companies. Some of these contributors become committers, and the project has hundreds of known users around the world. We will follow Apache's Meritocracy way to re-organize the community roles. We have set up the PPMC Team and Committer Team. Of course, contributions are welcomed and highly valued. New contributors are guided and reviewed by existing PMC members. When an active contributor has submitted enough good patches, PMC will start a vote to promote him/her to become a member of the Committer Team or PMC Team.
#### Community
Baidu has been building a community around HugeGraph users and developers for the last 3 years, and now we make use of GitHub as code hosting and community communication. The most of core developers are from Baidu. Besides, there are 10+ contributors from other companies such as NetEase, 360, Iflytek and Huya. We hope to grow the base of contributors by inviting all those who offer contributions through The Apache Way.
Baidu has been building a community around HugeGraph users and developers for the last 3 years, and now we make use of GitHub as code hosting and community communication. The most of core developers are from Baidu. Besides, there are 10+ contributors from other companies such as NetEase, 360, Iflytek, and Huya. We hope to grow the base of contributors by inviting all those who offer contributions through The Apache Way.
#### Core Developers
The core developers are all experienced open source developers. They have operated the HugeGraph Community for 3 years, and they are contributors of Linux kernel, OpenStack, Ceph, RocksDB, Apache TinkerPop, Apache Hadoop and Apache Groovy.
The core developers are all experienced open-source developers. They have operated the HugeGraph Community for 3 years, and they are contributors to Linux kernel, OpenStack, Ceph, RocksDB, Apache TinkerPop, Apache Hadoop, and Apache Groovy.
#### Alignment
HugeGraph implements the API of [Apache TinkerPop](https://tinkerpop.apache.org/), which defines the [Gremlin](https://tinkerpop.apache.org/gremlin.html). Gremlin is a powerful graph traversal language, and various complicated graph queries can be accomplished through Gremlin. The TinkerPop ecosystem based on Java is relatively mature in terms of graph databases. We use Java language, which is developed efficient and stable, to develop upper-level components like graph engine, graph computing, graph API and graph tools; and we manage storage through JNI which is able to freely manage memory and execute efficiently.
HugeGraph implements the API of [Apache TinkerPop](https://tinkerpop.apache.org/), which defines the [Gremlin](https://tinkerpop.apache.org/gremlin.html). Gremlin is a powerful graph traversal language, and various complicated graph queries can be accomplished through Gremlin. The TinkerPop ecosystem based on Java is relatively mature in terms of graph databases. We use Java language, which is developed efficient and stable, to develop upper-level components like graph engine, graph computing, graph API, and graph tools; and we manage storage through JNI which is able to freely manage memory and execute efficiently.
### Known Risks
#### Project Name
We have checked and believe the name is [suitable](https://github.com/hugegraph/hugegraph/issues/1646) and the project has legal permission to continue using its current name. There is no other projects found using this name through Google search.
We have checked and believe the name is [suitable](https://github.com/hugegraph/hugegraph/issues/1646) and the project has legal permission to continue using its current name. There are no other projects found using this name through Google Search.
#### Relationship with Titan/Janus Graph
In the early stage of the project, we referred to the storage structure of Titan/Janus Graph, some folks thought that HugeGraph was forked from Titan/Janus. In fact, HugeGraph is not based on these projects. HugeGraph is developed completely from scratch and in the process it addressed many new challenges. Certainly, the project was inspired by Titan/Janus and we are really gratitious for such inspirations.
In the early stage of the project, we referred to the storage structure of Titan/Janus Graph, some folks thought that HugeGraph was forked from Titan/Janus. In fact, HugeGraph is not based on these projects. HugeGraph is developed completely from scratch and in the process it addressed many new challenges. Certainly, the project was inspired by Titan/Janus and we are really grateful for these inspirations.
### Orphaned products
Due to a small and limited number of committers, the project has a relatively small risk of becoming an orphan project. However, the committers have been operating the HugeGraph Community for 3 years in the spirit of open source, and continue to develop new contributors to participate.
Due to a small and limited number of committers, the project has a relatively small risk of becoming an orphan project. However, the committers have been operating the HugeGraph Community for 3 years in the spirit of open-source, and continue to develop new contributors to participate.
#### Inexperience with Open Source:
#### Inexperience with Open-Source
HugeGraph has been open sourced on GitHub for 3 years, during which committers submitted code and documents in full compliance with open source specifications and requirements.
HugeGraph has been open-sourced on GitHub for 3 years, during which committers submitted code and documents in full compliance with open-source specifications and requirements.
#### Length of Incubation:
#### Length of Incubation
Expect to enter incubation in 4 months and graduate in about 2 years.
#### Homogenous Developers:
#### Homogenous Developers
The developers on the current list come from several different companies plus many independent volunteers, but the most of committers are from Baidu. The developers are geographically concentrated in China now. They are experienced with working in a distributed environment in other open source projects, e.g. OpenStack.
The developers on the current list come from several different companies plus many independent volunteers, but the most of committers are from Baidu. The developers are geographically concentrated in China now. They are experienced with working in a distributed environment in other open-source projects, e.g. OpenStack.
#### Reliance on Salaried Developers:
#### Reliance on Salaried Developers
Most of the developers are paid by their employer to contribute to this project. Given some volunteer developers and the committers' sense of ownership for the code, the project could continue even if no salaried developers contributed to the project.
#### Relationships with Other Apache Products:
#### Relationships with Other Apache Products
HugeGraph follows the Apache TinkerPop specification, uses Apache Commons, Apache HttpClient, and Apache HttpCore to implement the basic functions. Users can choose Apache Cassandra or Apache HBase as one of the storage backends of HugeGraph.
#### An Excessive Fascination with the Apache Brand:
#### An Excessive Fascination with the Apache Brand
Although we expect that the Apache brand may help attract more contributors, our interest in starting this project is based on the factors mentioned in the fundamentals section. We are interested in joining ASF to increase our connections in the open source world. Based on extensive collaboration, it is possible to build a community of developers and committers that live longer than the founder.
Although we expect that the Apache brand may help attract more contributors, our interest in starting this project is based on the factors mentioned in the fundamentals section. We are interested in joining ASF to increase our connections in the open-source world. Based on extensive collaboration, it is possible to build a community of developers and committers that live longer than the founder.
### Documentation
@ -94,18 +94,18 @@ HugeGraph documentation is provided on https://hugegraph.github.io/hugegraph-doc
This project consists of 2 core sub-projects and 2 other sub-projects, all of which are hosted by [GitHub hugegraph organization](https://github.com/orgs/hugegraph/repositories) since 2018. The codes are already under Apache License Version 2.0. The git address of sub-project repositories are as follows:
1. The graph database repository `hugegraph`, core sub-project, including graph server, graph engine and graph storage: https://github.com/hugegraph/hugegraph
1. The graph database repository `hugegraph`, core sub-project, including graph server, graph engine, and graph storage: https://github.com/hugegraph/hugegraph
2. The graph computing repository `hugegraph-computer`, core sub-project, including graph computing and graph algorithms: https://github.com/hugegraph/hugegraph-computer
3. The common functions repository `hugegraph-commons`: https://github.com/hugegraph/hugegraph-commons
4. The ecosystem repository `hugegraph-toolchain`, including `hugegraph-client`, `hugegraph-loader`, `hugegraph-tools`, `hugegraph-hubble`, `hugegraph-test`, `hugegraph-doc`: https://github.com/hugegraph/hugegraph-toolchain
### Source and Intellectual Property Submission Plan
The codes are currently under Apache License Version 2.0, and have been verified there is no intellectual property or license issues when being released to open source by Baidu in 2018. Baidu will provide SGA and all committers will sign ICLA after HugeGraph is accepted into the Incubator.
The code is currently under Apache License Version 2.0, and it was verified there were no intellectual property or license issues when it was open-sourced by Baidu in 2018. Baidu will provide SGA and all committers will sign ICLA after HugeGraph is accepted into the Incubator.
#### External Dependencies:
#### External Dependencies
As all dependencies are managed by Apache Maven, none of the external libraries need to be packaged in a source distribution. All dependencies have Apache compatible licenses except for 4 dependencies: MySQL Connector(GPL), word(GPL), JBoss Logging 3(LGPL) and jnr-posix(LGPL+GPL), we will remove these dependencies in future.
As all dependencies are managed by Apache Maven, none of the external libraries need to be packaged in a source distribution. All dependencies have Apache compatible licenses except for 4 dependencies: MySQL Connector (GPL), word (GPL), JBoss Logging 3 (LGPL), and jnr-posix (LGPL+GPL), we will remove these dependencies in the future.
HugeGraph has the following external [dependencies](https://github.com/hugegraph/hugegraph/issues/1632):
@ -259,7 +259,7 @@ None
### Required Resources
#### Mailing lists:
#### Mailing lists
- hugegraph-dev: [dev@hugegraph.incubator.apache.org](mailto:dev@hugegraph.incubator.apache.org) for development and users discussions.
- hugegraph-private: [private@hugegraph.incubator.apache.org](mailto:private@hugegraph.incubator.apache.org) for PPMC discussions.
@ -276,13 +276,13 @@ None
3. `hugegraph-commons`: https://github.com/hugegraph/hugegraph-commons.git
4. `hugegraph-toolchain`: https://github.com/hugegraph/hugegraph-toolchain.git
#### Issue Tracking:
#### Issue Tracking
The community would like to continue using [GitHub Issues](https://github.com/hugegraph/hugegraph/issues) (but will moved to github.com/apache/).
The community would like to continue using [GitHub Issues](https://github.com/hugegraph/hugegraph/issues) (but will move to github.com/apache/).
#### Other Resources:
#### Other Resources
- The community has already choosed [GitHub actions](https://github.com/hugegraph/hugegraph/actions) as continuous integration tools.
- The community has already chosen [GitHub actions](https://github.com/hugegraph/hugegraph/actions) as continuous integration tools.
- The community has already used [codecov](https://github.com/marketplace/codecov) to check code coverage.
- The community has already used [mvn repository](https://mvnrepository.com/search?q=hugegraph) as binary package release platform.
@ -302,17 +302,17 @@ The community would like to continue using [GitHub Issues](https://github.com/hu
### Sponsors
#### Champion:
#### Champion
- Willem Ning Jiang (ningjiang at apache dot org)
#### Nominated Mentors:
#### Nominated Mentors
- Trista Pan (panjuan at apache dot org)
- Lidong Dai (lidongdai at apache dot org)
- Xiangdong Huang (hxd at apache dot org)
- Yu Li (liyu at apache dot org)
#### Sponsoring Entity:
#### Sponsoring Entity
We are expecting the Apache Incubator could sponsor this project.

35
.github/outdated/cla.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: "CLA Assistant"
on:
issue_comment:
types: [created]
pull_request_target:
types: [opened,closed,synchronize]
jobs:
CLAssistant:
runs-on: ubuntu-latest
steps:
- name: "CLA Assistant"
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
uses: cla-assistant/github-action@v2.1.3-beta
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# the below token should have repo scope and must be manually added by you in the repository's secret
PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with:
path-to-signatures: '.github/cla-signatures/cla.json'
path-to-document: 'https://github.com/hugegraph/hugegraph-doc/blob/master/CLA.md' # e.g. a CLA or a DCO document
custom-allsigned-prcomment: '**Good**! All Contributors have signed the [CLA](https://github.com/hugegraph/hugegraph-doc/blob/master/CLA.md).'
# branch should not be protected
branch: 'cla-assist'
allowlist: bot*
lock-pullrequest-aftermerge: false
# the following are the optional inputs - If the optional inputs are not given, then default values will be taken
#remote-organization-name: enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository)
#remote-repository-name: enter the remote repository name where the signatures should be stored (Default is storing the signatures in the same repository)
#create-file-commit-message: 'For example: Creating file for storing CLA Signatures'
#signed-commit-message: 'For example: $contributorName has signed the CLA in #$pullRequestNo'
#custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign'
#custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA'
#use-dco-flag: true - If you are using DCO instead of CLA

View File

@ -17,23 +17,27 @@ jobs:
distribution: 'zulu'
- name: Cache Maven packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Package
run: |
mvn clean package -DskipTests
mv "$(find hugegraph-*.tar.gz | head -1)" hugegraph-${TAG_NAME/#v/}.tar.gz
mvn clean package -DskipTests -ntp
- uses: xresloader/upload-to-github-release@master
- name: Rename file
if: contains(env.TAG_NAME, "-")
run: mv "$(find hugegraph-*.tar.gz | head -1)" hugegraph-${TAG_NAME/#v/}.tar.gz
- name: Upload to GitHub
uses: xresloader/upload-to-github-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:

View File

@ -0,0 +1,56 @@
name: "3rd-party"
on:
push:
branches:
- /^release-.*$/
pull_request:
permissions:
contents: read
jobs:
dependency-check:
runs-on: ubuntu-latest
env:
USE_STAGE: 'true' # Whether to include the stage repository.
SCRIPT_DEPENDENCY: install-dist/scripts/dependency
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: use staged maven repo settings
if: ${{ env.USE_STAGE == 'true' }}
run: |
cp $HOME/.m2/settings.xml /tmp/settings.xml
mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
- name: mvn install
run: |
mvn install -Dmaven.test.skip=true -ntp
- name: generate current dependencies
run: |
bash $SCRIPT_DEPENDENCY/regenerate_known_dependencies.sh current-dependencies.txt
- name: check third dependencies
run: |
bash $SCRIPT_DEPENDENCY/check_dependencies.sh
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- 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
# 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

View File

@ -1,86 +0,0 @@
name: hugegraph ci
on:
push:
branches:
- master
- 'release-*'
- 'test-*'
pull_request:
branches:
- '**'
jobs:
build:
runs-on: ubuntu-20.04
env:
TRAVIS_DIR: hugegraph-dist/src/assembly/travis
BACKEND: ${{ matrix.BACKEND }}
TRIGGER_BRANCH_NAME: ${{ github.ref_name }}
HEAD_BRANCH_NAME: ${{ github.head_ref }}
BASE_BRANCH_NAME: ${{ github.base_ref }}
TARGET_BRANCH_NAME: ${{ github.base_ref != '' && github.base_ref || github.ref_name }}
RELEASE_BRANCH: ${{ startsWith(github.ref_name, 'release-') || startsWith(github.ref_name, 'test-') || startsWith(github.base_ref, 'release-') }}
strategy:
fail-fast: false
matrix:
BACKEND: [memory, cassandra, scylladb, hbase, rocksdb, mysql, postgresql]
JAVA_VERSION: ['8']
steps:
- name: Install JDK ${{ matrix.JAVA_VERSION }}
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.JAVA_VERSION }}
distribution: 'zulu'
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Compile
run: |
mvn compile -Dmaven.javadoc.skip=true | grep -v "Downloading\|Downloaded"
- name: Prepare env and service
run: |
$TRAVIS_DIR/install-backend.sh $BACKEND
- name: Init MySQL Env
if: ${{ env.BACKEND == 'mysql' }}
uses: mirromutth/mysql-action@v1.1
with:
host port: 3306 # Optional, default value is 3306. The port of host
container port: 3306 # Optional, default value is 3306. The port of container
character set server: 'utf8mb4' # Optional, default value is 'utf8mb4'. The '--character-set-server' option for mysqld
collation server: 'utf8mb4_general_ci' # Optional, default value is 'utf8mb4_general_ci'. The '--collation-server' option for mysqld
mysql version: '5.7' # Optional, default value is "latest". The version of the MySQL
mysql database: 'test' # Optional, default value is "test". The specified database which will be create
mysql root password: "******" # Required if "mysql user" is empty, default is empty. The root superuser password
#mysql user: 'root' # Required if "mysql root password" is empty, default is empty. The superuser for the specified database. Can use secrets, too
#mysql password: ${{ secrets.DatabasePassword }} # Required if "mysql user" exists. The password for the "mysql user"
- name: Run test
run: |
$TRAVIS_DIR/run-core-test.sh $BACKEND
$TRAVIS_DIR/run-api-test.sh $BACKEND
$TRAVIS_DIR/run-unit-test.sh $BACKEND
- 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@v1
with:
file: target/site/jacoco/jacoco.xml

71
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,71 @@
name: "CodeQL"
on:
push:
branches: [ master, release-* ]
pull_request:
# The branches below must be a subset of the branches above
# branches: [ master ] # enable in all PRs
schedule:
- cron: '33 0 * * 5'
jobs:
analyze:
env:
USE_STAGE: 'true' # Whether to include the stage repository.
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'java' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
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
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

64
.github/workflows/commons-ci.yml vendored Normal file
View File

@ -0,0 +1,64 @@
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

31
.github/workflows/licence-checker.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: "License Checker"
on:
push:
branches:
- master
- 'release-*'
pull_request:
jobs:
check-license:
runs-on: ubuntu-latest
env:
USE_STAGE: 'true' # Whether to include the stage repository.
steps:
- uses: actions/checkout@v4
- name: Check License Header
uses: apache/skywalking-eyes@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
log: info
token: ${{ github.token }}
config: .licenserc.yaml
- name: License Check (RAT)
run: |
mvn apache-rat:check -ntp
find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt
grep "Binaries" merged-rat.txt -C 3 && cat merged-rat.txt

219
.github/workflows/pd-store-ci.yml vendored Normal file
View File

@ -0,0 +1,219 @@
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

101
.github/workflows/server-ci.yml vendored Normal file
View File

@ -0,0 +1,101 @@
name: "HugeGraph-Server CI"
on:
push:
branches:
- master
- 'release-*'
- 'test-*'
pull_request:
jobs:
build-server:
# TODO: we need test & replace it to ubuntu-24.04 or ubuntu-latest
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
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') }}
strategy:
fail-fast: false
matrix:
BACKEND: [ memory, rocksdb, hbase, cassandra, mysql, postgresql, scylladb ]
JAVA_VERSION: [ '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 }}
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: Use staged maven repo settings
if: ${{ env.USE_STAGE == 'true' }}
run: |
cp $HOME/.m2/settings.xml /tmp/settings.xml
cp -vf .github/configs/settings.xml $HOME/.m2/settings.xml && cat $HOME/.m2/settings.xml
- name: Compile
run: |
mvn clean compile -U -Dmaven.javadoc.skip=true -ntp
- name: 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
# 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' }}
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
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ${{ env.REPORT_DIR }}/*.xml

View File

@ -1,4 +1,4 @@
name: Mark stale issues and pull requests
name: "Mark stale issues and pull requests"
on:
schedule:
@ -20,8 +20,8 @@ jobs:
stale-pr-message: 'Due to the lack of activity, the current pr is marked as stale and will be closed after 180 days, any update will remove the stale label'
stale-issue-label: 'inactive'
stale-pr-label: 'inactive'
exempt-issue-labels: 'feature,bug,enhancement,improvement,wontfix,todo'
exempt-pr-labels: 'feature,bug,enhancement,improvement,wontfix,todo'
exempt-issue-labels: 'feature,bug,enhancement,improvement,todo,guide,doc,help wanted,security'
exempt-pr-labels: 'feature,bug,enhancement,improvement,todo,guide,doc,help wanted,security'
exempt-all-milestones: true
days-before-issue-stale: 15
@ -29,7 +29,7 @@ jobs:
days-before-pr-stale: 30
days-before-pr-close: 180
operations-per-run: 10
start-date: '2018-10-01T00:00:00Z'
start-date: '2016-10-01T00:00:00Z'
exempt-all-assignees: true
remove-stale-when-updated: true

90
.gitignore vendored
View File

@ -1,6 +1,51 @@
.DS_Store
*.iml
target/
**.db
logs/
ui
node_modules
upload-files/
demo*
gen-java
*.class
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
.svn
### IntelliJ IDEA ###
.idea/*
!.idea/vcs.xml
!.idea/icon.png
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/nbdist/
/.nb-gradle/
dist/
build/
### VS Code ###
.vscode/
# misc
.DS_Store
*/.DS_Store
**/*.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
*.orig
*.rej
**/.keep
@ -10,12 +55,35 @@
*.swp
*.log
*.pyc
.idea
.svn
.classpath
.project
.settings
target
gen-java
build
node*
# maven ignore
apache-hugegraph-*/
output/
*.war
*.zip
*.tar
*.tar.gz*
tree.txt
*.versionsBackup
.flattened-pom.xml
# eclipse ignore
.settings/
# temp ignore
*.cache
*.diff
*.patch
*.tmp
# system ignore
Thumbs.db
hs_err_pid*
# mobile Tools for Java (J2ME)
.mtj.tmp/
# blueJ files
*.ctxt
# docker volumes ignore
hugegraph-server/hugegraph-dist/docker/data/

BIN
.idea/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

37
.idea/vcs.xml Normal file
View File

@ -0,0 +1,37 @@
<?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>

107
.licenserc.yaml Normal file
View File

@ -0,0 +1,107 @@
#
# 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.
#
header: # `header` section is configurations for source codes license header.
license:
spdx-id: Apache-2.0 # the spdx id of the license, it's convenient when your license is standard SPDX license.
copyright-owner: Apache Software Foundation # the copyright owner to replace the [owner] in the `spdx-id` template.
content: | # `license` will be used as the content when `fix` command needs to insert a license header.
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.
# `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
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.
paths: # `paths` are the path list that will be checked (and fixed) by license-eye, default is ['**'].
- '**'
paths-ignore: # `paths-ignore` are the path list that will be ignored by license-eye.
- '.gitignore'
- '.gitattributes'
- 'LICENSE'
- 'NOTICE'
- 'DISCLAIMER'
- '**/*.versionsBackup'
- '**/*.versionsBackup'
- '**/*.proto'
- '**/*.log'
- '**/*.txt'
- '**/*.json'
- '**/*.conf'
- '**/*.map'
- '**/*.properties'
- '**/RaftRequests.java'
- 'dist/**/*'
- 'hugegraph-server/hugegraph-dist'
- '**/assembly/static/bin/hugegraph.service'
- 'scripts/dev/reviewers'
- 'scripts/dev/reviewers'
- '**/*.md'
- '**/dependency-reduced-pom.xml'
- '**/logs/*.log'
- '**/META-INF/**/*'
- '**/target/*'
- 'style/*'
- 'ChangeLog'
- 'CONFIG.ini'
- 'GROUPS'
- 'OWNERS'
- '.github/**/*'
- '**/*.iml'
- '**/*.iws'
- '**/*.ipr'
- '**/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'
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,
# after all, a "header" cannot be TOO far from the file start.
license-location-threshold: 80

View File

@ -1,28 +1,35 @@
Building hugegraph
Building HugeGraph
--------------
Required:
* Java 8 (0.9 and later)
* Maven
* Java 11
* Maven 3.5+
To build without executing tests: `mvn clean package -Dmaven.test.skip=true`
## Building in IDEA
To build without executing tests:
```
mvn clean
mvn package -DskipTests
```
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.
## 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.
Could also refer [Dev-In-IDEA](https://hugegraph.apache.org/docs/contribution-guidelines/hugegraph-server-idea-setup/) for more details.
## 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. On same window, go to "Environment" tab and click "New".
4. Before clicking "Run", make sure that Eclipse knows where `JAVA_HOME` is. In the 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"
@ -32,14 +39,3 @@ 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 Porjects".
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.

View File

@ -1,24 +1,31 @@
# How to Contribute to HugeGraph
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 of the contributors.
> 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.
The following is a contribution guide for HugeGraph:
<img width="884" alt="image" src="https://user-images.githubusercontent.com/9625821/159643158-8bf72c0a-93c3-4a58-8912-7b2ab20ced1d.png">
## 1. Preparation
**Recommended**: You can use [GitHub desktop](https://desktop.github.com/) to greatly simplify the PR process.
We can contribute by reporting issues, submitting code patches or any other feedback.
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/hugegraph/hugegraph/fork](https://github.com/hugegraph/hugegraph/fork)
2. Fork HugeGraph repo from GitHub: [https://github.com/apache/incubator-hugegraph/fork](https://github.com/apache/incubator-hugegraph/fork)
3. Clone code from fork repo to local: [https://github.com/${GITHUB_USER_NAME}/hugegraph](https://github.com/${GITHUB_USER_NAME}/hugegraph)
3. Clone code from fork repo to local: [https://github.com/${GITHUB_USER_NAME}/incubator-hugegraph](https://github.com/${GITHUB_USER_NAME}/incubator-hugegraph)
```shell
# clone code from remote to local repo
git clone https://github.com/${GITHUB_USER_NAME}/hugegraph
git clone https://github.com/${GITHUB_USER_NAME}/incubator-hugegraph.git hugegraph
```
4. Configure local HugeGraph repo
@ -27,26 +34,22 @@ Before submitting the code, we need to do some preparation:
cd hugegraph
# add upstream to synchronize the latest code
git remote add hugegraph https://github.com/hugegraph/hugegraph
git remote add hugegraph https://github.com/apache/incubator-hugegraph
# set name and email to push code to github
git config user.name "{full-name}" # like "Jermy Li"
git config user.email "{email-address-of-github}" # like "jermy@gmail.com"
git config user.email "{email-address-of-github}" # like "jermy@apache.org"
```
5. Sign the HugeGraph CLA: [https://cla-assistant.io/hugegraph/hugegraph](https://cla-assistant.io/hugegraph/hugegraph)
Optional: You can use [Github desktop](https://desktop.github.com/) to greatly simplify the commit and update process.
## 2. Create an Issue on GitHub
If you encounter bugs or have any questions, please go to [GitHub Issues](https://github.com/hugegraph/hugegraph/issues) to report them and feel free to [create an issue](https://github.com/hugegraph/hugegraph/issues/new).
If you encounter bugs or have any questions, please go to [GitHub Issues](https://github.com/apache/incubator-hugegraph/issues) to report them and feel free to [create an issue](https://github.com/apache/incubator-hugegraph/issues/new).
## 3. Make changes of code locally
#### 3.1 Create a new branch
Please don't use master branch for development. Instead we should create a new branch:
Please don't use master branch for development. Instead, we should create a new branch:
```shell
# checkout master branch
@ -63,12 +66,26 @@ Assume that we need to modify some files like "HugeGraph.java" and "HugeFactory.
```shell
# modify code to fix a bug
vim hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraph.java
vim hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java
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
# run test locally (optional)
mvn test -Pcore-test,memory
```
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).
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).
##### 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).
**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.
#### 3.3 Commit changes to git repo
@ -76,8 +93,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-core/src/main/java/com/baidu/hugegraph/HugeGraph.java
git add hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java
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
# commit to local git repo
git commit
```
@ -90,7 +107,7 @@ Fix bug: run deploy multiple times
fix #ISSUE_ID
```
> Please remember to fill in the issue id, which was generated by GitHub after issue creation.
> Please remember to fill in the issue id, which GitHub generated after issue creation.
#### 3.4 Push commit to GitHub fork repo
@ -101,16 +118,22 @@ Push the local commit to GitHub fork repo:
git push origin bugfix-branch:bugfix-branch
```
Note that since GitHub requires submitting code through `username + token` (instead of using `username + password` directly), you need to create a GitHub token from https://github.com/settings/tokens:
<img width="1280" alt="image" src="https://user-images.githubusercontent.com/9625821/163524204-7fe0e6bf-9c8b-4b1a-ac65-6a0ac423eb16.png">
## 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, 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.
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.
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">
## 5. Code review
Maintainers will start the code review after all the **automatic** checks are passed:
- Check: Contributor License Agreement is signed
- Check: Travis CI builds is passed (automatically Test and Deploy)
- Check: Travis CI builds are passed (automatically Test and Deploy)
The commit will be accepted and merged if there is no problem after review.
@ -125,9 +148,11 @@ If we have not passed the review, don't be discouraged. Usually a commit needs t
After the further changes, we submit them to the local repo:
```shell
# commit all updated files in amend mode
# instead of creating a new commit
git commit -a --amend
# commit all updated files in a new commit,
# please feel free to enter any appropriate commit message, note that
# we will squash all commits in the pull request as one commit when
# merging into the master branch.
git commit -a
```
> If there are conflicts that prevent the code from being merged, we need to rebase on master branch:
@ -148,8 +173,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, just wait for code review.
GitHub will automatically update the Pull Request after we push it, wait for code review.
Any question please contact to us through [hugegraph@googlegroups.com](mailto:hugegraph@googlegroups.com) or [other contact information](https://hugegraph.github.io/hugegraph-doc/).
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)

7
DISCLAIMER Normal file
View File

@ -0,0 +1,7 @@
Apache HugeGraph (incubating) is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator PMC.
Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications,
and decision making process have stabilized in a manner consistent with other successful ASF projects.
While incubation status is not necessarily a reflection of the completeness or stability of the code,
it does indicate that the project has yet to be fully endorsed by the ASF.

View File

@ -1,51 +0,0 @@
FROM ubuntu:xenial
LABEL maintainer="HugeGraph Docker Maintainers <hugegraph@googlegroups.com>"
ENV PKG_URL https://github.com/hugegraph
# 1. Install needed dependencies of GraphServer & RocksDB
RUN set -x \
&& apt-get -q update \
&& apt-get -q install -y --no-install-recommends --no-install-suggests \
curl \
lsof \
g++ \
gcc \
openjdk-8-jdk \
&& apt-get clean
# && rm -rf /var/lib/apt/lists/*
# 2. Init HugeGraph Sever
# (Optional) You can set the ip of github to speed up the local build
# && echo "192.30.253.112 github.com\n151.101.44.249 github.global.ssl.fastly.net" >> /etc/hosts \
ENV SERVER_VERSION 0.10.4
RUN set -e \
&& mkdir -p /root/hugegraph-server \
&& curl -L -S ${PKG_URL}/hugegraph/releases/download/v${SERVER_VERSION}/hugegraph-${SERVER_VERSION}.tar.gz -o /root/server.tar.gz \
&& tar xzf /root/server.tar.gz --strip-components 1 -C /root/hugegraph-server \
&& rm /root/server.tar.gz \
&& cd /root/hugegraph-server/ \
&& sed -i "s/^restserver.url.*$/restserver.url=http:\/\/0.0.0.0:8080/g" ./conf/rest-server.properties \
&& sed -n '63p' ./bin/start-hugegraph.sh | grep "&" > /dev/null && sed -i 63{s/\&$/#/g} ./bin/start-hugegraph.sh \
&& sed -n '74p' ./bin/start-hugegraph.sh | grep "exit" > /dev/null && sed -i 74{s/^/#/g} ./bin/start-hugegraph.sh \
&& ./bin/init-store.sh
# 3. Prepare for HugeGraph Studio
ENV STUDIO_VERSION 0.10.0
# (Optional) You can set the ip of github to speed up the local build
# && echo "192.30.253.112 github.com\n151.101.44.249 github.global.ssl.fastly.net" >> /etc/hosts \
RUN set -e \
&& mkdir -p /root/hugegraph-studio \
&& curl -L -S ${PKG_URL}/hugegraph-studio/releases/download/v${STUDIO_VERSION}/hugegraph-studio-${STUDIO_VERSION}.tar.gz -o /root/studio.tar.gz \
&& tar xzf /root/studio.tar.gz --strip-components 1 -C /root/hugegraph-studio \
&& rm /root/studio.tar.gz \
&& cd /root/hugegraph-studio/ \
&& sed -i "s/^studio.server.host.*$/studio.server.host=0.0.0.0/g" ./conf/hugegraph-studio.properties \
&& sed -i "s/^graph.server.host.*$/graph.server.host=0.0.0.0/g" ./conf/hugegraph-studio.properties
EXPOSE 8080 8088
WORKDIR /root
VOLUME /root
ENTRYPOINT ["./hugegraph-server/bin/start-hugegraph.sh"]

18
LICENSE
View File

@ -1,4 +1,4 @@
Apache License
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
@ -200,3 +200,19 @@ Apache License
See the License for the specific language governing permissions and
limitations under the License.
========================================================================
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

55
NOTICE Normal file
View File

@ -0,0 +1,55 @@
Apache HugeGraph(incubating)
Copyright 2022-2024 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
The initial codebase was donated to the ASF by HugeGraph Authors, copyright 2017-2021.
-----------------------------------------------------------------------
This product contains code form the Apache TinkerPop Project:
-----------------------------------------------------------------------
Apache TinkerPop
Copyright 2015-2022 The Apache Software Foundation.
------------------------------------------------------------------------
Activiti
------------------------------------------------------------------------
Activiti BPM Platform
Copyright 2010-2014 Alfresco Software, Ltd.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriterHelper.java
contains DelegatingXMLStreamWriter.java and IndentingXMLStreamWriter.java from
https://github.com/Activiti/Activiti/tree/activiti-5.16/modules/activiti-bpmn-converter/src/main/java/org/activiti/bpmn/converter
------------------------------------------------------------------------
Apache Kerby
------------------------------------------------------------------------
Apache Kerby
Copyright 2015-2017 The Apache Software Foundation
gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/auth/JaasKrbUtil.java
from
https://github.com/apache/directory-kerby/blob/kerby-all-1.0.0/kerby-kerb/kerb-simplekdc/src/main/java/org/apache/kerby/kerberos/kerb/client/JaasKrbUtil.java
-----------------------------------------------------------------------
This product contains code form the JanusGraph Project:
-----------------------------------------------------------------------
==============================================================
JanusGraph: Distributed Graph Database
Copyright 2012 with JanusGraph Authors
==============================================================
This product includes software developed by JanusGraph contributors listed
in CONTRIBUTORS.txt; JanusGraph copyright holders are listed in AUTHORS.txt.
This product is based on Titan, originally developed by Aurelius (acquired by
DataStax) and the following individuals:
* Matthias Broecheler
* Dan LaRocque
* Marko A. Rodriguez
* Stephen Mallette
* Pavel Yaskevich

View File

@ -1,35 +1,98 @@
# HugeGraph
<h1 align="center">
<img width="720" alt="hugegraph-logo" src="https://github.com/apache/incubator-hugegraph/assets/38098239/e02ffaed-4562-486b-ba8f-e68d02bb0ea6" style="zoom:100%;" />
</h1>
<h3 align="center">A graph database that supports more than 10 billion data, high performance and scalability</h3>
<div align="center">
[![License](https://img.shields.io/badge/license-Apache%202-0E78BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![Build Status](https://github.com/hugegraph/hugegraph/actions/workflows/ci.yml/badge.svg)](https://github.com/hugegraph/hugegraph/actions/workflows/ci.yml)
[![Codecov](https://codecov.io/gh/hugegraph/hugegraph/branch/master/graph/badge.svg)](https://codecov.io/gh/hugegraph/hugegraph)
[![Github Releases Downloads](https://img.shields.io/github/downloads/hugegraph/hugegraph/total.svg)](https://github.com/hugegraph/hugegraph/releases)
[![HugeGraph-CI](https://github.com/apache/incubator-hugegraph/actions/workflows/ci.yml/badge.svg)](https://github.com/apache/incubator-hugegraph/actions/workflows/ci.yml)
[![License checker](https://github.com/apache/incubator-hugegraph/actions/workflows/licence-checker.yml/badge.svg)](https://github.com/apache/incubator-hugegraph/actions/workflows/licence-checker.yml)
[![GitHub Releases Downloads](https://img.shields.io/github/downloads/apache/hugegraph/total.svg)](https://github.com/apache/hugegraph/releases)
</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).
HugeGraph 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 accomplished through [Gremlin](https://tinkerpop.apache.org/gremlin.html)(a powerful graph traversal language).
## Features
- Compliance to [Apache TinkerPop 3](https://tinkerpop.apache.org/), supporting [Gremlin](https://tinkerpop.apache.org/gremlin.html)
- 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, supporting RocksDB, Cassandra, ScyllaDB, HBase and MySQL now and easy to add other backend store driver if needed
- Integration with Hadoop/Spark
- 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
- Integration with `Flink/Spark/HDFS`, and friendly to connect other big data platforms
## Learn More
The [project homepage](https://hugegraph.github.io/hugegraph-doc/) contains more information on HugeGraph and provides links to documentation, getting-started guides and release downloads.
## Quick Start
## Contributing
### 1. Docker Way (Convenient for Test)
Welcome to contribute to HugeGraph, please see [`How to Contribute`](CONTRIBUTING.md) for more information.
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))
> 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.
### 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)
to download the latest release package and start the server.
### 3. Source Building Way
Visit [Source Building Page](https://hugegraph.apache.org/docs/quickstart/hugegraph-server/#33-source-code-compilation) and follow the
steps to build the source code and start the server.
The project [doc page](https://hugegraph.apache.org/docs/) contains more information on HugeGraph
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)
## License
HugeGraph is licensed under Apache 2.0 License.
HugeGraph is licensed under [Apache 2.0 License](LICENSE).
## Contributing
- Welcome to contribute to HugeGraph, please see [`How to Contribute`](CONTRIBUTING.md) & [Guidelines](https://hugegraph.apache.org/docs/contribution-guidelines/) for more information.
- Note: It's recommended to use [GitHub Desktop](https://desktop.github.com/) to greatly simplify the PR and commit process.
- Thank you to all the people who already contributed to HugeGraph!
[![contributors graph](https://contrib.rocks/image?repo=apache/hugegraph)](https://github.com/apache/incubator-hugegraph/graphs/contributors)
## Thanks
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
- [GitHub Issues](https://github.com/apache/incubator-hugegraph/issues): Feedback on usage issues and functional requirements (quick response)
- Feedback Email: [dev@hugegraph.apache.org](mailto:dev@hugegraph.apache.org) ([subscriber](https://hugegraph.apache.org/docs/contribution-guidelines/subscribe/) only)
- WeChat public account: Apache HugeGraph, welcome to scan this QR code to follow us.
<img src="https://github.com/apache/incubator-hugegraph-doc/blob/master/assets/images/wechat.png?raw=true" alt="QR png" width="300"/>

View File

@ -0,0 +1,63 @@
#
# 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

View File

@ -0,0 +1,63 @@
#
# 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

View File

@ -0,0 +1,63 @@
#
# 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

View File

@ -0,0 +1,57 @@
#
# 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

View File

@ -0,0 +1,57 @@
#
# 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

View File

@ -0,0 +1,57 @@
#
# 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

View File

@ -0,0 +1,19 @@
# 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

View File

@ -0,0 +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
#
# 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]
}
}

View File

@ -0,0 +1,127 @@
#
# 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
}

View File

@ -1,5 +1,20 @@
<?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>
@ -15,14 +30,14 @@
<!-- 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">
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" />
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<!-- Keep 5 files per day & auto delete after over 2GB or 100 files -->
<DefaultRolloverStrategy max="5">
@ -30,8 +45,8 @@
<IfFileName glob="*/*.log"/>
<!-- Limit log amount & size -->
<IfAny>
<IfAccumulatedFileSize exceeds="2GB" />
<IfAccumulatedFileCount exceeds="100" />
<IfAccumulatedFileSize exceeds="2GB"/>
<IfAccumulatedFileCount exceeds="100"/>
</IfAny>
</Delete>
</DefaultRolloverStrategy>
@ -39,15 +54,15 @@
<!-- 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">
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" />
<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">
@ -55,8 +70,32 @@
<IfFileName glob="*/*.gz"/>
<IfLastModified age="60d"/>
<IfAny>
<IfAccumulatedFileSize exceeds="5GB" />
<IfAccumulatedFileCount exceeds="500" />
<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>
@ -89,14 +128,17 @@
<appender-ref ref="file"/>
</logger>
<!-- Use mixed async way to output logs -->
<AsyncLogger name="com.baidu.hugegraph" level="INFO" additivity="false">
<AsyncLogger name="org.apache.hugegraph" level="INFO" additivity="false">
<appender-ref ref="file"/>
</AsyncLogger>
<AsyncLogger name="com.baidu.hugegraph.auth" level="INFO" additivity="false">
<AsyncLogger name="org.apache.hugegraph.auth" level="INFO" additivity="false">
<appender-ref ref="audit"/>
</AsyncLogger>
<AsyncLogger name="com.baidu.hugegraph.api.filter.AuthenticationFilter" level="INFO" additivity="false">
<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>

View File

@ -0,0 +1,30 @@
#
# 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
]
}
}

View File

@ -0,0 +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
#
# 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]
}
}

View File

@ -0,0 +1,28 @@
# 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

View File

@ -0,0 +1,19 @@
# 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

View File

@ -0,0 +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
#
# 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: 8182
serializer: {
className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
config: {
serializeResultToString: false,
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
}
}

View File

@ -0,0 +1,127 @@
#
# 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
}

View File

@ -0,0 +1,144 @@
<?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>

View File

@ -0,0 +1,30 @@
#
# 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: 8182
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
]
}
}

View File

@ -0,0 +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
#
# 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: 8182
serializer: {
className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
config: {
serializeResultToString: false,
ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry]
}
}

View File

@ -0,0 +1,26 @@
# 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

View File

@ -0,0 +1,19 @@
# 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

View File

@ -0,0 +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
#
# 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]
}
}

View File

@ -0,0 +1,127 @@
#
# 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
}

View File

@ -0,0 +1,144 @@
<?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>

View File

@ -0,0 +1,30 @@
#
# 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
]
}
}

View File

@ -0,0 +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
#
# 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]
}
}

View File

@ -0,0 +1,25 @@
# 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

View File

@ -0,0 +1,180 @@
#
# 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

58
docker/docker-compose.yml Normal file
View File

@ -0,0 +1,58 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
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

View File

@ -1,193 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.function.Consumer;
import javax.ws.rs.ForbiddenException;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.NotSupportedException;
import javax.ws.rs.core.MediaType;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeException;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.define.Checkable;
import com.baidu.hugegraph.metrics.MetricsUtil;
import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.JsonUtil;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.Meter;
import com.google.common.collect.ImmutableMap;
public class API {
private static final Logger LOG = Log.logger(RestServer.class);
public static final String CHARSET = "UTF-8";
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 JSON = MediaType.APPLICATION_JSON_TYPE
.getSubtype();
public static final String ACTION_APPEND = "append";
public static final String ACTION_ELIMINATE = "eliminate";
public static final String ACTION_CLEAR = "clear";
private static final Meter succeedMeter =
MetricsUtil.registerMeter(API.class, "commit-succeed");
private static final Meter illegalArgErrorMeter =
MetricsUtil.registerMeter(API.class, "illegal-arg");
private static final Meter expectedErrorMeter =
MetricsUtil.registerMeter(API.class, "expected-error");
private static final Meter unknownErrorMeter =
MetricsUtil.registerMeter(API.class, "unknown-error");
public static HugeGraph graph(GraphManager manager, String graph) {
HugeGraph g = manager.graph(graph);
if (g == null) {
throw new NotFoundException(String.format(
"Graph '%s' does not exist", graph));
}
return g;
}
public static HugeGraph graph4admin(GraphManager manager, String graph) {
return graph(manager, graph).hugegraph();
}
public static <R> R commit(HugeGraph g, Callable<R> callable) {
Consumer<Throwable> rollback = (error) -> {
if (error != null) {
LOG.error("Failed to commit", error);
}
try {
g.tx().rollback();
} catch (Throwable e) {
LOG.error("Failed to rollback", e);
}
};
try {
R result = callable.call();
g.tx().commit();
succeedMeter.mark();
return result;
} catch (IllegalArgumentException | NotFoundException |
ForbiddenException e) {
illegalArgErrorMeter.mark();
rollback.accept(null);
throw e;
} catch (RuntimeException e) {
expectedErrorMeter.mark();
rollback.accept(e);
throw e;
} catch (Throwable e) {
unknownErrorMeter.mark();
rollback.accept(e);
// TODO: throw the origin exception 'e'
throw new HugeException("Failed to commit", e);
}
}
public static void commit(HugeGraph g, Runnable runnable) {
commit(g, () -> {
runnable.run();
return null;
});
}
public static Object[] properties(Map<String, Object> properties) {
Object[] list = new Object[properties.size() * 2];
int i = 0;
for (Map.Entry<String, Object> prop : properties.entrySet()) {
list[i++] = prop.getKey();
list[i++] = prop.getValue();
}
return list;
}
protected static void checkCreatingBody(Checkable body) {
E.checkArgumentNotNull(body, "The request body can't be empty");
body.checkCreate(false);
}
protected static void checkUpdatingBody(Checkable body) {
E.checkArgumentNotNull(body, "The request body can't be empty");
body.checkUpdate();
}
protected static void checkCreatingBody(
Collection<? extends Checkable> bodys) {
E.checkArgumentNotNull(bodys, "The request body can't be empty");
for (Checkable body : bodys) {
E.checkArgument(body != null,
"The batch body can't contain null record");
body.checkCreate(true);
}
}
protected static void checkUpdatingBody(
Collection<? extends Checkable> bodys) {
E.checkArgumentNotNull(bodys, "The request body can't be empty");
for (Checkable body : bodys) {
E.checkArgumentNotNull(body,
"The batch body can't contain null record");
body.checkUpdate();
}
}
@SuppressWarnings("unchecked")
protected static Map<String, Object> parseProperties(String properties) {
if (properties == null || properties.isEmpty()) {
return ImmutableMap.of();
}
Map<String, Object> props = null;
try {
props = JsonUtil.fromJson(properties, Map.class);
} catch (Exception ignored) {}
// If properties is the string "null", props will be null
E.checkArgument(props != null,
"Invalid request with properties: %s", properties);
return props;
}
public static boolean checkAndParseAction(String action) {
E.checkArgumentNotNull(action, "The action param can't be empty");
if (action.equals(ACTION_APPEND)) {
return true;
} else if (action.equals(ACTION_ELIMINATE)) {
return false;
} else {
throw new NotSupportedException(
String.format("Not support action '%s'", action));
}
}
}

View File

@ -1,48 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.filter;
import javax.inject.Singleton;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.core.Context;
import javax.ws.rs.ext.Provider;
import com.baidu.hugegraph.define.WorkLoad;
@Provider
@Singleton
public class LoadReleaseFilter implements ContainerResponseFilter {
@Context
private javax.inject.Provider<WorkLoad> loadProvider;
@Override
public void filter(ContainerRequestContext requestContext,
ContainerResponseContext responseContext) {
if (LoadDetectFilter.isWhiteAPI(requestContext)) {
return;
}
WorkLoad load = this.loadProvider.get();
load.decrementAndGet();
}
}

View File

@ -1,164 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.gremlin;
import java.util.Map;
import java.util.Set;
import javax.inject.Singleton;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.api.filter.CompressInterceptor.Compress;
import com.baidu.hugegraph.config.HugeConfig;
import com.baidu.hugegraph.config.ServerOptions;
import com.baidu.hugegraph.exception.HugeGremlinException;
import com.baidu.hugegraph.metrics.MetricsUtil;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@Path("gremlin")
@Singleton
public class GremlinAPI extends API {
private static final Histogram gremlinInputHistogram =
MetricsUtil.registerHistogram(GremlinAPI.class, "gremlin-input");
private static final Histogram gremlinOutputHistogram =
MetricsUtil.registerHistogram(GremlinAPI.class, "gremlin-output");
private static final Set<String> FORBIDDEN_REQUEST_EXCEPTIONS =
ImmutableSet.of("java.lang.SecurityException",
"javax.ws.rs.ForbiddenException");
private static final Set<String> BAD_REQUEST_EXCEPTIONS = ImmutableSet.of(
"java.lang.IllegalArgumentException",
"java.util.concurrent.TimeoutException",
"groovy.lang.",
"org.codehaus.",
"com.baidu.hugegraph."
);
@Context
private javax.inject.Provider<HugeConfig> configProvider;
private GremlinClient client;
public GremlinClient client() {
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;
int maxRoutes = config.get(ServerOptions.GREMLIN_SERVER_MAX_ROUTE);
this.client = new GremlinClient(url, timeout, maxRoutes, maxRoutes);
return this.client;
}
@POST
@Timed
@Compress
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
public Response post(@Context HugeConfig conf,
@Context HttpHeaders headers,
String request) {
/* The following code is reserved for forwarding request */
// context.getRequestDispatcher(location).forward(request, response);
// return Response.seeOther(UriBuilder.fromUri(location).build())
// .build();
// Response.temporaryRedirect(UriBuilder.fromUri(location).build())
// .build();
String auth = headers.getHeaderString(HttpHeaders.AUTHORIZATION);
Response response = this.client().doPostRequest(auth, request);
gremlinInputHistogram.update(request.length());
gremlinOutputHistogram.update(response.getLength());
return transformResponseIfNeeded(response);
}
@GET
@Timed
@Compress(buffer=(1024 * 40))
@Produces(APPLICATION_JSON_WITH_CHARSET)
public Response get(@Context HugeConfig conf,
@Context HttpHeaders headers,
@Context UriInfo uriInfo) {
String auth = headers.getHeaderString(HttpHeaders.AUTHORIZATION);
String query = uriInfo.getRequestUri().getRawQuery();
MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
Response response = this.client().doGetRequest(auth, params);
gremlinInputHistogram.update(query.length());
gremlinOutputHistogram.update(response.getLength());
return transformResponseIfNeeded(response);
}
private static Response transformResponseIfNeeded(Response response) {
MediaType mediaType = response.getMediaType();
if (mediaType != null) {
// Append charset
assert MediaType.APPLICATION_JSON_TYPE.equals(mediaType);
response.getHeaders().putSingle(HttpHeaders.CONTENT_TYPE,
mediaType.withCharset(CHARSET));
}
Response.StatusType status = response.getStatusInfo();
if (status.getStatusCode() < 400) {
// No need to transform if normal response without error
return response;
}
if (mediaType == null || !JSON.equals(mediaType.getSubtype())) {
String message = response.readEntity(String.class);
throw new HugeGremlinException(status.getStatusCode(),
ImmutableMap.of("message", message));
}
@SuppressWarnings("unchecked")
Map<String, Object> map = response.readEntity(Map.class);
String exClassName = (String) map.get("Exception-Class");
if (FORBIDDEN_REQUEST_EXCEPTIONS.contains(exClassName)) {
status = Response.Status.FORBIDDEN;
} else if (matchBadRequestException(exClassName)) {
status = Response.Status.BAD_REQUEST;
}
throw new HugeGremlinException(status.getStatusCode(), map);
}
private static boolean matchBadRequestException(String exClass) {
if (exClass == null) {
return false;
}
if (BAD_REQUEST_EXCEPTIONS.contains(exClass)) {
return true;
}
return BAD_REQUEST_EXCEPTIONS.stream().anyMatch(exClass::startsWith);
}
}

View File

@ -1,78 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.gremlin;
import java.util.List;
import java.util.Map;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import com.baidu.hugegraph.api.filter.CompressInterceptor;
import com.baidu.hugegraph.rest.AbstractRestClient;
import com.baidu.hugegraph.testutil.Whitebox;
import com.baidu.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();
}
}

View File

@ -1,161 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.metrics;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.annotation.security.RolesAllowed;
import javax.inject.Singleton;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.backend.store.BackendMetrics;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.metrics.MetricsModule;
import com.baidu.hugegraph.metrics.ServerReporter;
import com.baidu.hugegraph.metrics.SystemMetrics;
import com.baidu.hugegraph.util.InsertionOrderUtil;
import com.baidu.hugegraph.util.JsonUtil;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.Metric;
import com.codahale.metrics.annotation.Timed;
@Singleton
@Path("metrics")
public class MetricsAPI extends API {
private static final Logger LOG = Log.logger(MetricsAPI.class);
private SystemMetrics systemMetrics;
static {
JsonUtil.registerModule(new MetricsModule(SECONDS, MILLISECONDS, false));
}
public MetricsAPI() {
this.systemMetrics = new SystemMetrics();
}
@GET
@Timed
@Path("system")
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin", "$owner= $action=metrics_read"})
public String system() {
return JsonUtil.toJson(this.systemMetrics.metrics());
}
@GET
@Timed
@Path("backend")
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin", "$owner= $action=metrics_read"})
public String backend(@Context GraphManager manager) {
Map<String, Map<String, Object>> results = InsertionOrderUtil.newMap();
for (String graph : manager.graphs()) {
HugeGraph g = manager.graph(graph);
Map<String, Object> metrics = InsertionOrderUtil.newMap();
metrics.put(BackendMetrics.BACKEND, g.backend());
try {
metrics.putAll(g.metadata(null, "metrics"));
} catch (Throwable e) {
metrics.put(BackendMetrics.EXCEPTION, e.toString());
LOG.debug("Failed to get backend metrics", e);
}
results.put(graph, metrics);
}
return JsonUtil.toJson(results);
}
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin", "$owner= $action=metrics_read"})
public String all() {
ServerReporter reporter = ServerReporter.instance();
Map<String, Map<String, ? extends Metric>> result = new LinkedHashMap<>();
result.put("gauges", reporter.gauges());
result.put("counters", reporter.counters());
result.put("histograms", reporter.histograms());
result.put("meters", reporter.meters());
result.put("timers", reporter.timers());
return JsonUtil.toJson(result);
}
@GET
@Timed
@Path("gauges")
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin", "$owner= $action=metrics_read"})
public String gauges() {
ServerReporter reporter = ServerReporter.instance();
return JsonUtil.toJson(reporter.gauges());
}
@GET
@Timed
@Path("counters")
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin", "$owner= $action=metrics_read"})
public String counters() {
ServerReporter reporter = ServerReporter.instance();
return JsonUtil.toJson(reporter.counters());
}
@GET
@Timed
@Path("histograms")
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin", "$owner= $action=metrics_read"})
public String histograms() {
ServerReporter reporter = ServerReporter.instance();
return JsonUtil.toJson(reporter.histograms());
}
@GET
@Timed
@Path("meters")
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin", "$owner= $action=metrics_read"})
public String meters() {
ServerReporter reporter = ServerReporter.instance();
return JsonUtil.toJson(reporter.meters());
}
@GET
@Timed
@Path("timers")
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin", "$owner= $action=metrics_read"})
public String timers() {
ServerReporter reporter = ServerReporter.instance();
return JsonUtil.toJson(reporter.timers());
}
}

View File

@ -1,51 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.profile;
import java.util.Map;
import javax.annotation.security.PermitAll;
import javax.inject.Singleton;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.version.ApiVersion;
import com.baidu.hugegraph.version.CoreVersion;
import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.ImmutableMap;
@Path("versions")
@Singleton
public class VersionAPI extends API {
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
@PermitAll
public Object list() {
Map<String, String> versions = ImmutableMap.of("version", "v1",
"core", CoreVersion.VERSION.toString(),
"gremlin", CoreVersion.GREMLIN_VERSION,
"api", ApiVersion.VERSION.toString());
return ImmutableMap.of("versions", versions);
}
}

View File

@ -1,94 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.traversers;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_CAPACITY;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
import java.util.List;
import javax.inject.Singleton;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.ShortestPathTraverser;
import com.baidu.hugegraph.type.define.Directions;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.ImmutableList;
@Path("graphs/{graph}/traversers/allshortestpaths")
@Singleton
public class AllShortestPathsAPI extends API {
private static final Logger LOG = Log.logger(RestServer.class);
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String get(@Context GraphManager manager,
@PathParam("graph") String graph,
@QueryParam("source") String source,
@QueryParam("target") String target,
@QueryParam("direction") String direction,
@QueryParam("label") String edgeLabel,
@QueryParam("max_depth") int depth,
@QueryParam("max_degree")
@DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree,
@QueryParam("skip_degree")
@DefaultValue("0") long skipDegree,
@QueryParam("capacity")
@DefaultValue(DEFAULT_CAPACITY) long capacity) {
LOG.debug("Graph [{}] get shortest path from '{}', to '{}' with " +
"direction {}, edge label {}, max depth '{}', " +
"max degree '{}', skipped degree '{}' and capacity '{}'",
graph, source, target, direction, edgeLabel, depth,
maxDegree, skipDegree, capacity);
Id sourceId = VertexAPI.checkAndParseVertexId(source);
Id targetId = VertexAPI.checkAndParseVertexId(target);
Directions dir = Directions.convert(EdgeAPI.parseDirection(direction));
HugeGraph g = graph(manager, graph);
ShortestPathTraverser traverser = new ShortestPathTraverser(g);
List<String> edgeLabels = edgeLabel == null ? ImmutableList.of() :
ImmutableList.of(edgeLabel);
HugeTraverser.PathSet paths = traverser.allShortestPaths(
sourceId, targetId, dir, edgeLabels,
depth, maxDegree, skipDegree, capacity);
return manager.serializer(g).writePaths("paths", paths, false);
}
}

View File

@ -1,190 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.traversers;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_ELEMENTS_LIMIT;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.inject.Singleton;
import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.Query;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.structure.HugeVertex;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.KneighborTraverser;
import com.baidu.hugegraph.traversal.algorithm.records.KneighborRecords;
import com.baidu.hugegraph.traversal.algorithm.steps.EdgeStep;
import com.baidu.hugegraph.type.define.Directions;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableList;
@Path("graphs/{graph}/traversers/kneighbor")
@Singleton
public class KneighborAPI extends TraverserAPI {
private static final Logger LOG = Log.logger(RestServer.class);
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String get(@Context GraphManager manager,
@PathParam("graph") String graph,
@QueryParam("source") String sourceV,
@QueryParam("direction") String direction,
@QueryParam("label") String edgeLabel,
@QueryParam("max_depth") int depth,
@QueryParam("max_degree")
@DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree,
@QueryParam("limit")
@DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) {
LOG.debug("Graph [{}] get k-neighbor from '{}' with " +
"direction '{}', edge label '{}', max depth '{}', " +
"max degree '{}' and limit '{}'",
graph, sourceV, direction, edgeLabel, depth,
maxDegree, limit);
Id source = VertexAPI.checkAndParseVertexId(sourceV);
Directions dir = Directions.convert(EdgeAPI.parseDirection(direction));
HugeGraph g = graph(manager, graph);
Set<Id> ids;
try (KneighborTraverser traverser = new KneighborTraverser(g)) {
ids = traverser.kneighbor(source, dir, edgeLabel,
depth, maxDegree, limit);
}
return manager.serializer(g).writeList("vertices", ids);
}
@POST
@Timed
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String post(@Context GraphManager manager,
@PathParam("graph") String graph,
Request request) {
E.checkArgumentNotNull(request, "The request body can't be null");
E.checkArgumentNotNull(request.source,
"The source of request can't be null");
E.checkArgument(request.step != null,
"The steps of request can't be null");
if (request.countOnly) {
E.checkArgument(!request.withVertex && !request.withPath,
"Can't return vertex or path when count only");
}
LOG.debug("Graph [{}] get customized kneighbor from source vertex " +
"'{}', with step '{}', limit '{}', count_only '{}', " +
"with_vertex '{}' and with_path '{}'",
graph, request.source, request.step, request.limit,
request.countOnly, request.withVertex, request.withPath);
HugeGraph g = graph(manager, graph);
Id sourceId = HugeVertex.getIdValue(request.source);
EdgeStep step = step(g, request.step);
KneighborRecords results;
try (KneighborTraverser traverser = new KneighborTraverser(g)) {
results = traverser.customizedKneighbor(sourceId, step,
request.maxDepth,
request.limit);
}
long size = results.size();
if (request.limit != Query.NO_LIMIT && size > request.limit) {
size = request.limit;
}
List<Id> neighbors = request.countOnly ?
ImmutableList.of() : results.ids(request.limit);
HugeTraverser.PathSet paths = new HugeTraverser.PathSet();
if (request.withPath) {
paths.addAll(results.paths(request.limit));
}
Iterator<Vertex> iter = QueryResults.emptyIterator();
if (request.withVertex && !request.countOnly) {
Set<Id> ids = new HashSet<>(neighbors);
if (request.withPath) {
for (HugeTraverser.Path p : paths) {
ids.addAll(p.vertices());
}
}
if (!ids.isEmpty()) {
iter = g.vertices(ids.toArray());
}
}
return manager.serializer(g).writeNodesWithPath("kneighbor", neighbors,
size, paths, iter);
}
private static class Request {
@JsonProperty("source")
public Object source;
@JsonProperty("step")
public TraverserAPI.Step step;
@JsonProperty("max_depth")
public int maxDepth;
@JsonProperty("limit")
public long limit = Long.parseLong(DEFAULT_ELEMENTS_LIMIT);
@JsonProperty("count_only")
public boolean countOnly = false;
@JsonProperty("with_vertex")
public boolean withVertex = false;
@JsonProperty("with_path")
public boolean withPath = false;
@Override
public String toString() {
return String.format("PathRequest{source=%s,step=%s,maxDepth=%s" +
"limit=%s,countOnly=%s,withVertex=%s," +
"withPath=%s}", this.source, this.step,
this.maxDepth, this.limit, this.countOnly,
this.withVertex, this.withPath);
}
}
}

View File

@ -1,204 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.traversers;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_CAPACITY;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_ELEMENTS_LIMIT;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.inject.Singleton;
import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.Query;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.structure.HugeVertex;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.KoutTraverser;
import com.baidu.hugegraph.traversal.algorithm.records.KoutRecords;
import com.baidu.hugegraph.traversal.algorithm.steps.EdgeStep;
import com.baidu.hugegraph.type.define.Directions;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableList;
@Path("graphs/{graph}/traversers/kout")
@Singleton
public class KoutAPI extends TraverserAPI {
private static final Logger LOG = Log.logger(RestServer.class);
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String get(@Context GraphManager manager,
@PathParam("graph") String graph,
@QueryParam("source") String source,
@QueryParam("direction") String direction,
@QueryParam("label") String edgeLabel,
@QueryParam("max_depth") int depth,
@QueryParam("nearest")
@DefaultValue("true") boolean nearest,
@QueryParam("max_degree")
@DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree,
@QueryParam("capacity")
@DefaultValue(DEFAULT_CAPACITY) long capacity,
@QueryParam("limit")
@DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) {
LOG.debug("Graph [{}] get k-out from '{}' with " +
"direction '{}', edge label '{}', max depth '{}', nearest " +
"'{}', max degree '{}', capacity '{}' and limit '{}'",
graph, source, direction, edgeLabel, depth, nearest,
maxDegree, capacity, limit);
Id sourceId = VertexAPI.checkAndParseVertexId(source);
Directions dir = Directions.convert(EdgeAPI.parseDirection(direction));
HugeGraph g = graph(manager, graph);
Set<Id> ids;
try (KoutTraverser traverser = new KoutTraverser(g)) {
ids = traverser.kout(sourceId, dir, edgeLabel, depth,
nearest, maxDegree, capacity, limit);
}
return manager.serializer(g).writeList("vertices", ids);
}
@POST
@Timed
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String post(@Context GraphManager manager,
@PathParam("graph") String graph,
Request request) {
E.checkArgumentNotNull(request, "The request body can't be null");
E.checkArgumentNotNull(request.source,
"The source of request can't be null");
E.checkArgument(request.step != null,
"The steps of request can't be null");
if (request.countOnly) {
E.checkArgument(!request.withVertex && !request.withPath,
"Can't return vertex or path when count only");
}
LOG.debug("Graph [{}] get customized kout from source vertex '{}', " +
"with step '{}', max_depth '{}', nearest '{}', " +
"count_only '{}', capacity '{}', limit '{}', " +
"with_vertex '{}' and with_path '{}'",
graph, request.source, request.step, request.maxDepth,
request.nearest, request.countOnly, request.capacity,
request.limit, request.withVertex, request.withPath);
HugeGraph g = graph(manager, graph);
Id sourceId = HugeVertex.getIdValue(request.source);
EdgeStep step = step(g, request.step);
KoutRecords results;
try (KoutTraverser traverser = new KoutTraverser(g)) {
results = traverser.customizedKout(sourceId, step,
request.maxDepth,
request.nearest,
request.capacity,
request.limit);
}
long size = results.size();
if (request.limit != Query.NO_LIMIT && size > request.limit) {
size = request.limit;
}
List<Id> neighbors = request.countOnly ?
ImmutableList.of() : results.ids(request.limit);
HugeTraverser.PathSet paths = new HugeTraverser.PathSet();
if (request.withPath) {
paths.addAll(results.paths(request.limit));
}
Iterator<Vertex> iter = QueryResults.emptyIterator();
if (request.withVertex && !request.countOnly) {
Set<Id> ids = new HashSet<>(neighbors);
if (request.withPath) {
for (HugeTraverser.Path p : paths) {
ids.addAll(p.vertices());
}
}
if (!ids.isEmpty()) {
iter = g.vertices(ids.toArray());
}
}
return manager.serializer(g).writeNodesWithPath("kout", neighbors,
size, paths, iter);
}
private static class Request {
@JsonProperty("source")
public Object source;
@JsonProperty("step")
public TraverserAPI.Step step;
@JsonProperty("max_depth")
public int maxDepth;
@JsonProperty("nearest")
public boolean nearest = true;
@JsonProperty("count_only")
public boolean countOnly = false;
@JsonProperty("capacity")
public long capacity = Long.parseLong(DEFAULT_CAPACITY);
@JsonProperty("limit")
public long limit = Long.parseLong(DEFAULT_ELEMENTS_LIMIT);
@JsonProperty("with_vertex")
public boolean withVertex = false;
@JsonProperty("with_path")
public boolean withPath = false;
@Override
public String toString() {
return String.format("KoutRequest{source=%s,step=%s,maxDepth=%s" +
"nearest=%s,countOnly=%s,capacity=%s," +
"limit=%s,withVertex=%s,withPath=%s}",
this.source, this.step, this.maxDepth,
this.nearest, this.countOnly, this.capacity,
this.limit, this.withVertex, this.withPath);
}
}
}

View File

@ -1,127 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.traversers;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_CAPACITY;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.inject.Singleton;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.steps.EdgeStep;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonProperty;
@Path("graphs/{graph}/traversers/multinodeshortestpath")
@Singleton
public class MultiNodeShortestPathAPI extends TraverserAPI {
private static final Logger LOG = Log.logger(RestServer.class);
@POST
@Timed
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String post(@Context GraphManager manager,
@PathParam("graph") String graph,
Request request) {
E.checkArgumentNotNull(request, "The request body can't be null");
E.checkArgumentNotNull(request.vertices,
"The vertices of request can't be null");
E.checkArgument(request.step != null,
"The steps of request can't be null");
LOG.debug("Graph [{}] get multiple node shortest path from " +
"vertices '{}', with step '{}', max_depth '{}', capacity " +
"'{}' and with_vertex '{}'",
graph, request.vertices, request.step, request.maxDepth,
request.capacity, request.withVertex);
HugeGraph g = graph(manager, graph);
Iterator<Vertex> vertices = request.vertices.vertices(g);
EdgeStep step = step(g, request.step);
List<HugeTraverser.Path> paths;
try (MultiNodeShortestPathTraverser traverser =
new MultiNodeShortestPathTraverser(g)) {
paths = traverser.multiNodeShortestPath(vertices, step,
request.maxDepth,
request.capacity);
}
if (!request.withVertex) {
return manager.serializer(g).writePaths("paths", paths, false);
}
Set<Id> ids = new HashSet<>();
for (HugeTraverser.Path p : paths) {
ids.addAll(p.vertices());
}
Iterator<Vertex> iter = QueryResults.emptyIterator();
if (!ids.isEmpty()) {
iter = g.vertices(ids.toArray());
}
return manager.serializer(g).writePaths("paths", paths, false, iter);
}
private static class Request {
@JsonProperty("vertices")
public Vertices vertices;
@JsonProperty("step")
public Step step;
@JsonProperty("max_depth")
public int maxDepth;
@JsonProperty("capacity")
public long capacity = Long.parseLong(DEFAULT_CAPACITY);
@JsonProperty("with_vertex")
public boolean withVertex = false;
@Override
public String toString() {
return String.format("Request{vertices=%s,step=%s,maxDepth=%s" +
"capacity=%s,withVertex=%s}",
this.vertices, this.step, this.maxDepth,
this.capacity, this.withVertex);
}
}
}

View File

@ -1,183 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.traversers;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_CAPACITY;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_PATHS_LIMIT;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import javax.inject.Singleton;
import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.CollectionPathsTraverser;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.PathsTraverser;
import com.baidu.hugegraph.traversal.algorithm.steps.EdgeStep;
import com.baidu.hugegraph.type.define.Directions;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonProperty;
@Path("graphs/{graph}/traversers/paths")
@Singleton
public class PathsAPI extends TraverserAPI {
private static final Logger LOG = Log.logger(RestServer.class);
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String get(@Context GraphManager manager,
@PathParam("graph") String graph,
@QueryParam("source") String source,
@QueryParam("target") String target,
@QueryParam("direction") String direction,
@QueryParam("label") String edgeLabel,
@QueryParam("max_depth") int depth,
@QueryParam("max_degree")
@DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree,
@QueryParam("capacity")
@DefaultValue(DEFAULT_CAPACITY) long capacity,
@QueryParam("limit")
@DefaultValue(DEFAULT_PATHS_LIMIT) long limit) {
LOG.debug("Graph [{}] get paths from '{}', to '{}' with " +
"direction {}, edge label {}, max depth '{}', " +
"max degree '{}', capacity '{}' and limit '{}'",
graph, source, target, direction, edgeLabel, depth,
maxDegree, capacity, limit);
Id sourceId = VertexAPI.checkAndParseVertexId(source);
Id targetId = VertexAPI.checkAndParseVertexId(target);
Directions dir = Directions.convert(EdgeAPI.parseDirection(direction));
HugeGraph g = graph(manager, graph);
PathsTraverser traverser = new PathsTraverser(g);
HugeTraverser.PathSet paths = traverser.paths(sourceId, dir, targetId,
dir.opposite(), edgeLabel,
depth, maxDegree, capacity,
limit);
return manager.serializer(g).writePaths("paths", paths, false);
}
@POST
@Timed
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String post(@Context GraphManager manager,
@PathParam("graph") String graph,
Request request) {
E.checkArgumentNotNull(request, "The request body can't be null");
E.checkArgumentNotNull(request.sources,
"The sources of request can't be null");
E.checkArgumentNotNull(request.targets,
"The targets of request can't be null");
E.checkArgumentNotNull(request.step,
"The step of request can't be null");
E.checkArgument(request.depth > 0,
"The depth of request must be > 0, but got: %s",
request.depth);
LOG.debug("Graph [{}] get paths from source vertices '{}', target " +
"vertices '{}', with step '{}', max depth '{}', " +
"capacity '{}', limit '{}' and with_vertex '{}'",
graph, request.sources, request.targets, request.step,
request.depth, request.capacity, request.limit,
request.withVertex);
HugeGraph g = graph(manager, graph);
Iterator<Vertex> sources = request.sources.vertices(g);
Iterator<Vertex> targets = request.targets.vertices(g);
EdgeStep step = step(g, request.step);
CollectionPathsTraverser traverser = new CollectionPathsTraverser(g);
Collection<HugeTraverser.Path> paths;
paths = traverser.paths(sources, targets, step, request.depth,
request.nearest, request.capacity,
request.limit);
if (!request.withVertex) {
return manager.serializer(g).writePaths("paths", paths, false);
}
Set<Id> ids = new HashSet<>();
for (HugeTraverser.Path p : paths) {
ids.addAll(p.vertices());
}
Iterator<Vertex> iter = QueryResults.emptyIterator();
if (!ids.isEmpty()) {
iter = g.vertices(ids.toArray());
}
return manager.serializer(g).writePaths("paths", paths, false, iter);
}
private static class Request {
@JsonProperty("sources")
public Vertices sources;
@JsonProperty("targets")
public Vertices targets;
@JsonProperty("step")
public TraverserAPI.Step step;
@JsonProperty("max_depth")
public int depth;
@JsonProperty("nearest")
public boolean nearest = false;
@JsonProperty("capacity")
public long capacity = Long.parseLong(DEFAULT_CAPACITY);
@JsonProperty("limit")
public long limit = Long.parseLong(DEFAULT_PATHS_LIMIT);
@JsonProperty("with_vertex")
public boolean withVertex = false;
@Override
public String toString() {
return String.format("PathRequest{sources=%s,targets=%s,step=%s," +
"maxDepth=%s,nearest=%s,capacity=%s," +
"limit=%s,withVertex=%s}", this.sources,
this.targets, this.step, this.depth,
this.nearest, this.capacity,
this.limit, this.withVertex);
}
}
}

View File

@ -1,88 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.traversers;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_CAPACITY;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_PATHS_LIMIT;
import javax.inject.Singleton;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.SubGraphTraverser;
import com.baidu.hugegraph.type.define.Directions;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
@Path("graphs/{graph}/traversers/rays")
@Singleton
public class RaysAPI extends API {
private static final Logger LOG = Log.logger(RestServer.class);
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String get(@Context GraphManager manager,
@PathParam("graph") String graph,
@QueryParam("source") String sourceV,
@QueryParam("direction") String direction,
@QueryParam("label") String edgeLabel,
@QueryParam("max_depth") int depth,
@QueryParam("max_degree")
@DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree,
@QueryParam("capacity")
@DefaultValue(DEFAULT_CAPACITY) long capacity,
@QueryParam("limit")
@DefaultValue(DEFAULT_PATHS_LIMIT) long limit) {
LOG.debug("Graph [{}] get rays paths from '{}' with " +
"direction '{}', edge label '{}', max depth '{}', " +
"max degree '{}', capacity '{}' and limit '{}'",
graph, sourceV, direction, edgeLabel, depth, maxDegree,
capacity, limit);
Id source = VertexAPI.checkAndParseVertexId(sourceV);
Directions dir = Directions.convert(EdgeAPI.parseDirection(direction));
HugeGraph g = graph(manager, graph);
SubGraphTraverser traverser = new SubGraphTraverser(g);
HugeTraverser.PathSet paths = traverser.rays(source, dir, edgeLabel,
depth, maxDegree,
capacity, limit);
return manager.serializer(g).writePaths("rays", paths, false);
}
}

View File

@ -1,91 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.traversers;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_CAPACITY;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_PATHS_LIMIT;
import javax.inject.Singleton;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.SubGraphTraverser;
import com.baidu.hugegraph.type.define.Directions;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
@Path("graphs/{graph}/traversers/rings")
@Singleton
public class RingsAPI extends API {
private static final Logger LOG = Log.logger(RestServer.class);
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String get(@Context GraphManager manager,
@PathParam("graph") String graph,
@QueryParam("source") String sourceV,
@QueryParam("direction") String direction,
@QueryParam("label") String edgeLabel,
@QueryParam("max_depth") int depth,
@QueryParam("source_in_ring")
@DefaultValue("true") boolean sourceInRing,
@QueryParam("max_degree")
@DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree,
@QueryParam("capacity")
@DefaultValue(DEFAULT_CAPACITY) long capacity,
@QueryParam("limit")
@DefaultValue(DEFAULT_PATHS_LIMIT) long limit) {
LOG.debug("Graph [{}] get rings paths reachable from '{}' with " +
"direction '{}', edge label '{}', max depth '{}', " +
"source in ring '{}', max degree '{}', capacity '{}' " +
"and limit '{}'",
graph, sourceV, direction, edgeLabel, depth, sourceInRing,
maxDegree, capacity, limit);
Id source = VertexAPI.checkAndParseVertexId(sourceV);
Directions dir = Directions.convert(EdgeAPI.parseDirection(direction));
HugeGraph g = graph(manager, graph);
SubGraphTraverser traverser = new SubGraphTraverser(g);
HugeTraverser.PathSet paths = traverser.rings(source, dir, edgeLabel,
depth, sourceInRing,
maxDegree, capacity, limit);
return manager.serializer(g).writePaths("rings", paths, false);
}
}

View File

@ -1,83 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.traversers;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_ELEMENTS_LIMIT;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
import java.util.Set;
import javax.inject.Singleton;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.SameNeighborTraverser;
import com.baidu.hugegraph.type.define.Directions;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
@Path("graphs/{graph}/traversers/sameneighbors")
@Singleton
public class SameNeighborsAPI extends API {
private static final Logger LOG = Log.logger(RestServer.class);
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String get(@Context GraphManager manager,
@PathParam("graph") String graph,
@QueryParam("vertex") String vertex,
@QueryParam("other") String other,
@QueryParam("direction") String direction,
@QueryParam("label") String edgeLabel,
@QueryParam("max_degree")
@DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree,
@QueryParam("limit")
@DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) {
LOG.debug("Graph [{}] get same neighbors between '{}' and '{}' with " +
"direction {}, edge label {}, max degree '{}' and limit '{}'",
graph, vertex, other, direction, edgeLabel, maxDegree, limit);
Id sourceId = VertexAPI.checkAndParseVertexId(vertex);
Id targetId = VertexAPI.checkAndParseVertexId(other);
Directions dir = Directions.convert(EdgeAPI.parseDirection(direction));
HugeGraph g = graph(manager, graph);
SameNeighborTraverser traverser = new SameNeighborTraverser(g);
Set<Id> neighbors = traverser.sameNeighbors(sourceId, targetId, dir,
edgeLabel, maxDegree, limit);
return manager.serializer(g).writeList("same_neighbors", neighbors);
}
}

View File

@ -1,95 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.traversers;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_CAPACITY;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
import java.util.List;
import javax.inject.Singleton;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.ShortestPathTraverser;
import com.baidu.hugegraph.type.define.Directions;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.ImmutableList;
@Path("graphs/{graph}/traversers/shortestpath")
@Singleton
public class ShortestPathAPI extends API {
private static final Logger LOG = Log.logger(RestServer.class);
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String get(@Context GraphManager manager,
@PathParam("graph") String graph,
@QueryParam("source") String source,
@QueryParam("target") String target,
@QueryParam("direction") String direction,
@QueryParam("label") String edgeLabel,
@QueryParam("max_depth") int depth,
@QueryParam("max_degree")
@DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree,
@QueryParam("skip_degree")
@DefaultValue("0") long skipDegree,
@QueryParam("capacity")
@DefaultValue(DEFAULT_CAPACITY) long capacity) {
LOG.debug("Graph [{}] get shortest path from '{}', to '{}' with " +
"direction {}, edge label {}, max depth '{}', " +
"max degree '{}', skipped maxDegree '{}' and capacity '{}'",
graph, source, target, direction, edgeLabel, depth,
maxDegree, skipDegree, capacity);
Id sourceId = VertexAPI.checkAndParseVertexId(source);
Id targetId = VertexAPI.checkAndParseVertexId(target);
Directions dir = Directions.convert(EdgeAPI.parseDirection(direction));
HugeGraph g = graph(manager, graph);
ShortestPathTraverser traverser = new ShortestPathTraverser(g);
List<String> edgeLabels = edgeLabel == null ? ImmutableList.of() :
ImmutableList.of(edgeLabel);
HugeTraverser.Path path = traverser.shortestPath(sourceId, targetId,
dir, edgeLabels, depth,
maxDegree, skipDegree,
capacity);
return manager.serializer(g).writeList("path", path.vertices());
}
}

View File

@ -1,100 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.traversers;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_CAPACITY;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_PATHS_LIMIT;
import java.util.Iterator;
import javax.inject.Singleton;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser;
import com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser.WeightedPaths;
import com.baidu.hugegraph.type.define.Directions;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
@Path("graphs/{graph}/traversers/singlesourceshortestpath")
@Singleton
public class SingleSourceShortestPathAPI extends API {
private static final Logger LOG = Log.logger(RestServer.class);
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String get(@Context GraphManager manager,
@PathParam("graph") String graph,
@QueryParam("source") String source,
@QueryParam("direction") String direction,
@QueryParam("label") String edgeLabel,
@QueryParam("weight") String weight,
@QueryParam("max_degree")
@DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree,
@QueryParam("skip_degree")
@DefaultValue("0") long skipDegree,
@QueryParam("capacity")
@DefaultValue(DEFAULT_CAPACITY) long capacity,
@QueryParam("limit")
@DefaultValue(DEFAULT_PATHS_LIMIT) long limit,
@QueryParam("with_vertex") boolean withVertex) {
LOG.debug("Graph [{}] get single source shortest path from '{}' " +
"with direction {}, edge label {}, weight property {}, " +
"max degree '{}', limit '{}' and with vertex '{}'",
graph, source, direction, edgeLabel,
weight, maxDegree, withVertex);
Id sourceId = VertexAPI.checkAndParseVertexId(source);
Directions dir = Directions.convert(EdgeAPI.parseDirection(direction));
HugeGraph g = graph(manager, graph);
SingleSourceShortestPathTraverser traverser =
new SingleSourceShortestPathTraverser(g);
WeightedPaths paths = traverser.singleSourceShortestPaths(
sourceId, dir, edgeLabel, weight,
maxDegree, skipDegree, capacity, limit);
Iterator<Vertex> iterator = QueryResults.emptyIterator();
assert paths != null;
if (!paths.isEmpty() && withVertex) {
iterator = g.vertices(paths.vertices().toArray());
}
return manager.serializer(g).writeWeightedPaths(paths, iterator);
}
}

View File

@ -1,63 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.traversers;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
import java.util.List;
import java.util.Map;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.traversal.algorithm.steps.EdgeStep;
import com.baidu.hugegraph.type.define.Directions;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonProperty;
public class TraverserAPI extends API {
protected static EdgeStep step(HugeGraph graph, Step step) {
return new EdgeStep(graph, step.direction, step.labels, step.properties,
step.maxDegree, step.skipDegree);
}
protected static class Step {
@JsonProperty("direction")
public Directions direction;
@JsonProperty("labels")
public List<String> labels;
@JsonProperty("properties")
public Map<String, Object> properties;
@JsonAlias("degree")
@JsonProperty("max_degree")
public long maxDegree = Long.parseLong(DEFAULT_MAX_DEGREE);
@JsonProperty("skip_degree")
public long skipDegree = 0L;
@Override
public String toString() {
return String.format("Step{direction=%s,labels=%s,properties=%s," +
"maxDegree=%s,skipDegree=%s}",
this.direction, this.labels, this.properties,
this.maxDegree, this.skipDegree);
}
}
}

View File

@ -1,103 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.api.traversers;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_CAPACITY;
import static com.baidu.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
import java.util.Iterator;
import javax.inject.Singleton;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser;
import com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser.NodeWithWeight;
import com.baidu.hugegraph.type.define.Directions;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
@Path("graphs/{graph}/traversers/weightedshortestpath")
@Singleton
public class WeightedShortestPathAPI extends API {
private static final Logger LOG = Log.logger(RestServer.class);
@GET
@Timed
@Produces(APPLICATION_JSON_WITH_CHARSET)
public String get(@Context GraphManager manager,
@PathParam("graph") String graph,
@QueryParam("source") String source,
@QueryParam("target") String target,
@QueryParam("direction") String direction,
@QueryParam("label") String edgeLabel,
@QueryParam("weight") String weight,
@QueryParam("max_degree")
@DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree,
@QueryParam("skip_degree")
@DefaultValue("0") long skipDegree,
@QueryParam("capacity")
@DefaultValue(DEFAULT_CAPACITY) long capacity,
@QueryParam("with_vertex") boolean withVertex) {
LOG.debug("Graph [{}] get weighted shortest path between '{}' and " +
"'{}' with direction {}, edge label {}, weight property {}, " +
"max degree '{}', skip degree '{}', capacity '{}', " +
"and with vertex '{}'",
graph, source, target, direction, edgeLabel, weight,
maxDegree, skipDegree, capacity, withVertex);
Id sourceId = VertexAPI.checkAndParseVertexId(source);
Id targetId = VertexAPI.checkAndParseVertexId(target);
Directions dir = Directions.convert(EdgeAPI.parseDirection(direction));
E.checkArgumentNotNull(weight, "The weight property can't be null");
HugeGraph g = graph(manager, graph);
SingleSourceShortestPathTraverser traverser =
new SingleSourceShortestPathTraverser(g);
NodeWithWeight path = traverser.weightedShortestPath(
sourceId, targetId, dir, edgeLabel, weight,
maxDegree, skipDegree, capacity);
Iterator<Vertex> iterator = QueryResults.emptyIterator();
if (path != null && withVertex) {
assert !path.node().path().isEmpty();
iterator = g.vertices(path.node().path().toArray());
}
return manager.serializer(g).writeWeightedPath(path, iterator);
}
}

View File

@ -1,333 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.auth;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.configuration.Configuration;
import com.baidu.hugegraph.HugeException;
import com.baidu.hugegraph.HugeFactory;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.StandardHugeGraph;
import com.baidu.hugegraph.backend.cache.CacheManager;
import com.baidu.hugegraph.backend.tx.AbstractTransaction;
import com.baidu.hugegraph.concurrent.LockManager;
import com.baidu.hugegraph.license.LicenseVerifier;
import com.baidu.hugegraph.metrics.ServerReporter;
import com.baidu.hugegraph.schema.SchemaElement;
import com.baidu.hugegraph.schema.SchemaManager;
import com.baidu.hugegraph.schema.builder.EdgeLabelBuilder;
import com.baidu.hugegraph.schema.builder.IndexLabelBuilder;
import com.baidu.hugegraph.schema.builder.PropertyKeyBuilder;
import com.baidu.hugegraph.schema.builder.VertexLabelBuilder;
import com.baidu.hugegraph.serializer.JsonSerializer;
import com.baidu.hugegraph.structure.HugeEdge;
import com.baidu.hugegraph.structure.HugeProperty;
import com.baidu.hugegraph.structure.HugeVertex;
import com.baidu.hugegraph.task.HugeTask;
import com.baidu.hugegraph.task.StandardTaskScheduler;
import com.baidu.hugegraph.task.TaskCallable;
import com.baidu.hugegraph.task.TaskCallable.SysTaskCallable;
import com.baidu.hugegraph.task.TaskManager;
import com.baidu.hugegraph.traversal.optimize.HugeCountStepStrategy;
import com.baidu.hugegraph.traversal.optimize.HugeGraphStepStrategy;
import com.baidu.hugegraph.traversal.optimize.HugeVertexStepStrategy;
import com.baidu.hugegraph.variables.HugeVariables;
import com.google.common.collect.ImmutableSet;
import sun.reflect.Reflection;
public final class HugeFactoryAuthProxy {
public static final String GRAPH_FACTORY =
"gremlin.graph=com.baidu.hugegraph.auth.HugeFactoryAuthProxy";
private static final Set<String> PROTECT_METHODS = ImmutableSet.of(
"instance");
private static final Map<HugeGraph, HugeGraph> graphs = new HashMap<>();
static {
HugeGraphAuthProxy.setContext(HugeGraphAuthProxy.Context.admin());
HugeFactoryAuthProxy.registerPrivateActions();
}
public static synchronized HugeGraph open(Configuration config) {
/*
* Inject authentication (replace HugeGraph with HugeGraphAuthProxy)
* TODO: Add verify to StandardHugeGraph() to prevent dynamic creation
*/
HugeGraph graph = HugeFactory.open(config);
HugeGraph proxy = graphs.get(graph);
if (proxy == null) {
proxy = new HugeGraphAuthProxy(graph);
graphs.put(graph, proxy);
}
return proxy;
}
private static void registerPrivateActions() {
// Thread
Reflection.registerFieldsToFilter(java.lang.Thread.class, "name", "priority", "threadQ", "eetop", "single_step", "daemon", "stillborn", "target", "group", "contextClassLoader", "inheritedAccessControlContext", "threadInitNumber", "threadLocals", "inheritableThreadLocals", "stackSize", "nativeParkEventPointer", "tid", "threadSeqNumber", "threadStatus", "parkBlocker", "blocker", "blockerLock", "EMPTY_STACK_TRACE", "SUBCLASS_IMPLEMENTATION_PERMISSION", "uncaughtExceptionHandler", "defaultUncaughtExceptionHandler", "threadLocalRandomSeed", "threadLocalRandomProbe", "threadLocalRandomSecondarySeed");
Reflection.registerMethodsToFilter(java.lang.Thread.class, "exit", "dispatchUncaughtException", "clone", "isInterrupted", "registerNatives", "init", "init", "nextThreadNum", "nextThreadID", "blockedOn", "start0", "isCCLOverridden", "auditSubclass", "dumpThreads", "getThreads", "processQueue", "setPriority0", "stop0", "suspend0", "resume0", "interrupt0", "setNativeName");
Reflection.registerFieldsToFilter(java.lang.ThreadLocal.class, "threadLocalHashCode", "nextHashCode", "HASH_INCREMENT");
Reflection.registerMethodsToFilter(java.lang.ThreadLocal.class, "access$400", "createInheritedMap", "nextHashCode", "initialValue", "setInitialValue", "getMap", "createMap", "childValue");
Reflection.registerMethodsToFilter(java.lang.InheritableThreadLocal.class, "getMap", "createMap", "childValue");
// HugeGraph
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.StandardAuthenticator.class, "graph");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.auth.StandardAuthenticator.class, "initAdminUser", "inputPassword", "graph");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.ConfigAuthenticator.class, "tokens");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.HugeFactoryAuthProxy.class, "PROTECT_METHODS");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.auth.HugeFactoryAuthProxy.class, "genRegisterPrivateActions", "registerClass", "registerPrivateActions", "registerPrivateActions", "c");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.HugeAuthenticator.User.class, "role", "client");
Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.server.auth.AuthenticatedUser.class, "name");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.HugeGraphAuthProxy.class, "LOG", "hugegraph", "taskScheduler", "authManager", "contexts", "$assertionsDisabled");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.auth.HugeGraphAuthProxy.class, "lambda$0", "access$3", "access$4", "access$2", "access$5", "resetContext", "logUser", "verifyAdminPermission", "verifyStatusPermission", "verifyPermission", "verifySchemaPermission", "verifySchemaPermission", "verifySchemaPermission", "verifySchemaPermission", "verifyNamePermission", "verifyNameExistsPermission", "verifyElemPermission", "verifyElemPermission", "verifyElemPermission", "verifyElemPermission", "verifyResPermission", "verifyResPermission", "verifyUserPermission", "verifyUserPermission", "verifyUserPermission", "getContextString", "access$6", "access$7", "lambda$1", "lambda$2", "lambda$3", "lambda$4", "lambda$5", "lambda$6", "lambda$7", "lambda$8", "lambda$9", "lambda$10", "lambda$11", "lambda$12", "lambda$13", "lambda$14", "lambda$15", "lambda$16", "lambda$17", "lambda$18", "lambda$19", "lambda$20", "lambda$21", "lambda$22", "lambda$23", "lambda$24", "access$8", "access$9", "access$10", "setContext", "getContext");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.HugeGraphAuthProxy.AuthManagerProxy.class, "authManager", "this$0");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.auth.HugeGraphAuthProxy.AuthManagerProxy.class, "currentUsername", "updateCreator");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.HugeGraphAuthProxy.TaskSchedulerProxy.class, "taskScheduler", "this$0");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.auth.HugeGraphAuthProxy.TaskSchedulerProxy.class, "lambda$0", "lambda$1", "lambda$2", "verifyTaskPermission", "verifyTaskPermission", "verifyTaskPermission", "verifyTaskPermission", "hasTaskPermission");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.HugeGraphAuthProxy.GraphTraversalSourceProxy.class, "this$0");
Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource.class, "connection", "graph", "strategies", "bytecode");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.HugeGraphAuthProxy.TraversalStrategiesProxy.class, "REST_WOEKER", "serialVersionUID", "strategies", "this$0");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.auth.HugeGraphAuthProxy.TraversalStrategiesProxy.class, "translate");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.HugeGraphAuthProxy.VariablesProxy.class, "variables", "this$0");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.HugeGraphAuthProxy.Context.class, "ADMIN", "user");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.HugeGraphAuthProxy.ContextTask.class, "runner", "context");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.StandardHugeGraph.class, "LOG", "started", "closed", "mode", "variables", "name", "params", "configuration", "schemaEventHub", "graphEventHub", "indexEventHub", "writeRateLimiter", "readRateLimiter", "taskManager", "authManager", "features", "storeProvider", "tx", "ramtable", "$assertionsDisabled");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.StandardHugeGraph.class, "lambda$0", "access$3", "access$4", "access$2", "access$5", "access$6", "access$7", "waitUntilAllTasksCompleted", "access$8", "loadStoreProvider", "graphTransaction", "schemaTransaction", "openSchemaTransaction", "checkGraphNotClosed", "openSystemTransaction", "openGraphTransaction", "systemTransaction", "access$9", "access$10", "access$11", "access$12", "access$13", "access$14", "access$15", "access$16", "access$17", "access$18", "serializer", "loadSchemaStore", "loadSystemStore", "loadGraphStore", "closeTx", "analyzer", "serverInfoManager", "reloadRamtable", "reloadRamtable", "access$19", "access$20", "access$21");
Reflection.registerFieldsToFilter(c("com.baidu.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), "graph", "this$0");
Reflection.registerMethodsToFilter(c("com.baidu.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), "access$1", "graph");
Reflection.registerFieldsToFilter(c("com.baidu.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "refs", "opened", "transactions", "this$0", "$assertionsDisabled");
Reflection.registerMethodsToFilter(c("com.baidu.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "lambda$0", "access$3", "access$2", "lambda$1", "graphTransaction", "schemaTransaction", "systemTransaction", "access$1", "setOpened", "doCommit", "verifyOpened", "doRollback", "doClose", "destroyTransaction", "doOpen", "setClosed", "getOrNewTransaction", "access$0", "resetState");
Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, "readWriteConsumerInternal", "closeConsumerInternal", "transactionListeners");
Reflection.registerMethodsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, "doClose", "fireOnCommit", "fireOnRollback", "doReadWrite", "lambda$fireOnRollback$1", "lambda$fireOnCommit$0");
Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "g");
Reflection.registerMethodsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "doCommit", "doRollback", "doClose", "doOpen", "fireOnCommit", "fireOnRollback", "doReadWrite");
Reflection.registerFieldsToFilter(c("com.baidu.hugegraph.StandardHugeGraph$Txs"), "schemaTx", "systemTx", "graphTx", "openedTime", "$assertionsDisabled");
Reflection.registerMethodsToFilter(c("com.baidu.hugegraph.StandardHugeGraph$Txs"), "access$2", "access$1", "access$0");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.backend.tx.GraphTransaction.class, "indexTx", "addedVertices", "removedVertices", "addedEdges", "removedEdges", "addedProps", "removedProps", "updatedVertices", "updatedEdges", "updatedOldestProps", "locksTable", "checkCustomVertexExist", "checkAdjacentVertexExist", "lazyLoadAdjacentVertex", "ignoreInvalidEntry", "commitPartOfAdjacentEdges", "batchSize", "pageSize", "verticesCapacity", "edgesCapacity", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.backend.tx.GraphTransaction.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "lambda$4", "lambda$5", "lambda$6", "lambda$7", "lambda$8", "lambda$9", "lambda$10", "lambda$11", "lambda$12", "lambda$13", "lambda$14", "lambda$15", "lambda$16", "lambda$17", "lambda$18", "lambda$19", "access$1", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "indexTransaction", "indexTransaction", "beforeWrite", "prepareCommit", "verticesInTxSize", "edgesInTxSize", "checkTxVerticesCapacity", "checkTxEdgesCapacity", "verticesInTxUpdated", "verticesInTxRemoved", "removingEdgeOwner", "prepareDeletions", "prepareDeletions", "prepareUpdates", "prepareAdditions", "checkVertexExistIfCustomizedId", "checkAggregateProperty", "checkAggregateProperty", "checkNonnullProperty", "queryEdgesFromBackend", "commitPartOfEdgeDeletions", "optimizeQueries", "checkVertexLabel", "checkId", "queryVerticesFromBackend", "joinTxVertices", "joinTxEdges", "lockForUpdateProperty", "optimizeQuery", "verifyVerticesConditionQuery", "verifyEdgesConditionQuery", "indexQuery", "joinTxRecords", "propertyUpdated", "parseEntry", "traverseByLabel", "reset", "queryVerticesByIds", "filterUnmatchedRecords", "skipOffsetOrStopLimit", "filterExpiredResultFromFromBackend", "queryEdgesByIds", "matchEdgeSortKeys", "rightResultFromIndexQuery");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.backend.tx.IndexableTransaction.class, "$assertionsDisabled");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.backend.tx.IndexableTransaction.class, "indexTransaction", "commit2Backend", "reset");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.backend.tx.AbstractTransaction.class, "LOG", "ownerThread", "autoCommit", "closed", "committing", "committing2Backend", "graph", "store", "mutation", "serializer", "$assertionsDisabled");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.backend.tx.AbstractTransaction.class, "beforeWrite", "prepareCommit", "params", "mutation", "commit2Backend", "autoCommit", "beforeRead", "afterWrite", "afterRead", "commitMutation2Backend", "checkOwnerThread", "doAction", "store", "reset");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.HugeFactory.class, "LOG", "NAME_REGEX", "graphs");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.HugeFactory.class, "lambda$0");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.schema.SchemaElement.class, "graph", "id", "name", "userdata", "status");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.structure.HugeVertex.class, "EMPTY_SET", "id", "label", "edges", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.structure.HugeVertex.class, "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "newProperty", "newProperty", "tx", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", "checkIdLength", "onUpdateProperty", "ensureFilledProperties", "clone", "clone");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.structure.HugeElement.class, "EMPTY_MAP", "MAX_PROPERTIES", "graph", "properties", "expiredTime", "removed", "fresh", "propLoaded", "defaultValueUpdated", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.structure.HugeElement.class, "removed", "addProperty", "newProperty", "tx", "onUpdateProperty", "ensureFilledProperties", "propLoaded", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality", "getIdValue", "fresh", "updateToDefaultValueIfNone", "copyProperties");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.structure.HugeEdge.class, "id", "label", "name", "sourceVertex", "targetVertex", "isOutEdge", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.structure.HugeEdge.class, "checkAdjacentVertexExist", "newProperty", "newProperty", "tx", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", "onUpdateProperty", "ensureFilledProperties", "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction", "clone", "clone");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.structure.HugeProperty.class, "owner", "pkey", "value");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.variables.HugeVariables.class, "LOG", "VARIABLES", "VARIABLE_KEY", "VARIABLE_TYPE", "BYTE_VALUE", "BOOLEAN_VALUE", "INTEGER_VALUE", "LONG_VALUE", "FLOAT_VALUE", "DOUBLE_VALUE", "STRING_VALUE", "LIST", "SET", "TYPES", "params", "graph");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.variables.HugeVariables.class, "createPropertyKey", "queryAllVariableVertices", "queryVariableVertex", "createVariableVertex", "removeVariableVertex", "extractSingleObject", "setProperty");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.schema.SchemaManager.class, "transaction", "graph");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.schema.SchemaManager.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "checkExists");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.schema.builder.PropertyKeyBuilder.class, "id", "name", "dataType", "cardinality", "aggregateType", "checkExist", "userdata", "$assertionsDisabled");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.schema.builder.PropertyKeyBuilder.class, "lambda$0", "checkStableVars", "checkAggregateType", "hasSameProperties");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.schema.builder.AbstractBuilder.class, "transaction", "graph");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.schema.builder.AbstractBuilder.class, "rebuildIndex", "graph", "checkSchemaName", "validOrGenerateId", "lockCheckAndCreateSchema", "propertyKeyOrNull", "checkSchemaIdIfRestoringMode", "vertexLabelOrNull", "edgeLabelOrNull", "indexLabelOrNull", "updateSchemaStatus");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.schema.builder.VertexLabelBuilder.class, "id", "name", "idStrategy", "properties", "primaryKeys", "nullableKeys", "ttl", "ttlStartTime", "enableLabelIndex", "userdata", "checkExist", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.schema.builder.VertexLabelBuilder.class, "lambda$0", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "checkStableVars", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", "checkProperties", "checkNullableKeys", "checkIdStrategy", "checkPrimaryKeys", "hasSameProperties", "checkTtl", "checkUserdata", "mapPkId2Name", "mapPkId2Name");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.schema.builder.EdgeLabelBuilder.class, "id", "name", "sourceLabel", "targetLabel", "frequency", "properties", "sortKeys", "nullableKeys", "ttl", "ttlStartTime", "enableLabelIndex", "userdata", "checkExist", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.schema.builder.EdgeLabelBuilder.class, "lambda$0", "checkStableVars", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", "checkProperties", "checkNullableKeys", "checkSortKeys", "checkRelation", "hasSameProperties", "checkTtl", "checkUserdata", "mapPkId2Name", "mapPkId2Name");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.schema.builder.IndexLabelBuilder.class, "id", "name", "baseType", "baseValue", "indexType", "indexFields", "userdata", "checkExist", "rebuild", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.schema.builder.IndexLabelBuilder.class, "lambda$0", "checkStableVars", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType", "checkBaseType", "checkIndexType", "checkFields4Range", "loadElement", "checkFields", "checkRepeatIndex", "checkRepeatIndex", "checkRepeatIndex", "checkPrimaryKeyIndex", "checkRepeatRangeIndex", "checkRepeatSearchIndex", "checkRepeatSecondaryIndex", "checkRepeatShardIndex", "checkRepeatUniqueIndex", "removeSubIndex", "hasSubIndex", "allStringIndex", "oneNumericField", "hasSameProperties");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.task.TaskManager.class, "LOG", "SCHEDULE_PERIOD", "THREADS", "MANAGER", "schedulers", "taskExecutor", "taskDbExecutor", "serverInfoDbExecutor", "schedulerExecutor", "contexts", "$assertionsDisabled");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.task.TaskManager.class, "lambda$0", "resetContext", "closeTaskTx", "setContext", "instance", "closeSchedulerTx", "notifyNewTask", "scheduleOrExecuteJob", "scheduleOrExecuteJobForGraph");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.task.StandardTaskScheduler.class, "LOG", "graph", "serverManager", "taskExecutor", "taskDbExecutor", "eventListener", "tasks", "taskTx", "NO_LIMIT", "PAGE_SIZE", "QUERY_INTERVAL", "MAX_PENDING_TASKS", "$assertionsDisabled");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.task.StandardTaskScheduler.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "lambda$4", "lambda$5", "lambda$6", "lambda$7", "tx", "listenChanges", "unlistenChanges", "submitTask", "queryTask", "queryTask", "queryTask", "call", "call", "remove", "sleep", "taskDone", "serverManager", "supportsPaging", "restore", "checkOnMasterNode", "waitUntilTaskCompleted", "scheduleTasks", "executeTasksOnWorker", "cancelTasksOnWorker");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.task.HugeTask.class, "LOG", "DECOMPRESS_RATIO", "scheduler", "callable", "type", "name", "id", "parent", "dependencies", "description", "context", "create", "server", "load", "status", "progress", "update", "retries", "input", "result", "$assertionsDisabled");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.task.HugeTask.class, "property", "scheduler", "scheduler", "asArray", "checkPropertySize", "checkPropertySize", "checkDependenciesSuccess", "toOrderSet", "done", "callable", "setException", "set", "result", "status");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.task.TaskCallable.class, "LOG", "ERROR_COMMIT", "ERROR_MESSAGES", "task", "graph", "lastSaveTime", "saveInterval");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.task.TaskCallable.class, "graph", "closeTx", "cancelled", "done", "task", "save", "needSaveWithEx");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.task.TaskCallable.SysTaskCallable.class, "params");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.task.TaskCallable.SysTaskCallable.class, "params", "params");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.StandardAuthManager.class, "CACHE_EXPIRE", "graph", "eventListener", "usersCache", "users", "groups", "targets", "belong", "access", "$assertionsDisabled");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.auth.StandardAuthManager.class, "lambda$0", "listenChanges", "unlistenChanges", "invalidCache", "initSchemaIfNeeded", "rolePermission", "rolePermission", "rolePermission", "cache");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.SchemaDefine.class, "graph", "label");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.auth.SchemaDefine.class, "schema", "createPropertyKey", "createPropertyKey", "createPropertyKey", "existEdgeLabel", "createRangeIndex", "unhideField", "hideField", "existVertexLabel", "initProperties");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.EntityManager.class, "graph", "label", "deser", "NO_LIMIT", "$assertionsDisabled");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.auth.EntityManager.class, "toList", "graph", "tx", "commitOrRollback", "unhideLabel", "queryById", "queryEntity", "constructVertex", "save", "query");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.RelationshipManager.class, "graph", "label", "deser", "NO_LIMIT", "$assertionsDisabled");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.auth.RelationshipManager.class, "lambda$0", "toList", "graph", "tx", "commitOrRollback", "unhideLabel", "queryById", "queryRelationship", "newVertex", "save");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.backend.cache.CacheManager.class, "LOG", "INSTANCE", "TIMER_TICK_PERIOD", "LOG_TICK_COST_TIME", "caches", "timer");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.backend.cache.CacheManager.class, "access$0", "scheduleTimer", "instance");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.concurrent.LockManager.class, "INSTANCE", "lockGroupMap");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.concurrent.LockManager.class, "instance");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.license.LicenseVerifier.class, "LOG", "LICENSE_PARAM_PATH", "INSTANCE", "CHECK_INTERVAL", "lastCheckTime", "verifyParam", "manager");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.license.LicenseVerifier.class, "buildVerifyParam", "initLicenseParam", "verifyPublicCert", "instance");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.metrics.ServerReporter.class, "instance", "gauges", "counters", "histograms", "meters", "timers");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.metrics.ServerReporter.class, "instance", "instance");
Reflection.registerFieldsToFilter(com.codahale.metrics.ScheduledReporter.class, "LOG", "FACTORY_ID", "registry", "executor", "shutdownExecutorOnStop", "disabledMetricAttributes", "scheduledFuture", "filter", "durationFactor", "durationUnit", "rateFactor", "rateUnit");
Reflection.registerMethodsToFilter(com.codahale.metrics.ScheduledReporter.class, "convertDuration", "convertRate", "getRateUnit", "getDurationUnit", "isShutdownExecutorOnStop", "getDisabledMetricAttributes", "calculateRateUnit", "createDefaultExecutor", "lambda$start$0", "start");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.serializer.JsonSerializer.class, "LBUF_SIZE", "INSTANCE");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.serializer.JsonSerializer.class, "writeIterator", "instance");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.traversal.optimize.HugeVertexStepStrategy.class, "serialVersionUID", "INSTANCE");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.traversal.optimize.HugeVertexStepStrategy.class, "instance");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.traversal.optimize.HugeGraphStepStrategy.class, "serialVersionUID", "INSTANCE");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.traversal.optimize.HugeGraphStepStrategy.class, "instance");
Reflection.registerFieldsToFilter(com.baidu.hugegraph.traversal.optimize.HugeCountStepStrategy.class, "serialVersionUID", "INSTANCE");
Reflection.registerMethodsToFilter(com.baidu.hugegraph.traversal.optimize.HugeCountStepStrategy.class, "lambda$0", "instance");
// Enable this line to generate registration statement
//genRegisterPrivateActions();
}
@SuppressWarnings("unused")
private static void genRegisterPrivateActions() {
registerPrivateActions(Thread.class);
registerPrivateActions(ThreadLocal.class);
registerPrivateActions(InheritableThreadLocal.class);
registerPrivateActions(StandardAuthenticator.class);
registerPrivateActions(ConfigAuthenticator.class);
registerPrivateActions(HugeFactoryAuthProxy.class);
registerPrivateActions(HugeAuthenticator.User.class);
registerPrivateActions(HugeGraphAuthProxy.class);
registerPrivateActions(HugeGraphAuthProxy.AuthManagerProxy.class);
registerPrivateActions(HugeGraphAuthProxy.TaskSchedulerProxy.class);
registerPrivateActions(HugeGraphAuthProxy.GraphTraversalSourceProxy.class);
registerPrivateActions(HugeGraphAuthProxy.TraversalStrategiesProxy.class);
registerPrivateActions(HugeGraphAuthProxy.VariablesProxy.class);
registerPrivateActions(HugeGraphAuthProxy.Context.class);
registerPrivateActions(HugeGraphAuthProxy.ContextThreadPoolExecutor.class);
registerPrivateActions(HugeGraphAuthProxy.ContextTask.class);
for (Class<?> clazz : StandardHugeGraph.PROTECT_CLASSES) {
registerPrivateActions(clazz);
}
registerPrivateActions(HugeFactory.class);
registerPrivateActions(AbstractTransaction.class);
registerPrivateActions(SchemaElement.class);
registerPrivateActions(HugeVertex.class);
registerPrivateActions(HugeEdge.class);
registerPrivateActions(HugeProperty.class);
registerPrivateActions(HugeVariables.class);
registerPrivateActions(SchemaManager.class);
registerPrivateActions(PropertyKeyBuilder.class);
registerPrivateActions(VertexLabelBuilder.class);
registerPrivateActions(EdgeLabelBuilder.class);
registerPrivateActions(IndexLabelBuilder.class);
registerPrivateActions(TaskManager.class);
registerPrivateActions(StandardTaskScheduler.class);
registerPrivateActions(HugeTask.class);
registerPrivateActions(TaskCallable.class);
registerPrivateActions(SysTaskCallable.class);
registerPrivateActions(StandardAuthManager.class);
registerPrivateActions(SchemaDefine.class);
registerPrivateActions(EntityManager.class);
registerPrivateActions(RelationshipManager.class);
// Don't shield them because need to access by auth RPC
//registerPrivateActions(HugeUser.class);
//registerPrivateActions(RolePermission.class);
//registerPrivateActions(HugeResource.class);
registerPrivateActions(CacheManager.class);
registerPrivateActions(LockManager.class);
registerPrivateActions(LicenseVerifier.class);
registerPrivateActions(ServerReporter.class);
registerPrivateActions(JsonSerializer.class);
registerPrivateActions(HugeVertexStepStrategy.class);
registerPrivateActions(HugeGraphStepStrategy.class);
registerPrivateActions(HugeCountStepStrategy.class);
}
private static void registerPrivateActions(Class<?> clazz) {
while (clazz != Object.class) {
List<String> fields = new ArrayList<>();
for (Field field : clazz.getDeclaredFields()) {
if (!Modifier.isPublic(field.getModifiers())) {
fields.add(field.getName());
}
}
List<String> methods = new ArrayList<>();
for (Method method : clazz.getDeclaredMethods()) {
if (!Modifier.isPublic(method.getModifiers()) ||
PROTECT_METHODS.contains(method.getName())) {
methods.add(method.getName());
}
}
registerClass(clazz, fields, methods);
clazz = clazz.getSuperclass();
}
}
private static boolean registerClass(Class<?> clazz,
List<String> fields,
List<String> methods) {
if (clazz.getName().startsWith("java") ||
fields.isEmpty() && methods.isEmpty()) {
return false;
}
final String[] array = new String[fields.size()];
try {
Reflection.registerFieldsToFilter(clazz, fields.toArray(array));
Reflection.registerMethodsToFilter(clazz, methods.toArray(array));
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Filter already registered: class")) {
return false;
}
throw e;
}
String code;
code = String.format("Reflection.registerFieldsToFilter(%s.class, \"%s\");",
clazz.getCanonicalName(), String.join("\", \"", fields));
if (!fields.isEmpty()) {
System.out.println(code);
}
code = String.format("Reflection.registerMethodsToFilter(%s.class, \"%s\");",
clazz.getCanonicalName(), String.join("\", \"", methods));
if (!methods.isEmpty()) {
System.out.println(code);
}
return true;
}
private static Class<?> c(String clazz) {
try {
return Class.forName(clazz);
} catch (ClassNotFoundException e) {
throw new HugeException(e.getMessage(), e);
}
}
}

View File

@ -1,188 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.auth;
import java.io.Console;
import java.net.InetAddress;
import java.util.Map;
import java.util.Scanner;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang.StringUtils;
import org.apache.tinkerpop.gremlin.structure.util.GraphFactory;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.config.CoreOptions;
import com.baidu.hugegraph.config.HugeConfig;
import com.baidu.hugegraph.config.ServerOptions;
import com.baidu.hugegraph.rpc.RpcClientProviderWithAuth;
import com.baidu.hugegraph.util.ConfigUtil;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.StringEncoding;
public class StandardAuthenticator implements HugeAuthenticator {
private static final String INITING_STORE = "initing_store";
private HugeGraph graph = null;
private HugeGraph graph() {
E.checkState(this.graph != null, "Must setup Authenticator first");
return this.graph;
}
private void initAdminUser() throws Exception {
if (this.requireInitAdminUser()) {
this.initAdminUser(this.inputPassword());
}
this.graph.close();
}
@Override
public void initAdminUser(String password) {
// Not allowed to call by non main thread
String caller = Thread.currentThread().getName();
E.checkState("main".equals(caller), "Invalid caller '%s'", caller);
AuthManager authManager = this.graph().hugegraph().authManager();
// Only init user when local mode and user has not been initialized
if (this.requireInitAdminUser()) {
HugeUser admin = new HugeUser(HugeAuthenticator.USER_ADMIN);
admin.password(StringEncoding.hashPassword(password));
admin.creator(HugeAuthenticator.USER_SYSTEM);
authManager.createUser(admin);
}
}
private boolean requireInitAdminUser() {
AuthManager authManager = this.graph().hugegraph().authManager();
return StandardAuthManager.isLocal(authManager) &&
authManager.findUser(HugeAuthenticator.USER_ADMIN) == null;
}
private String inputPassword() {
String inputPrompt = "Please input the admin password:";
String notEmptyPrompt = "The admin password can't be empty";
Console console = System.console();
while (true) {
String password = "";
if (console != null) {
char[] chars = console.readPassword(inputPrompt);
password = new String(chars);
} else {
System.out.print(inputPrompt);
@SuppressWarnings("resource") // just wrapper of System.in
Scanner scanner = new Scanner(System.in);
password = scanner.nextLine();
}
if (!password.isEmpty()) {
return password;
}
System.out.println(notEmptyPrompt);
}
}
@Override
public void setup(HugeConfig config) {
String graphName = config.get(ServerOptions.AUTH_GRAPH_STORE);
Map<String, String> graphConfs = ConfigUtil.scanGraphsDir(
config.get(ServerOptions.GRAPHS));
String graphPath = graphConfs.get(graphName);
E.checkArgument(graphPath != null,
"Can't find graph name '%s' in config '%s' at " +
"'rest-server.properties' to store auth information, " +
"please ensure the value of '%s' matches it correctly",
graphName, ServerOptions.GRAPHS,
ServerOptions.AUTH_GRAPH_STORE.name());
HugeConfig graphConfig = new HugeConfig(graphPath);
if (config.getProperty(INITING_STORE) != null &&
config.getBoolean(INITING_STORE)) {
// Forced set RAFT_MODE to false when initializing backend
graphConfig.setProperty(CoreOptions.RAFT_MODE.name(), "false");
}
this.graph = (HugeGraph) GraphFactory.open(graphConfig);
String remoteUrl = config.get(ServerOptions.AUTH_REMOTE_URL);
if (StringUtils.isNotEmpty(remoteUrl)) {
RpcClientProviderWithAuth clientProvider =
new RpcClientProviderWithAuth(config);
this.graph.switchAuthManager(clientProvider.authManager());
}
}
/**
* Verify if a user is legal
* @param username the username for authentication
* @param password the password for authentication
* @param token the token for authentication
* @return String No permission if return ROLE_NONE else return a role
*/
@Override
public UserWithRole authenticate(String username, String password,
String token) {
UserWithRole userWithRole;
if (StringUtils.isNotEmpty(token)) {
userWithRole = this.authManager().validateUser(token);
} else {
E.checkArgumentNotNull(username,
"The username parameter can't be null");
E.checkArgumentNotNull(password,
"The password parameter can't be null");
userWithRole = this.authManager().validateUser(username, password);
}
RolePermission role = userWithRole.role();
if (role == null) {
role = ROLE_NONE;
} else if (USER_ADMIN.equals(userWithRole.username())) {
role = ROLE_ADMIN;
} else {
return userWithRole;
}
return new UserWithRole(userWithRole.userId(),
userWithRole.username(), role);
}
@Override
public AuthManager authManager() {
return this.graph().authManager();
}
@Override
public SaslNegotiator newSaslNegotiator(InetAddress remoteAddress) {
throw new NotImplementedException("SaslNegotiator is unsupported");
}
public static void initAdminUserIfNeeded(String confFile) throws Exception {
StandardAuthenticator auth = new StandardAuthenticator();
HugeConfig config = new HugeConfig(confFile);
String authClass = config.get(ServerOptions.AUTHENTICATOR);
if (authClass.isEmpty()) {
return;
}
config.addProperty(INITING_STORE, true);
auth.setup(config);
if (auth.graph().backendStoreFeatures().supportsPersistence()) {
auth.initAdminUser();
}
}
}

View File

@ -1,10 +0,0 @@
package com.baidu.hugegraph.define;
public interface Checkable {
public void checkCreate(boolean isBatch);
public default void checkUpdate() {
this.checkCreate(false);
}
}

View File

@ -1,133 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.license;
import java.io.IOException;
import java.io.InputStream;
import java.time.Duration;
import java.time.Instant;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeException;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.config.HugeConfig;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.util.Log;
import com.fasterxml.jackson.databind.ObjectMapper;
public class LicenseVerifier {
private static final Logger LOG = Log.logger(HugeGraph.class);
private static final String LICENSE_PARAM_PATH = "/verify-license.json";
private static volatile LicenseVerifier INSTANCE = null;
private static final Duration CHECK_INTERVAL = Duration.ofMinutes(10);
private volatile Instant lastCheckTime = Instant.now();
private final LicenseInstallParam installParam;
private final LicenseVerifyManager manager;
private LicenseVerifier() {
this.installParam = buildInstallParam(LICENSE_PARAM_PATH);
this.manager = new LicenseVerifyManager(this.installParam);
}
public static LicenseVerifier instance() {
if (INSTANCE == null) {
synchronized(LicenseVerifier.class) {
if (INSTANCE == null) {
INSTANCE = new LicenseVerifier();
}
}
}
return INSTANCE;
}
public synchronized void install(HugeConfig config,
GraphManager graphManager,
String md5) {
this.manager.config(config);
this.manager.graphManager(graphManager);
LicenseManager licenseManager = this.manager.licenseManager();
try {
licenseManager.uninstallLicense();
this.verifyPublicCert(md5);
LicenseParams params = licenseManager.installLicense();
LOG.info("The license '{}' is successfully installed for '{}', " +
"the term of validity is from {} to {}",
params.subject(), params.consumerType(),
params.notBefore(), params.notAfter());
} catch (Exception e) {
LOG.error("Failed to install license", e);
throw new HugeException("Failed to install license", e);
}
}
public void verifyIfNeeded() {
Instant now = Instant.now();
Duration interval = Duration.between(this.lastCheckTime, now);
if (!interval.minus(CHECK_INTERVAL).isNegative()) {
this.verify();
this.lastCheckTime = now;
}
}
public void verify() {
try {
LicenseParams params = this.manager.licenseManager()
.verifyLicense();
LOG.info("The license verification passed, " +
"the term of validity is from {} to {}",
params.notBefore(), params.notAfter());
} catch (Exception e) {
LOG.error("Failed to verify license", e);
throw new HugeException("Failed to verify license", e);
}
}
private void verifyPublicCert(String expectMD5) {
String path = this.installParam.publicKeyPath();
try (InputStream is = LicenseVerifier.class.getResourceAsStream(path)) {
String actualMD5 = DigestUtils.md5Hex(is);
if (!actualMD5.equals(expectMD5)) {
throw new HugeException("Invalid public cert");
}
} catch (IOException e) {
LOG.error("Failed to read public cert", e);
throw new HugeException("Failed to read public cert", e);
}
}
private static LicenseInstallParam buildInstallParam(String path) {
// NOTE: can't use JsonUtil due to it bind tinkerpop jackson
ObjectMapper mapper = new ObjectMapper();
try (InputStream stream =
LicenseVerifier.class.getResourceAsStream(path)) {
return mapper.readValue(stream, LicenseInstallParam.class);
} catch (IOException e) {
throw new HugeException("Failed to read json stream to %s",
LicenseInstallParam.class);
}
}
}

View File

@ -1,251 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.license;
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeException;
import com.baidu.hugegraph.config.CoreOptions;
import com.baidu.hugegraph.config.HugeConfig;
import com.baidu.hugegraph.config.ServerOptions;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.util.Bytes;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.Log;
import com.baidu.hugegraph.util.VersionUtil;
import com.baidu.hugegraph.version.CoreVersion;
import com.sun.management.OperatingSystemMXBean;
public class LicenseVerifyManager {
private static final Logger LOG = Log.logger(LicenseVerifyManager.class);
private final LicenseManager licenseManager;
private final MachineInfo machineInfo;
private HugeConfig config;
private GraphManager graphManager;
public LicenseVerifyManager(LicenseInstallParam param) {
this.licenseManager = LicenseManagerFactory.create(param,
this::validate);
this.machineInfo = new MachineInfo();
}
public LicenseManager licenseManager() {
return this.licenseManager;
}
public void config(HugeConfig config) {
this.config = config;
}
public HugeConfig config() {
E.checkState(this.config != null,
"License verify manager has not been installed");
return this.config;
}
public void graphManager(GraphManager graphManager) {
this.graphManager = graphManager;
}
public GraphManager graphManager() {
E.checkState(this.graphManager != null,
"License verify manager has not been installed");
return this.graphManager;
}
private synchronized void validate(LicenseParams params) {
// Verify the customized license parameters.
String serverId = this.getServerId();
LOG.debug("Verify server id '{}'", serverId);
LicenseExtraParam param = params.matchParam(serverId);
if (param == null) {
throw new HugeException("The current server id is not authorized");
}
this.checkVersion(param);
this.checkGraphs(param);
this.checkIpAndMac(param);
this.checkCpu(param);
this.checkRam(param);
this.checkThreads(param);
this.checkMemory(param);
}
private String getServerId() {
return this.config().get(ServerOptions.SERVER_ID);
}
private void checkVersion(LicenseExtraParam param) {
String expectVersion = param.version();
if (StringUtils.isEmpty(expectVersion)) {
return;
}
VersionUtil.Version acutalVersion = CoreVersion.VERSION;
if (acutalVersion.compareTo(VersionUtil.Version.of(expectVersion)) > 0) {
throw newLicenseException(
"The server's version '%s' exceeded the authorized '%s'",
acutalVersion.get(), expectVersion);
}
}
private void checkGraphs(LicenseExtraParam param) {
int expectGraphs = param.graphs();
if (expectGraphs == LicenseExtraParam.NO_LIMIT) {
return;
}
int actualGraphs = this.graphManager().graphs().size();
if (actualGraphs > expectGraphs) {
throw newLicenseException(
"The server's graphs '%s' exceeded the authorized '%s'",
actualGraphs, expectGraphs);
}
}
private void checkIpAndMac(LicenseExtraParam param) {
String expectIp = param.ip();
boolean matched = false;
List<String> actualIps = this.machineInfo.getIpAddress();
for (String actualIp : actualIps) {
if (StringUtils.isEmpty(expectIp) ||
actualIp.equalsIgnoreCase(expectIp)) {
matched = true;
break;
}
}
if (!matched) {
throw newLicenseException(
"The server's ip '%s' doesn't match the authorized '%s'",
actualIps, expectIp);
}
String expectMac = param.mac();
if (StringUtils.isEmpty(expectMac)) {
return;
}
// The mac must be not empty here
if (!StringUtils.isEmpty(expectIp)) {
String actualMac;
try {
actualMac = this.machineInfo.getMacByInetAddress(
InetAddress.getByName(expectIp));
} catch (UnknownHostException e) {
throw newLicenseException(
"Failed to get mac address for ip '%s'", expectIp);
}
String expectFormatMac = expectMac.replaceAll(":", "-");
String actualFormatMac = actualMac.replaceAll(":", "-");
if (!actualFormatMac.equalsIgnoreCase(expectFormatMac)) {
throw newLicenseException(
"The server's mac '%s' doesn't match the authorized '%s'",
actualMac, expectMac);
}
} else {
String expectFormatMac = expectMac.replaceAll(":", "-");
List<String> actualMacs = this.machineInfo.getMacAddress();
matched = false;
for (String actualMac : actualMacs) {
String actualFormatMac = actualMac.replaceAll(":", "-");
if (actualFormatMac.equalsIgnoreCase(expectFormatMac)) {
matched = true;
break;
}
}
if (!matched) {
throw newLicenseException(
"The server's macs %s don't match the authorized '%s'",
actualMacs, expectMac);
}
}
}
private void checkCpu(LicenseExtraParam param) {
int expectCpus = param.cpus();
if (expectCpus == LicenseExtraParam.NO_LIMIT) {
return;
}
int actualCpus = CoreOptions.CPUS;
if (actualCpus > expectCpus) {
throw newLicenseException(
"The server's cpus '%s' exceeded the limit '%s'",
actualCpus, expectCpus);
}
}
private void checkRam(LicenseExtraParam param) {
// Unit MB
int expectRam = param.ram();
if (expectRam == LicenseExtraParam.NO_LIMIT) {
return;
}
OperatingSystemMXBean mxBean = (OperatingSystemMXBean) ManagementFactory
.getOperatingSystemMXBean();
long actualRam = mxBean.getTotalPhysicalMemorySize() / Bytes.MB;
if (actualRam > expectRam) {
throw newLicenseException(
"The server's ram(MB) '%s' exceeded the limit(MB) '%s'",
actualRam, expectRam);
}
}
private void checkThreads(LicenseExtraParam param) {
int expectThreads = param.threads();
if (expectThreads == LicenseExtraParam.NO_LIMIT) {
return;
}
int actualThreads = this.config().get(ServerOptions.MAX_WORKER_THREADS);
if (actualThreads > expectThreads) {
throw newLicenseException(
"The server's max threads '%s' exceeded limit '%s'",
actualThreads, expectThreads);
}
}
private void checkMemory(LicenseExtraParam param) {
// Unit MB
int expectMemory = param.memory();
if (expectMemory == LicenseExtraParam.NO_LIMIT) {
return;
}
/*
* NOTE: this max memory will be slightly smaller than XMX,
* because only one survivor will be used
*/
long actualMemory = Runtime.getRuntime().maxMemory() / Bytes.MB;
if (actualMemory > expectMemory) {
throw newLicenseException(
"The server's max heap memory(MB) '%s' exceeded the " +
"limit(MB) '%s'", actualMemory, expectMemory);
}
}
private HugeException newLicenseException(String message, Object... args) {
return new HugeException(message, args);
}
}

View File

@ -1,106 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.serializer;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import com.baidu.hugegraph.auth.SchemaDefine.AuthElement;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.schema.EdgeLabel;
import com.baidu.hugegraph.schema.IndexLabel;
import com.baidu.hugegraph.schema.PropertyKey;
import com.baidu.hugegraph.schema.SchemaElement;
import com.baidu.hugegraph.schema.VertexLabel;
import com.baidu.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser.CrosspointsPaths;
import com.baidu.hugegraph.traversal.algorithm.FusiformSimilarityTraverser.SimilarsMap;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser.NodeWithWeight;
import com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser.WeightedPaths;
public interface Serializer {
public String writeMap(Map<?, ?> map);
public String writeList(String label, Collection<?> list);
public String writePropertyKey(PropertyKey propertyKey);
public String writePropertyKeys(List<PropertyKey> propertyKeys);
public String writeVertexLabel(VertexLabel vertexLabel);
public String writeVertexLabels(List<VertexLabel> vertexLabels);
public String writeEdgeLabel(EdgeLabel edgeLabel);
public String writeEdgeLabels(List<EdgeLabel> edgeLabels);
public String writeIndexlabel(IndexLabel indexLabel);
public String writeIndexlabels(List<IndexLabel> indexLabels);
public String writeTaskWithSchema(SchemaElement.TaskWithSchema tws);
public String writeVertex(Vertex v);
public String writeVertices(Iterator<Vertex> vertices, boolean paging);
public String writeEdge(Edge e);
public String writeEdges(Iterator<Edge> edges, boolean paging);
public String writeIds(List<Id> ids);
public String writeAuthElement(AuthElement elem);
public <V extends AuthElement> String writeAuthElements(String label,
List<V> users);
public String writePaths(String name, Collection<HugeTraverser.Path> paths,
boolean withCrossPoint, Iterator<Vertex> vertices);
public default String writePaths(String name,
Collection<HugeTraverser.Path> paths,
boolean withCrossPoint) {
return this.writePaths(name, paths, withCrossPoint, null);
}
public String writeCrosspoints(CrosspointsPaths paths,
Iterator<Vertex> iterator, boolean withPath);
public String writeSimilars(SimilarsMap similars,
Iterator<Vertex> vertices);
public String writeWeightedPath(NodeWithWeight path,
Iterator<Vertex> vertices);
public String writeWeightedPaths(WeightedPaths paths,
Iterator<Vertex> vertices);
public String writeNodesWithPath(String name, List<Id> nodes, long size,
Collection<HugeTraverser.Path> paths,
Iterator<Vertex> vertices);
}

View File

@ -1,43 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.backend.store.cassandra;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.serializer.TableBackendEntry;
import com.baidu.hugegraph.type.HugeType;
public class CassandraBackendEntry extends TableBackendEntry {
public CassandraBackendEntry(Id id) {
super(id);
}
public CassandraBackendEntry(HugeType type) {
this(type, null);
}
public CassandraBackendEntry(HugeType type, Id id) {
this(new Row(type, id));
}
public CassandraBackendEntry(TableBackendEntry.Row row) {
super(row);
}
}

View File

@ -0,0 +1,66 @@
# hugegraph-commons
[![License](https://img.shields.io/badge/license-Apache%202-0E78BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![codecov](https://codecov.io/gh/hugegraph/hugegraph-common/branch/master/graph/badge.svg)](https://codecov.io/gh/hugegraph/hugegraph-common)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.hugegraph/hugegraph-common/badge.svg)](https://mvnrepository.com/artifact/org.apache.hugegraph/hugegraph-common)
[![CodeQL](https://github.com/apache/incubator-hugegraph-commons/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/apache/incubator-hugegraph-commons/actions/workflows/codeql-analysis.yml)
[![hugegraph-commons ci](https://github.com/apache/incubator-hugegraph-commons/actions/workflows/ci.yml/badge.svg)](https://github.com/apache/incubator-hugegraph-commons/actions/workflows/ci.yml)
hugegraph-commons is a common module for [HugeGraph](https://github.com/apache/hugegraph) and its peripheral components.
hugegraph-commons encapsulates locks, configurations, events, iterators, rest and some
numeric or collection util classes to simplify the development of HugeGraph and its components.
## Components
- Lock: atomic lock, key lock, lock group and lock manger
- Config: register and load config option with security check
- Event: listening and notification, do something asynchronously
- Iterator: some iterators with extra functions, map, filter, extend, etc.
- Rest: RESTful client implemented on OkHttp, POST, PUT, GET and DELETE
- Util: performance analyzer, version checker, numeric and Collection utils, log and exception utils, etc.
- Rpc: rpc component for inner module communication, currently it's based on [Sofa-RPC](https://github.com/sofastack/sofa-rpc)
You could use import the dependencies in `maven` like this:
```xml
<dependency>
<groupId>org.apache.hugegraph</groupId>
<artifactId>hugegraph-common</artifactId>
<version>1.2.0</version>
</dependency>
```
## Learn More
The [doc page](https://hugegraph.apache.org/docs/) contains more information about hugegraph modules.
And here are links of other repositories:
1. [hugegraph-server](https://github.com/apache/hugegraph) (graph's core component - OLTP server)
2. [hugegraph-toolchain](https://github.com/apache/hugegraph-toolchain) (include loader/dashboard/tool/client)
3. [hugegraph-computer](https://github.com/apache/hugegraph-computer) (graph processing system - OLAP)
4. [hugegraph-website/doc](https://github.com/apache/hugegraph-doc) (include doc & website code)
## Contributing
- Welcome to contribute to HugeGraph, please see [How to Contribute](https://hugegraph.apache.org/docs/contribution-guidelines/contribute/) for more information.
- Note: It's recommended to use [GitHub Desktop](https://desktop.github.com/) to greatly simplify the PR and commit process.
- Thank you to all the people who already contributed to HugeGraph!
[![contributors graph](https://contrib.rocks/image?repo=apache/hugegraph-commons)](https://github.com/apache/incubator-hugegraph-commons/graphs/contributors)
## Licence
Same as HugeGraph, hugegraph-commons are also licensed under [Apache 2.0](./LICENSE) License.
### Contact Us
---
- [GitHub Issues](https://github.com/apache/incubator-hugegraph-commons/issues): Feedback on usage issues and functional requirements (quick response)
- Feedback Email: [dev@hugegraph.apache.org](mailto:dev@hugegraph.apache.org) ([subscriber](https://hugegraph.apache.org/docs/contribution-guidelines/subscribe/) only)
- WeChat public account: Apache HugeGraph, welcome to scan this QR code to follow us.
<img src="https://raw.githubusercontent.com/apache/incubator-hugegraph-doc/master/assets/images/wechat.png" alt="QR png" width="350"/>

View File

@ -0,0 +1,23 @@
# hugegraph-common
[![License](https://img.shields.io/badge/license-Apache%202-0E78BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![Build Status](https://travis-ci.org/hugegraph/hugegraph-common.svg?branch=master)](https://travis-ci.org/hugegraph/hugegraph-common)
[![codecov](https://codecov.io/gh/hugegraph/hugegraph-common/branch/master/graph/badge.svg)](https://codecov.io/gh/hugegraph/hugegraph-common)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.hugegraph/hugegraph-common/badge.svg)](https://mvnrepository.com/artifact/org.apache.hugegraph/hugegraph-common)
hugegraph-common is a common module for [HugeGraph](https://github.com/hugegraph/hugegraph) and its peripheral components.
hugegraph-common encapsulates locks, configurations, events, iterators, rest and some
numeric or collection util classes to simplify the development of HugeGraph and
its components.
## Components
- Lock: atomic lock, key lock, lock group and lock manger
- Config: register and load config option with security check
- Event: listening and notification, do something asynchronously
- Iterator: some iterators with extra functions, map, filter, extend, etc.
- Rest: RESTful client implemented on Jersey, POST, PUT, GET and DELETE
- Util: Performance analyzer, version checker, numeric and Collection utils, log and exception utils, etc.
## Licence
The same as HugeGraph, hugegraph-common is also licensed under Apache 2.0 License.

View File

@ -20,5 +20,4 @@ export MAVEN_HOME=/home/scmtools/buildkit/maven/apache-maven-3.3.9/
export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/
export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH
mvn clean compile
mvn clean test -Dtest=UnitTestSuite

View File

@ -0,0 +1,302 @@
<?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 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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.hugegraph</groupId>
<artifactId>hugegraph-commons</artifactId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>hugegraph-common</artifactId>
<name>${project.artifactId}</name>
<url>https://github.com/apache/incubator-hugegraph-commons/tree/master/hugegraph-common</url>
<description>
hugegraph-common is a common module for HugeGraph and its peripheral components.
hugegraph-common encapsulates locks, configurations, events, iterators, rest and some
numeric or collection util classes to simplify the development of HugeGraph and its
components.
</description>
<properties>
<!-- Use parent params -->
<lombok.version>1.18.8</lombok.version>
<okhttp.version>4.10.0</okhttp.version>
</properties>
<dependencies>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j2.version}</version>
</dependency>
<!-- Utility -->
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>${javax.json.version}</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>${commons.configuration.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>${commons.configuration2.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<artifactId>commons-lang3</artifactId>
<groupId>org.apache.commons</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons.lang3.version}</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>${commons.beanutils.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons.io.version}</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>${commons.collections.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons.codec.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
<exclusions>
<exclusion>
<artifactId>jsr305</artifactId>
<groupId>com.google.code.findbugs</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>${jsr305.version}</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10.8</version>
</dependency>
<!-- javassist -->
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>${javassist.version}</version>
</dependency>
<!-- jackson -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>${jackson.version}</version>
<exclusions>
<exclusion>
<artifactId>jakarta.xml.bind-api</artifactId>
<groupId>jakarta.xml.bind</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-base</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${sun.xml.version}</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<artifactId>jakarta.xml.bind-api</artifactId>
<groupId>jakarta.xml.bind</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-bom</artifactId>
<version>${okhttp.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<outputDirectory>${project.parent.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>apache-release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -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.concurrent;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.hugegraph.util.Log;
import org.slf4j.Logger;
public class AtomicLock {
private static final Logger LOG = Log.logger(LockManager.class);
private String name;
private AtomicReference<Thread> sign;
public AtomicLock(String name) {
this.name = name;
this.sign = new AtomicReference<>();
}
public boolean tryLock() {
Thread current = Thread.currentThread();
return this.sign.compareAndSet(null, current);
}
public void unlock() {
if (this.sign.get() == null) {
return;
}
Thread current = Thread.currentThread();
if (!this.sign.compareAndSet(current, null)) {
throw new RuntimeException(String.format(
"Thread '%s' trying to unlock '%s' " +
"which is held by other threads now.",
current.getName(), this.name));
}
}
public boolean lock(int retries) {
// The interval between retries is exponential growth, most wait
// interval is 2^(retries-1)s. If retries=0, don't retry.
if (retries < 0 || retries > 10) {
throw new IllegalArgumentException(String.format(
"Locking retry times should be in [0, 10], but got %d",
retries));
}
boolean isLocked = false;
try {
for (int i = 0; !(isLocked = this.tryLock()) && i < retries; i++) {
Thread.sleep(1000 * (1L << i));
}
} catch (InterruptedException ignored) {
LOG.info("Thread sleep is interrupted.");
}
return isLocked;
}
public String name() {
return this.name;
}
public void name(String name) {
this.name = name;
}
}

View File

@ -0,0 +1,104 @@
/*
* 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.concurrent;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.apache.hugegraph.util.E;
public class BarrierEvent {
private final Lock lock = new ReentrantLock();
private final Condition cond = lock.newCondition();
private volatile boolean signaled = false;
/**
* Wait forever until the signal is received.
* @throws InterruptedException if interrupted.
*/
public void await() throws InterruptedException {
this.lock.lock();
try {
while (!this.signaled) {
this.cond.await();
}
} finally {
this.lock.unlock();
}
}
/**
* Wait specified time in milliseconds.
* @param timeout: the time in millisecond to wait.
* @return true if signal is received, false if time out.
* @throws InterruptedException if interrupted.
*/
public boolean await(long timeout) throws InterruptedException {
E.checkArgument(timeout >= 0L,
"The time must be >= 0, but got '%d'.",
timeout);
long deadline = System.currentTimeMillis() + timeout;
this.lock.lock();
try {
while (!this.signaled) {
timeout = deadline - System.currentTimeMillis();
if (timeout > 0) {
this.cond.await(timeout, TimeUnit.MILLISECONDS);
}
if (System.currentTimeMillis() >= deadline) {
return this.signaled;
}
}
} finally {
this.lock.unlock();
}
return true;
}
public void reset() {
this.lock.lock();
try {
this.signaled = false;
} finally {
this.lock.unlock();
}
}
public void signal() {
this.lock.lock();
try {
this.signaled = true;
this.cond.signal();
} finally {
this.lock.unlock();
}
}
public void signalAll() {
this.lock.lock();
try {
this.signaled = true;
this.cond.signalAll();
} finally {
this.lock.unlock();
}
}
}

View File

@ -0,0 +1,144 @@
/*
* 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.concurrent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.locks.Lock;
import org.apache.hugegraph.util.E;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.Striped;
/**
* KeyLock provide an interface of segment lock
*/
public class KeyLock {
private Striped<Lock> locks;
public KeyLock() {
// The default size is availableProcessors() * 4
this(Runtime.getRuntime().availableProcessors() << 2);
}
public KeyLock(int size) {
this.locks = Striped.lock(size);
}
private int indexOf(Lock lock) {
for (int i = 0; i < this.locks.size(); i++) {
if (this.locks.getAt(i) == lock) {
return i;
}
}
return -1;
}
/**
* Lock an object
* @param key The object to lock
* @return The lock(locked) of passed key
*/
public final Lock lock(Object key) {
E.checkArgument(key != null, "Lock key can't be null");
Lock lock = this.locks.get(key);
lock.lock();
return lock;
}
/**
* Unlock an object
* @param key The object to unlock
*/
public final void unlock(Object key) {
E.checkArgument(key != null, "Unlock key can't be null");
this.locks.get(key).unlock();
}
/**
* Lock a list of object with sorted order
* @param keys The objects to lock
* @return The locks(locked) of keys
*/
public final List<Lock> lockAll(Object... keys) {
E.checkArgument(keys != null && keys.length > 0,
"Lock keys can't be null or empty");
List<Lock> locks = new ArrayList<>(keys.length);
for (Object key : keys) {
E.checkArgument(key != null, "Lock key can't be null");
Lock lock = this.locks.get(key);
locks.add(lock);
}
locks.sort((a, b) -> {
int diff = a.hashCode() - b.hashCode();
if (diff == 0 && a != b) {
diff = this.indexOf(a) - this.indexOf(b);
assert diff != 0;
}
return diff;
});
for (Lock lock : locks) {
lock.lock();
}
return Collections.unmodifiableList(locks);
}
/**
* Lock two objects with sorted order
* NOTE: This is to optimize the performance of lockAll(keys)
* @param key1 The first object
* @param key2 The second object
* @return locks for the two objects
*/
public List<Lock> lockAll(Object key1, Object key2) {
E.checkArgument(key1 != null, "Lock key can't be null");
E.checkArgument(key2 != null, "Lock key can't be null");
Lock lock1 = this.locks.get(key1);
Lock lock2 = this.locks.get(key2);
int diff = lock1.hashCode() - lock2.hashCode();
if (diff == 0 && lock1 != lock2) {
diff = this.indexOf(lock1) - this.indexOf(lock2);
assert diff != 0;
}
List<Lock> locks = diff > 0 ?
ImmutableList.of(lock2, lock1) :
ImmutableList.of(lock1, lock2);
for (Lock lock : locks) {
lock.lock();
}
return locks;
}
/**
* Unlock a list of object
* @param locks The locks to unlock
*/
public final void unlockAll(List<Lock> locks) {
E.checkArgument(locks != null, "Unlock locks can't be null");
for (int i = locks.size(); i > 0; i--) {
assert this.indexOf(locks.get(i - 1)) != -1;
locks.get(i - 1).unlock();
}
}
}

View File

@ -0,0 +1,85 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package org.apache.hugegraph.concurrent;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
public class LockGroup {
private final String name;
private final Map<String, Object> locksMap;
public LockGroup(String lockGroup) {
this.name = lockGroup;
this.locksMap = new ConcurrentHashMap<>();
}
public Lock lock(String lockName) {
if (!this.locksMap.containsKey(lockName)) {
this.locksMap.putIfAbsent(lockName, new ReentrantLock());
}
return (Lock) this.locksMap.get(lockName);
}
public AtomicLock atomicLock(String lockName) {
if (!this.locksMap.containsKey(lockName)) {
this.locksMap.putIfAbsent(lockName, new AtomicLock(lockName));
}
return (AtomicLock) this.locksMap.get(lockName);
}
public ReadWriteLock readWriteLock(String lockName) {
if (!this.locksMap.containsKey(lockName)) {
this.locksMap.putIfAbsent(lockName, new ReentrantReadWriteLock());
}
return (ReadWriteLock) this.locksMap.get(lockName);
}
public KeyLock keyLock(String lockName) {
if (!this.locksMap.containsKey(lockName)) {
this.locksMap.putIfAbsent(lockName, new KeyLock());
}
return (KeyLock) this.locksMap.get(lockName);
}
public KeyLock keyLock(String lockName, int size) {
if (!this.locksMap.containsKey(lockName)) {
this.locksMap.putIfAbsent(lockName, new KeyLock(size));
}
return (KeyLock) this.locksMap.get(lockName);
}
public <K extends Comparable<K>> RowLock<K> rowLock(String lockName) {
if (!this.locksMap.containsKey(lockName)) {
this.locksMap.putIfAbsent(lockName, new RowLock<>());
}
Object value = this.locksMap.get(lockName);
@SuppressWarnings("unchecked")
RowLock<K> lock = (RowLock<K>) value;
return lock;
}
public String name() {
return this.name;
}
}

View File

@ -0,0 +1,71 @@
/*
* 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.concurrent;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class LockManager {
private static final LockManager INSTANCE = new LockManager();
public static LockManager instance() {
return INSTANCE;
}
private Map<String, LockGroup> lockGroupMap;
private LockManager() {
this.lockGroupMap = new ConcurrentHashMap<>();
}
public boolean exists(String group) {
return this.lockGroupMap.containsKey(group);
}
public LockGroup create(String group) {
if (exists(group)) {
throw new RuntimeException(String.format(
"LockGroup '%s' already exists", group));
}
LockGroup lockGroup = new LockGroup(group);
LockGroup previous = this.lockGroupMap.putIfAbsent(group, lockGroup);
if (previous != null) {
return previous;
}
return lockGroup;
}
public LockGroup get(String group) {
LockGroup lockGroup = this.lockGroupMap.get(group);
if (lockGroup == null) {
throw new RuntimeException(String.format(
"LockGroup '%s' does not exists", group));
}
return lockGroup;
}
public void destroy(String group) {
if (this.exists(group)) {
this.lockGroupMap.remove(group);
} else {
throw new RuntimeException(String.format(
"LockGroup '%s' does not exists", group));
}
}
}

View File

@ -0,0 +1,78 @@
/*
* 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.concurrent;
import java.util.List;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import org.apache.hugegraph.util.Log;
import org.slf4j.Logger;
public class PausableScheduledThreadPool extends ScheduledThreadPoolExecutor {
private static final Logger LOG = Log.logger(PausableScheduledThreadPool.class);
private volatile boolean paused = false;
public PausableScheduledThreadPool(int corePoolSize,
ThreadFactory factory) {
super(corePoolSize, factory);
}
public synchronized void pauseSchedule() {
this.paused = true;
LOG.info("PausableScheduledThreadPool was paused");
}
public synchronized void resumeSchedule() {
this.paused = false;
this.notifyAll();
LOG.info("PausableScheduledThreadPool was resumed");
}
@Override
protected void beforeExecute(Thread t, Runnable r) {
synchronized (this) {
while (this.paused) {
try {
this.wait();
} catch (InterruptedException e) {
LOG.warn("PausableScheduledThreadPool was interrupted");
}
}
}
super.beforeExecute(t, r);
}
@Override
public void shutdown() {
if (this.paused) {
this.resumeSchedule();
}
super.shutdown();
}
@Override
public List<Runnable> shutdownNow() {
if (this.paused) {
this.resumeSchedule();
}
return super.shutdownNow();
}
}

View File

@ -0,0 +1,98 @@
/*
* 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.concurrent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.apache.hugegraph.util.E;
public class RowLock<K extends Comparable<K>> {
private final Map<K, Lock> locks = new ConcurrentHashMap<>();
private final ThreadLocal<Map<K, LocalLock>> localLocks =
ThreadLocal.withInitial(HashMap::new);
public void lock(K key) {
E.checkArgument(key != null, "Lock key can't be null");
LocalLock localLock = this.localLocks.get().get(key);
if (localLock != null) {
localLock.lockCount++;
} else {
Lock current = new ReentrantLock();
Lock previous = this.locks.putIfAbsent(key, current);
if (previous != null) {
current = previous;
}
current.lock();
this.localLocks.get().put(key, new LocalLock(current));
}
}
public void unlock(K key) {
E.checkArgument(key != null, "Unlock key can't be null");
LocalLock localLock = this.localLocks.get().get(key);
if (localLock == null) {
return;
}
if (--localLock.lockCount == 0) {
this.locks.remove(key, localLock.current);
this.localLocks.get().remove(key);
localLock.current.unlock();
}
E.checkState(localLock.lockCount >= 0,
"The lock count must be >= 0, but got %s",
localLock.lockCount);
}
public void lockAll(Set<K> keys) {
E.checkArgument(keys != null && keys.size() > 0,
"Lock keys can't be null or empty");
List<K> list = new ArrayList<>(keys);
Collections.sort(list);
for (K key : list) {
this.lock(key);
}
}
public void unlockAll(Set<K> keys) {
E.checkArgument(keys != null && keys.size() > 0,
"Unlock keys can't be null or empty");
for (K key : keys) {
this.unlock(key);
}
}
private static class LocalLock {
private final Lock current;
private int lockCount;
private LocalLock(Lock current) {
this.current = current;
this.lockCount = 1;
}
}
}

View File

@ -0,0 +1,47 @@
/*
* 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.config;
import java.util.function.Function;
import org.apache.hugegraph.util.E;
import com.google.common.base.Predicate;
public class ConfigConvOption<T, R> extends TypedOption<T, R> {
private final Function<T, R> converter;
public ConfigConvOption(String name, String desc, Predicate<T> pred,
Function<T, R> convert, T value) {
this(name, false, desc, pred, convert, value);
}
@SuppressWarnings("unchecked")
public ConfigConvOption(String name, boolean required, String desc,
Predicate<T> pred, Function<T, R> convert,
T value) {
super(name, required, desc, pred, (Class<T>) value.getClass(), value);
E.checkNotNull(convert, "convert");
this.converter = convert;
}
@Override
public R convert(T value) {
return this.converter.apply(value);
}
}

View File

@ -1,6 +1,4 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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
@ -17,24 +15,25 @@
* under the License.
*/
package com.baidu.hugegraph.exception;
package org.apache.hugegraph.config;
import com.baidu.hugegraph.HugeException;
public class ConfigException extends RuntimeException {
public class ConnectionException extends HugeException {
private static final long serialVersionUID = -8711375282196157058L;
private static final long serialVersionUID = -2224809756208190785L;
public ConfigException(String message) {
super(message);
}
public ConnectionException(String message, Throwable cause) {
public ConfigException(String message, Throwable cause) {
super(message, cause);
}
public ConnectionException(String message, Object... args) {
super(message, args);
public ConfigException(String message, Object... args) {
super(String.format(message, args));
}
public ConnectionException(String message, Throwable cause,
Object... args) {
super(message, cause, args);
public ConfigException(String message, Throwable cause, Object... args) {
super(String.format(message, args), cause);
}
}

View File

@ -0,0 +1,75 @@
/*
* 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.config;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import org.apache.hugegraph.util.E;
import com.google.common.base.Predicate;
public class ConfigListConvOption<T, R> extends TypedOption<List<T>, List<R>> {
private final Class<T> elemClass;
private final Function<T, R> converter;
@SuppressWarnings("unchecked")
public ConfigListConvOption(String name, String desc,
Predicate<List<T>> pred, Function<T, R> convert,
T... values) {
this(name, false, desc, pred, convert, null, Arrays.asList(values));
}
@SuppressWarnings("unchecked")
public ConfigListConvOption(String name, boolean required, String desc,
Predicate<List<T>> pred, Function<T, R> convert,
Class<T> clazz, List<T> values) {
super(name, required, desc, pred,
(Class<List<T>>) values.getClass(), values);
E.checkNotNull(convert, "convert");
if (clazz == null && values.size() > 0) {
clazz = (Class<T>) values.get(0).getClass();
}
E.checkArgumentNotNull(clazz, "Element class can't be null");
this.elemClass = clazz;
this.converter = convert;
}
@Override
protected boolean forList() {
return true;
}
@Override
protected List<T> parse(String value) {
return ConfigListOption.convert(value, part -> {
return this.parse(part, this.elemClass);
});
}
@Override
public List<R> convert(List<T> values) {
List<R> results = new ArrayList<>(values.size());
for (T value : values) {
results.add(this.converter.apply(value));
}
return results;
}
}

Some files were not shown because too many files have changed in this diff Show More