From 41d11ff035a8dab4d97d56c7de572fc8cfcbe7a4 Mon Sep 17 00:00:00 2001 From: Peng Guanwen Date: Tue, 28 Dec 2021 09:33:26 +0800 Subject: [PATCH] [to #348] Add javadoc (#447) Signed-off-by: Peng Guanwen --- .github/workflows/gh-pages.yml | 9 +++++++++ .gitignore | 5 ++++- README.md | 4 +++- .../visitor/PartAndFilterExprRewriter.java | 6 +++--- .../tikv/common/importer/ImporterStoreClient.java | 2 -- src/main/java/org/tikv/common/types/DataType.java | 6 +++--- .../java/org/tikv/common/util/RangeSplitter.java | 2 +- src/main/java/org/tikv/txn/TwoPhaseCommitter.java | 4 ---- src/main/java/org/tikv/txn/TxnStatus.java | 12 +++++------- 9 files changed, 28 insertions(+), 22 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 59fc9ae411..e6b3649aae 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -21,6 +21,15 @@ jobs: - run: mdbook build ./docs + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + + - name: Javadoc + run: mvn clean javadoc:javadoc -Djavadoc.skip=false && mv ./target/site/apidocs ./docs/book/apidocs + - name: Deploy uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/master' }} diff --git a/.gitignore b/.gitignore index 0dbb05e1b1..5d356432f0 100644 --- a/.gitignore +++ b/.gitignore @@ -73,4 +73,7 @@ out/ # gradle/wrapper/gradle-wrapper.properties # vscode -.settings \ No newline at end of file +.settings + +# mdbook +docs/book \ No newline at end of file diff --git a/README.md b/README.md index 2d9b58fcce..a568e5cdf4 100644 --- a/README.md +++ b/README.md @@ -50,9 +50,11 @@ Find more demo in [KVRawClientTest](https://github.com/birdstorm/KVRawClientTest See [Java Client Documents](/docs/README.md) for references about how to config and monitor Java Client. +An [API reference](https://tikv.github.io/client-java/apidocs) is also available. + ## Community -See [Contribution Guide](/docs/dev-guide.md) for references about how to contribute to this project. +See [Contribution Guide](https://tikv.github.io/client-java/contribution/introduction.html) for references about how to contribute to this project. ## License diff --git a/src/main/java/org/tikv/common/expression/visitor/PartAndFilterExprRewriter.java b/src/main/java/org/tikv/common/expression/visitor/PartAndFilterExprRewriter.java index 7f26842d9d..43f1f6b486 100644 --- a/src/main/java/org/tikv/common/expression/visitor/PartAndFilterExprRewriter.java +++ b/src/main/java/org/tikv/common/expression/visitor/PartAndFilterExprRewriter.java @@ -26,9 +26,9 @@ import org.tikv.common.predicates.PredicateUtils; * PartAndFilterExprRewriter takes partition expression as an input. Rewriting rule is based on the * type of partition expression. 1. If partition expression is a columnRef, no rewriting will be * performed. 2. If partition expression is year and the expression to be rewritten in the form of y - * < '1995-10-10' then its right hand child will be replaced with "1995". 3. If partition expression - * is year and the expression to be rewritten in the form of year(y) < '1995' then its left hand - * child will be replaced with y. + * < '1995-10-10' then its right hand child will be replaced with "1995". 3. If partition + * expression is year and the expression to be rewritten in the form of year(y) < '1995' then its + * left hand child will be replaced with y. */ public class PartAndFilterExprRewriter extends DefaultVisitor { private final Expression partExpr; diff --git a/src/main/java/org/tikv/common/importer/ImporterStoreClient.java b/src/main/java/org/tikv/common/importer/ImporterStoreClient.java index 18f9a2eba7..b315c73724 100644 --- a/src/main/java/org/tikv/common/importer/ImporterStoreClient.java +++ b/src/main/java/org/tikv/common/importer/ImporterStoreClient.java @@ -106,8 +106,6 @@ public class ImporterStoreClient /** * Ingest KV pairs to RawKV/Txn using gRPC streaming mode. This API should be called on both * leader and followers. - * - * @return */ public void startWrite() { if (conf.isRawKVMode()) { diff --git a/src/main/java/org/tikv/common/types/DataType.java b/src/main/java/org/tikv/common/types/DataType.java index 10495be104..205689a236 100644 --- a/src/main/java/org/tikv/common/types/DataType.java +++ b/src/main/java/org/tikv/common/types/DataType.java @@ -368,19 +368,19 @@ public abstract class DataType implements Serializable { /** * Convert from Spark SQL Supported Java Type to TiDB Type * - *

1. data convert, e.g. Integer -> SHORT + *

1. data convert, e.g. Integer -> SHORT * *

2. check overflow, e.g. write 1000 to short * *

Spark SQL only support following types: * - *

1. BooleanType -> java.lang.Boolean 2. ByteType -> java.lang.Byte 3. ShortType -> + *

{@literal 1. BooleanType -> java.lang.Boolean 2. ByteType -> java.lang.Byte 3. ShortType -> * java.lang.Short 4. IntegerType -> java.lang.Integer 5. LongType -> java.lang.Long 6. FloatType * -> java.lang.Float 7. DoubleType -> java.lang.Double 8. StringType -> String 9. DecimalType -> * java.math.BigDecimal 10. DateType -> java.sql.Date 11. TimestampType -> java.sql.Timestamp 12. * BinaryType -> byte array 13. ArrayType -> scala.collection.Seq (use getList for java.util.List) * 14. MapType -> scala.collection.Map (use getJavaMap for java.util.Map) 15. StructType -> - * org.apache.spark.sql.Row + * org.apache.spark.sql.Row } * * @param value * @return diff --git a/src/main/java/org/tikv/common/util/RangeSplitter.java b/src/main/java/org/tikv/common/util/RangeSplitter.java index 229ed4f27c..bb2dacc277 100644 --- a/src/main/java/org/tikv/common/util/RangeSplitter.java +++ b/src/main/java/org/tikv/common/util/RangeSplitter.java @@ -49,7 +49,7 @@ public class RangeSplitter { * * @param tableId Table id used for the handle * @param handles Handle list - * @return map + * @return {@code } map */ public Map, TLongArrayList> groupByAndSortHandlesByRegionId( long tableId, TLongArrayList handles) { diff --git a/src/main/java/org/tikv/txn/TwoPhaseCommitter.java b/src/main/java/org/tikv/txn/TwoPhaseCommitter.java index 8d28723cd7..cc230a54b9 100644 --- a/src/main/java/org/tikv/txn/TwoPhaseCommitter.java +++ b/src/main/java/org/tikv/txn/TwoPhaseCommitter.java @@ -140,7 +140,6 @@ public class TwoPhaseCommitter { * @param backOffer * @param primaryKey * @param value - * @return */ public void prewritePrimaryKey(BackOffer backOffer, byte[] primaryKey, byte[] value) throws TiBatchWriteException { @@ -196,7 +195,6 @@ public class TwoPhaseCommitter { * * @param backOffer * @param key - * @return */ public void commitPrimaryKey(BackOffer backOffer, byte[] key, long commitTs) throws TiBatchWriteException { @@ -236,7 +234,6 @@ public class TwoPhaseCommitter { * * @param primaryKey * @param pairs - * @return */ public void prewriteSecondaryKeys( byte[] primaryKey, Iterator pairs, int maxBackOfferMS) @@ -499,7 +496,6 @@ public class TwoPhaseCommitter { * * @param keys * @param commitTs - * @return */ public void commitSecondaryKeys( Iterator keys, long commitTs, int commitBackOfferMS) diff --git a/src/main/java/org/tikv/txn/TxnStatus.java b/src/main/java/org/tikv/txn/TxnStatus.java index 744fe66e03..6b5b851c01 100644 --- a/src/main/java/org/tikv/txn/TxnStatus.java +++ b/src/main/java/org/tikv/txn/TxnStatus.java @@ -19,13 +19,11 @@ package org.tikv.txn; import org.tikv.kvproto.Kvrpcpb; -/** - * ttl > 0: lock is not resolved - * - *

ttl = 0 && commitTS = 0: lock is deleted - * - *

ttl = 0 && commitTS > 0: lock is committed - */ +// ttl > 0: lock is not resolved +// +//

ttl = 0 && commitTS = 0: lock is deleted +// +//

ttl = 0 && commitTS > 0: lock is committed public class TxnStatus { private long ttl; private long commitTS;