From f4ca209ff0c783bed31f9ba1febb5fd807690886 Mon Sep 17 00:00:00 2001 From: szywilliam Date: Tue, 26 Mar 2024 13:41:33 +0800 Subject: [PATCH] update the javadoc --- .../ratis/client/api/SnapshotManagementApi.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ratis-client/src/main/java/org/apache/ratis/client/api/SnapshotManagementApi.java b/ratis-client/src/main/java/org/apache/ratis/client/api/SnapshotManagementApi.java index 26fc7a5637..f83d976040 100644 --- a/ratis-client/src/main/java/org/apache/ratis/client/api/SnapshotManagementApi.java +++ b/ratis-client/src/main/java/org/apache/ratis/client/api/SnapshotManagementApi.java @@ -27,16 +27,24 @@ */ public interface SnapshotManagementApi { - /** trigger create snapshot file. */ + /** The same as create(0, timeoutMs). */ default RaftClientReply create(long timeoutMs) throws IOException { return create(0, timeoutMs); } - /** trigger create snapshot file. If forced, ignore the creation gap. */ + /** The same as create(force? 1 : 0, timeoutMs). */ default RaftClientReply create(boolean force, long timeoutMs) throws IOException { - return create(1, timeoutMs); + return create(force? 1 : 0, timeoutMs); } - /** trigger create snapshot file if the number of newly applied logs since last snapshot exceeds creationGap. */ + /** + * Trigger to create a snapshot. + * + * @param creationGap When (creationGap > 0) and (astAppliedIndex - lastSnapshotIndex < creationGap), + * return lastSnapshotIndex; otherwise, take a new snapshot and then return its index. + * When creationGap == 0, use the server configured value as the creationGap. + * @return a reply. When {@link RaftClientReply#isSuccess()} is true, + * {@link RaftClientReply#getLogIndex()} is the snapshot index fulfilling the operation. + */ RaftClientReply create(long creationGap, long timeoutMs) throws IOException; }