sijie commented on a change in pull request #510: Issue-605 BP-15 New
CreateLedger API
URL: https://github.com/apache/bookkeeper/pull/510#discussion_r142205896
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java
##########
@@ -211,4 +215,82 @@ void openComplete(int rc, LedgerHandle lh) {
}
cb.openComplete(rc, lh, ctx);
}
+
+ public static final class OpenBuilderImpl implements OpenBuilder {
+
+ private static final byte[] EMPTY_PASSWORD = new byte[0];
+ private boolean builderRecovery = true;
+ private long builderLedgerId = -1;
+ private byte[] builderPassword = EMPTY_PASSWORD;
+ private org.apache.bookkeeper.client.api.DigestType builderDigestType
= org.apache.bookkeeper.client.api.DigestType.CRC32;
+ private final BookKeeper bk;
+
+ public OpenBuilderImpl(BookKeeper bookkeeper) {
+ this.bk = bookkeeper;
+ }
+
+ @Override
+ public OpenBuilder withLedgerId(long ledgerId) {
+ this.builderLedgerId = ledgerId;
+ return this;
+ }
+
+ @Override
+ public OpenBuilder withRecovery(boolean recovery) {
+ this.builderRecovery = recovery;
+ return this;
+ }
+
+ @Override
+ public OpenBuilder withPassword(byte[] password) {
+ this.builderPassword = password;
+ return this;
+ }
+
+ @Override
+ public OpenBuilder
withDigestType(org.apache.bookkeeper.client.api.DigestType digestType) {
+ this.builderDigestType = digestType;
+ return this;
+ }
+
+ @Override
+ public CompletableFuture<ReadHandle> execute() {
+ CompletableFuture<ReadHandle> counter = new CompletableFuture<>();
+ open(new SyncOpenCallback(), counter);
+ return counter;
+ }
+
+ private boolean validate(OpenCallback cb, Object ctx) {
Review comment:
change it to just do validation only
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services