Package org.apache.bookkeeper.client
Class LedgerCreateOp.CreateBuilderImpl
- java.lang.Object
-
- org.apache.bookkeeper.client.LedgerCreateOp.CreateBuilderImpl
-
- All Implemented Interfaces:
CreateBuilder
,OpBuilder<WriteHandle>
- Enclosing class:
- LedgerCreateOp
public static class LedgerCreateOp.CreateBuilderImpl extends java.lang.Object implements CreateBuilder
-
-
Constructor Summary
Constructors Constructor Description CreateBuilderImpl(BookKeeper bk)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<WriteHandle>
execute()
Start the operation and return an handle to the result.CreateAdvBuilder
makeAdv()
Switch the ledger into 'Advanced' mode.CreateBuilder
withAckQuorumSize(int ackQuorumSize)
Set the number of acknowledgements to wait before considering a write to be completed with success.CreateBuilder
withCustomMetadata(java.util.Map<java.lang.String,byte[]> customMetadata)
Set a map a custom data to be attached to the ledger.CreateBuilder
withDigestType(DigestType digestType)
Set the Digest type used to guard data against corruption.CreateBuilder
withEnsembleSize(int ensembleSize)
Set the number of bookies which will receive data for this ledger.CreateBuilder
withPassword(byte[] password)
Set a password for the ledger.CreateBuilder
withWriteFlags(java.util.EnumSet<WriteFlag> writeFlags)
Set write flags.CreateBuilder
withWriteQuorumSize(int writeQuorumSize)
Set the number of bookies which receive every single entry.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.bookkeeper.client.api.CreateBuilder
withWriteFlags
-
-
-
-
Constructor Detail
-
CreateBuilderImpl
CreateBuilderImpl(BookKeeper bk)
-
-
Method Detail
-
withEnsembleSize
public CreateBuilder withEnsembleSize(int ensembleSize)
Description copied from interface:CreateBuilder
Set the number of bookies which will receive data for this ledger. It defaults to 3.- Specified by:
withEnsembleSize
in interfaceCreateBuilder
- Parameters:
ensembleSize
- the number of bookies- Returns:
- the builder itself
-
withWriteFlags
public CreateBuilder withWriteFlags(java.util.EnumSet<WriteFlag> writeFlags)
Description copied from interface:CreateBuilder
Set write flags. Write flags specify the behaviour of writes- Specified by:
withWriteFlags
in interfaceCreateBuilder
- Parameters:
writeFlags
- the flags- Returns:
- the builder itself
-
withWriteQuorumSize
public CreateBuilder withWriteQuorumSize(int writeQuorumSize)
Description copied from interface:CreateBuilder
Set the number of bookies which receive every single entry. In case of ensembleSize > writeQuorumSize data will be striped across a number of ensembleSize bookies. It defaults to 2.- Specified by:
withWriteQuorumSize
in interfaceCreateBuilder
- Parameters:
writeQuorumSize
- the replication factor for each entry- Returns:
- the builder itself
-
withAckQuorumSize
public CreateBuilder withAckQuorumSize(int ackQuorumSize)
Description copied from interface:CreateBuilder
Set the number of acknowledgements to wait before considering a write to be completed with success. This value can be less or equals to writeQuorumSize. It defaults to 2.- Specified by:
withAckQuorumSize
in interfaceCreateBuilder
- Parameters:
ackQuorumSize
- the number of acknowledgements to wait for- Returns:
- the builder itself
-
withPassword
public CreateBuilder withPassword(byte[] password)
Description copied from interface:CreateBuilder
Set a password for the ledger. It defaults to empty password- Specified by:
withPassword
in interfaceCreateBuilder
- Parameters:
password
- the password- Returns:
- the builder itself
-
withCustomMetadata
public CreateBuilder withCustomMetadata(java.util.Map<java.lang.String,byte[]> customMetadata)
Description copied from interface:CreateBuilder
Set a map a custom data to be attached to the ledger. The application is responsible for the semantics of these data.- Specified by:
withCustomMetadata
in interfaceCreateBuilder
- Parameters:
customMetadata
- the ledger metadata- Returns:
- the builder itself
-
withDigestType
public CreateBuilder withDigestType(DigestType digestType)
Description copied from interface:CreateBuilder
Set the Digest type used to guard data against corruption. It defaults toDigestType.CRC32
- Specified by:
withDigestType
in interfaceCreateBuilder
- Parameters:
digestType
- the type of digest- Returns:
- the builder itself
-
makeAdv
public CreateAdvBuilder makeAdv()
Description copied from interface:CreateBuilder
Switch the ledger into 'Advanced' mode. A ledger used in Advanced mode will explicitly generate the sequence of entry identifiers. Advanced ledgers can be created with a client side defined ledgerId- Specified by:
makeAdv
in interfaceCreateBuilder
- Returns:
- a new
CreateAdvBuilder
builder
-
execute
public java.util.concurrent.CompletableFuture<WriteHandle> execute()
Description copied from interface:OpBuilder
Start the operation and return an handle to the result.- Specified by:
execute
in interfaceOpBuilder<WriteHandle>
- Returns:
- an handle to access the result of the operation
- See Also:
to have a simple method to access the result
-
-