ZK-1931/javazab — pull request #2 by EasonLiao (2014-06-10 20:07:52+00:00)
Title: Implement a simple transaction log

Implement a simple transaction log for v0.1. We are not implementing snapshotting in v0.1, so this will be a single infinitely growing log. What we are *not" doing for v0.1:

- checksum
- pre-allocation

Here is a proposal for the v0.1 log format:

```
log = [ transactions ]
transactions = transaction | transaction transactions
transaction = zxid length transaction-body
zxid = epoch (4 bytes?) xid (4 bytes?)
length = length of transaction-body as a 4 byte int
transaction-body = byte array
```

Should the zxid be 8 bytes like in ZooKeeper? I feel that the xid should be 8 bytes.

List of operations for v1:

- append(zxid, type, transaction-body)
- truncate(zxid)
- getLatestZxid()
- fdatasync()
- getIterator(zxid)

ZooKeeper implementation of transaction log for a reference: https://github.com/apache/zookeeper/blob/trunk/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java

============ EDIT:
append should take 2 parameters, zxid and transaction body.