|
||||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||||
See:
Description
| Interface Summary | |
|---|---|
| BlockDB | |
| BlockKey | |
| ByteGet | This interface is used to define the common elements of Transaction's and AppendBlockIO from the standpoint of the Handle class. |
| Class Summary | |
|---|---|
| AppendBlockIO | This implements a block device tied to a random access file. |
| Handle | |
| RecoverDB | |
| Transaction | |
| Exception Summary | |
|---|---|
| BlockException | |
| RecoveryException | |
The AppendDB package implements net.metanotion.io.BlockIO<Integer,byte[],Transaction>, and provides non-nested, threadsafe, mostly lock free, ACID transactions. This is appropriate if you need to store serialized or binary data in a randomly accessible, atomicly updated, single file "data store".
This data store stores its data in a net.metanotion.io.RandomAccess file. No part of the file is ever overwritten, changes and additions are just appended to the end of the file. The allocBlock() method returns an integer which is then used to identify the block. getBlock() provides a handle for retrieving the bytes stored in the block or changing them. The first block on a new file will always be block #0. The class AppendBlockIO represents the data store. A cache is used and the size set at instantiation, and is sized by the number of bytes, approximately consumed by the objects stored in the cache. If a block is changed, a new copy is appended to the end of the file.
In order to ensure efficient access, a B-tree indexing block numbers to the latest version of the block in the file is maintained. If the file is not properly closed, the root of the tree will not be the last block in the file. If that is the case, the recovery functionality in net.metanotion.io.appenddb.RecoverDB covered by the static method .recover(file, cache size) needs to be used. This will scan the file from beginning to end and reconstruct the index and close the file.
If the file gets too big due to old versions of blocks in the file it can be compacted into a new file. The compaction process has not been written yet.
|
||||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||||