Datafile
provides a random-access file that serializes objects to variable length records in a random-access file. A Datafile
allows the deletion of records and automatically uses such space for new records. For the purposes of a Datafile
, consider record and object to be synonyms. In traditional database terms, a Datafile
is a table, each object is a row, and each field in an object is a column. Unlike a full-featured database, a Datafile
can contain a set of heterogenous records -- in other words, different objects can be stored together in one Datafile
. This class is the foundation of the Itzam/Java package, providing the fundamental file structure for both indexes and data files.
A Datafile
stores objects that implement the Itzamable
interface. Records in a Datafile
can have varying lengths based on the serialization requirements of objects. To handle variable-length records, a Datafile
records the size of each record. When a record is deleted, the space it occupied is marked as empty; the files maintains a list of deleted record locations and thier sizes. Inserting a new record involves a traverse of the deleted list, looking for an empty record that is large enough to contain the new information. If the deleted list is empty, or the new record is too large to fit into any open slots, the new object record is appended to the file.
@see com.coyotegulch.itzam.Btree
@see com.coyotegulch.itzam.Itzamable
|
|
|
|