public class BookKeeper extends Object
BKException
.Modifier and Type | Class and Description |
---|---|
static class |
BookKeeper.DigestType
There are 2 digest types that can be used for verification.
|
Constructor and Description |
---|
BookKeeper(ClientConfiguration conf)
Create a bookkeeper client using a configuration object.
|
BookKeeper(ClientConfiguration conf,
org.apache.zookeeper.ZooKeeper zk)
Create a bookkeeper client but use the passed in zookeeper client instead
of instantiating one.
|
BookKeeper(ClientConfiguration conf,
org.apache.zookeeper.ZooKeeper zk,
org.jboss.netty.channel.socket.ClientSocketChannelFactory channelFactory)
Create a bookkeeper client but use the passed in zookeeper client and
client socket channel factory instead of instantiating those.
|
BookKeeper(String servers)
Create a bookkeeper client.
|
Modifier and Type | Method and Description |
---|---|
void |
asyncCreateLedger(int ensSize,
int qSize,
BookKeeper.DigestType digestType,
byte[] passwd,
AsyncCallback.CreateCallback cb,
Object ctx)
Creates a new ledger asynchronously.
|
void |
asyncDeleteLedger(long lId,
AsyncCallback.DeleteCallback cb,
Object ctx)
Deletes a ledger asynchronously.
|
void |
asyncOpenLedger(long lId,
BookKeeper.DigestType digestType,
byte[] passwd,
AsyncCallback.OpenCallback cb,
Object ctx)
Open existing ledger asynchronously for reading.
|
void |
asyncOpenLedgerNoRecovery(long lId,
BookKeeper.DigestType digestType,
byte[] passwd,
AsyncCallback.OpenCallback cb,
Object ctx)
Open existing ledger asynchronously for reading, but it does not try to
recover the ledger if it is not yet closed.
|
void |
close()
Shuts down client.
|
LedgerHandle |
createLedger(BookKeeper.DigestType digestType,
byte[] passwd)
Creates a new ledger.
|
LedgerHandle |
createLedger(int ensSize,
int qSize,
BookKeeper.DigestType digestType,
byte[] passwd)
Synchronous call to create ledger.
|
void |
deleteLedger(long lId)
Synchronous call to delete a ledger.
|
protected ClientConfiguration |
getConf() |
LedgerHandle |
openLedger(long lId,
BookKeeper.DigestType digestType,
byte[] passwd)
Synchronous open ledger call
|
LedgerHandle |
openLedgerNoRecovery(long lId,
BookKeeper.DigestType digestType,
byte[] passwd)
Synchronous, unsafe open ledger call
|
public BookKeeper(String servers) throws IOException, InterruptedException, org.apache.zookeeper.KeeperException
servers
- A list of one of more servers on which zookeeper is running. The
client assumes that the running bookies have been registered with
zookeeper under the path
BookieWatcher.BOOKIE_REGISTRATION_PATH
IOException
InterruptedException
org.apache.zookeeper.KeeperException
public BookKeeper(ClientConfiguration conf) throws IOException, InterruptedException, org.apache.zookeeper.KeeperException
conf
- Client Configuration objectIOException
InterruptedException
org.apache.zookeeper.KeeperException
public BookKeeper(ClientConfiguration conf, org.apache.zookeeper.ZooKeeper zk) throws IOException, InterruptedException, org.apache.zookeeper.KeeperException
conf
- Client Configuration object
ClientConfiguration
zk
- Zookeeper client instance connected to the zookeeper with which
the bookies have registeredIOException
InterruptedException
org.apache.zookeeper.KeeperException
public BookKeeper(ClientConfiguration conf, org.apache.zookeeper.ZooKeeper zk, org.jboss.netty.channel.socket.ClientSocketChannelFactory channelFactory) throws IOException, InterruptedException, org.apache.zookeeper.KeeperException
conf
- Client Configuration Object
ClientConfiguration
zk
- Zookeeper client instance connected to the zookeeper with which
the bookies have registeredchannelFactory
- A factory that will be used to create connections to the bookiesIOException
InterruptedException
org.apache.zookeeper.KeeperException
protected ClientConfiguration getConf()
public void asyncCreateLedger(int ensSize, int qSize, BookKeeper.DigestType digestType, byte[] passwd, AsyncCallback.CreateCallback cb, Object ctx)
ensSize
- ensemble sizeqSize
- quorum sizedigestType
- digest type, either MAC or CRC32passwd
- passwordcb
- createCallback implementationctx
- optional control objectpublic LedgerHandle createLedger(BookKeeper.DigestType digestType, byte[] passwd) throws BKException, InterruptedException
digestType
- digest type, either MAC or CRC32passwd
- passwordInterruptedException
BKException
public LedgerHandle createLedger(int ensSize, int qSize, BookKeeper.DigestType digestType, byte[] passwd) throws InterruptedException, BKException
asyncCreateLedger(int, int, DigestType, byte[],
AsyncCallback.CreateCallback, Object)
ensSize
- qSize
- digestType
- passwd
- InterruptedException
BKException
public void asyncOpenLedger(long lId, BookKeeper.DigestType digestType, byte[] passwd, AsyncCallback.OpenCallback cb, Object ctx)
lId
- ledger identifierdigestType
- digest type, either MAC or CRC32passwd
- passwordctx
- optional control objectLedgerHandle.asyncClose(org.apache.bookkeeper.client.AsyncCallback.CloseCallback, java.lang.Object)
public void asyncOpenLedgerNoRecovery(long lId, BookKeeper.DigestType digestType, byte[] passwd, AsyncCallback.OpenCallback cb, Object ctx)
lId
- ledger identifierdigestType
- digest type, either MAC or CRC32passwd
- passwordctx
- optional control objectpublic LedgerHandle openLedger(long lId, BookKeeper.DigestType digestType, byte[] passwd) throws BKException, InterruptedException
lId
- ledger identifierdigestType
- digest type, either MAC or CRC32passwd
- passwordInterruptedException
BKException
asyncOpenLedger(long, org.apache.bookkeeper.client.BookKeeper.DigestType, byte[], org.apache.bookkeeper.client.AsyncCallback.OpenCallback, java.lang.Object)
public LedgerHandle openLedgerNoRecovery(long lId, BookKeeper.DigestType digestType, byte[] passwd) throws BKException, InterruptedException
lId
- ledger identifierdigestType
- digest type, either MAC or CRC32passwd
- passwordInterruptedException
BKException
asyncOpenLedgerNoRecovery(long, org.apache.bookkeeper.client.BookKeeper.DigestType, byte[], org.apache.bookkeeper.client.AsyncCallback.OpenCallback, java.lang.Object)
public void asyncDeleteLedger(long lId, AsyncCallback.DeleteCallback cb, Object ctx)
lId
- ledger Idcb
- deleteCallback implementationctx
- optional control objectpublic void deleteLedger(long lId) throws InterruptedException, BKException
asyncDeleteLedger(long, AsyncCallback.DeleteCallback, Object)
lId
- ledgerIdInterruptedException
BKException
public void close() throws InterruptedException, BKException
InterruptedException
BKException
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.