-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(store): integrate
store-client
submodule
- Loading branch information
Showing
79 changed files
with
10,213 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?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-store</artifactId> | ||
<version>${revision}</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>hg-store-client</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
<maven.test.skip>true</maven.test.skip> | ||
<log4j2.version>2.15.0</log4j2.version> | ||
<lombok.version>1.18.20</lombok.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.hugegraph</groupId> | ||
<artifactId>hg-store-grpc</artifactId> | ||
<version>${revision}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hugegraph</groupId> | ||
<artifactId>hg-store-common</artifactId> | ||
<version>${revision}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hugegraph</groupId> | ||
<artifactId>hg-pd-client</artifactId> | ||
<version>${revision}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hugegraph</groupId> | ||
<artifactId>hg-pd-grpc</artifactId> | ||
<version>${revision}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>${lombok.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-slf4j-impl</artifactId> | ||
<version>${log4j2.version}</version> | ||
</dependency> | ||
<!-- test --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.13.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java-util</artifactId> | ||
<version>3.17.2</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
<version>2.7</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.13.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-codec</groupId> | ||
<artifactId>commons-codec</artifactId> | ||
<version>1.15</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
29 changes: 29 additions & 0 deletions
29
hugegraph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/HgKvEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* 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.store; | ||
|
||
public interface HgKvEntry { | ||
|
||
byte[] key(); | ||
|
||
byte[] value(); | ||
|
||
default int code() { | ||
return -1; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
hugegraph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/HgKvIterator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* 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.store; | ||
|
||
import java.io.Closeable; | ||
import java.util.Iterator; | ||
|
||
/** | ||
* created on 2021/10/21 | ||
*/ | ||
public interface HgKvIterator<E> extends Iterator<E>, HgSeekAble, Closeable { | ||
|
||
byte[] key(); | ||
|
||
byte[] value(); | ||
|
||
@Override | ||
void close(); | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
...h-store/hg-store-client/src/main/java/org/apache/hugegraph/store/HgKvOrderedIterator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* 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.store; | ||
|
||
/** | ||
* created on 2022/03/10 | ||
*/ | ||
public interface HgKvOrderedIterator<E> extends HgKvIterator<E>, Comparable<HgKvOrderedIterator> { | ||
|
||
long getSequence(); | ||
} |
25 changes: 25 additions & 0 deletions
25
...ph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/HgKvPagingIterator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
*/ | ||
|
||
package org.apache.hugegraph.store; | ||
|
||
/** | ||
* created on 2021/10/24 | ||
*/ | ||
public interface HgKvPagingIterator<E> extends HgKvIterator<E>, HgPageSize { | ||
|
||
} |
125 changes: 125 additions & 0 deletions
125
hugegraph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/HgKvStore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/* | ||
* 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.store; | ||
|
||
import java.util.List; | ||
|
||
import org.apache.hugegraph.store.client.grpc.KvCloseableIterator; | ||
import org.apache.hugegraph.store.grpc.stream.ScanStreamReq; | ||
|
||
/** | ||
* @version 0.2.0 | ||
*/ | ||
public interface HgKvStore { | ||
|
||
/** | ||
* CAUTION: THE CONST BELOW MUST KEEP CONSISTENCE TO ScanIterator.Trait. | ||
*/ | ||
int SCAN_ANY = 0x80; | ||
int SCAN_PREFIX_BEGIN = 0x01; | ||
int SCAN_PREFIX_END = 0x02; | ||
int SCAN_GT_BEGIN = 0x04; | ||
int SCAN_GTE_BEGIN = 0x0c; | ||
int SCAN_LT_END = 0x10; | ||
int SCAN_LTE_END = 0x30; | ||
int SCAN_KEYONLY = 0x40; | ||
int SCAN_HASHCODE = 0x100; | ||
|
||
boolean put(String table, HgOwnerKey ownerKey, byte[] value); | ||
|
||
/** | ||
* 该版本被store内部使用。向分区写入数据, | ||
* partitionId与key.keyCode必须与pd存储的分区信息保持一致。 | ||
*/ | ||
boolean directPut(String table, int partitionId, HgOwnerKey key, byte[] value); | ||
|
||
byte[] get(String table, HgOwnerKey ownerKey); | ||
|
||
boolean clean(int partId); | ||
|
||
boolean delete(String table, HgOwnerKey ownerKey); | ||
|
||
boolean deleteSingle(String table, HgOwnerKey ownerKey); | ||
|
||
boolean deletePrefix(String table, HgOwnerKey prefix); | ||
|
||
boolean deleteRange(String table, HgOwnerKey start, HgOwnerKey end); | ||
|
||
boolean merge(String table, HgOwnerKey key, byte[] value); | ||
|
||
@Deprecated | ||
List<HgKvEntry> batchGetOwner(String table, List<HgOwnerKey> keyList); | ||
|
||
HgKvIterator<HgKvEntry> scanIterator(String table); | ||
|
||
HgKvIterator<HgKvEntry> scanIterator(String table, byte[] query); | ||
|
||
HgKvIterator<HgKvEntry> scanIterator(String table, long limit); | ||
|
||
HgKvIterator<HgKvEntry> scanIterator(String table, long limit, byte[] query); | ||
|
||
HgKvIterator<HgKvEntry> scanIterator(String table, HgOwnerKey keyPrefix); | ||
|
||
HgKvIterator<HgKvEntry> scanIterator(String table, HgOwnerKey keyPrefix, long limit); | ||
|
||
HgKvIterator<HgKvEntry> scanIterator(String table, HgOwnerKey keyPrefix, long limit, | ||
byte[] query); | ||
|
||
HgKvIterator<HgKvEntry> scanIterator(String table, HgOwnerKey startKey, HgOwnerKey endKey); | ||
|
||
HgKvIterator<HgKvEntry> scanIterator(String table, HgOwnerKey startKey, HgOwnerKey endKey, | ||
long limit); | ||
|
||
HgKvIterator<HgKvEntry> scanIterator(String table, HgOwnerKey startKey, HgOwnerKey endKey, | ||
long limit, byte[] query); | ||
|
||
HgKvIterator<HgKvEntry> scanIterator(String table, HgOwnerKey startKey, HgOwnerKey endKey, | ||
long limit, int scanType, byte[] query); | ||
|
||
HgKvIterator<HgKvEntry> scanIterator(String table, int codeFrom, int codeTo, int scanType, | ||
byte[] query); | ||
|
||
// HgKvIterator<HgKvEntry> scanIterator(ScanStreamReq scanReq); | ||
|
||
HgKvIterator<HgKvEntry> scanIterator(ScanStreamReq.Builder scanReqBuilder); | ||
|
||
long count(String table); | ||
|
||
boolean truncate(); | ||
|
||
default boolean existsTable(String table) { | ||
return false; | ||
} | ||
|
||
boolean createTable(String table); | ||
|
||
boolean deleteTable(String table); | ||
|
||
boolean dropTable(String table); | ||
|
||
boolean deleteGraph(String graph); | ||
|
||
List<HgKvIterator<HgKvEntry>> scanBatch(HgScanQuery scanQuery); | ||
|
||
KvCloseableIterator<HgKvIterator<HgKvEntry>> scanBatch2(HgScanQuery scanQuery); | ||
|
||
KvCloseableIterator<HgKvIterator<HgKvEntry>> scanBatch3(HgScanQuery scanQuery, | ||
KvCloseableIterator iterator); | ||
|
||
HgKvIterator<HgKvEntry> batchPrefix(String table, List<HgOwnerKey> prefixList); | ||
} |
Oops, something went wrong.