|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.bookkeeper.client.BookKeeper
public class BookKeeper
BookKeeper client. We assume there is one single writer to a ledger at any time. There are three possible operations: start a new ledger, write to a ledger, and read from a ledger. For the ZooKeeper layout, please refer to BKDefs.java.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher |
---|
Watcher.Event |
Constructor Summary | |
---|---|
BookKeeper(String servers)
|
Method Summary | |
---|---|
void |
asyncCreateLedger(int ensSize,
int qSize,
LedgerHandle.QMode mode,
byte[] passwd,
AsyncCallback.CreateCallback cb,
Object ctx)
Asychronous call to create ledger |
void |
asyncOpenLedger(long lId,
byte[] passwd,
AsyncCallback.OpenCallback cb,
Object ctx)
|
LedgerHandle |
createLedger(byte[] passwd)
Creates a new ledger. |
LedgerHandle |
createLedger(int ensSize,
int qSize,
LedgerHandle.QMode mode,
byte[] passwd)
Creates a new ledger. |
void |
halt()
Halts all bookie handles |
boolean |
hasClosed(long ledgerId)
Check if close node exists. |
LedgerHandle |
openLedger(long lId,
byte[] passwd)
Open existing ledger for reading. |
void |
process(WatchedEvent event)
Watcher method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BookKeeper(String servers) throws KeeperException, IOException
KeeperException
IOException
Method Detail |
---|
public void process(WatchedEvent event)
process
in interface Watcher
public LedgerHandle createLedger(int ensSize, int qSize, LedgerHandle.QMode mode, byte[] passwd) throws KeeperException, InterruptedException, IOException, BKException
ensSize
- ensemble sizeqSize
- quorum sizemode
- quorum mode: VERIFIABLE (default), GENERIC, or FREEFORMpasswd
- password
KeeperException
InterruptedException
IOException
BKException
public LedgerHandle createLedger(byte[] passwd) throws KeeperException, BKException, InterruptedException, IOException
passwd
- password
KeeperException
BKException
InterruptedException
IOException
public void asyncCreateLedger(int ensSize, int qSize, LedgerHandle.QMode mode, byte[] passwd, AsyncCallback.CreateCallback cb, Object ctx) throws KeeperException, InterruptedException, IOException, BKException
ensSize
- qSize
- mode
- passwd
- cb
- ctx
-
KeeperException
InterruptedException
IOException
BKException
public LedgerHandle openLedger(long lId, byte[] passwd) throws KeeperException, InterruptedException, IOException, BKException
long
- the long corresponding to the ledger idbyte[]
- byte array corresponding to the password to access a ledgerint
- the quorum size, it has to be at least ceil(n+1/2)
KeeperException
InterruptedException
IOException
BKException
public void asyncOpenLedger(long lId, byte[] passwd, AsyncCallback.OpenCallback cb, Object ctx) throws InterruptedException
InterruptedException
public boolean hasClosed(long ledgerId) throws KeeperException, InterruptedException
ledgerId
- id of the ledger to check
KeeperException
InterruptedException
public void halt() throws InterruptedException
InterruptedException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |