DBM::Deep::Internals(3pm) User Contributed Perl Documentation DBM::Deep::Internals(3pm)
NAME
DBM::Deep::Internals - Out of date documentation on DBM::Deep internals
OUT OF DATE
This document is out-of-date. It describes an intermediate file format used during the development from 0.983 to 1.0000. It will be
rewritten soon.
So far, the description of the header format has been updated.
DESCRIPTION
This is a document describing the internal workings of DBM::Deep. It is not necessary to read this document if you only intend to be a
user. This document is intended for people who either want a deeper understanding of specifics of how DBM::Deep works or who wish to help
program DBM::Deep.
CLASS LAYOUT
DBM::Deep is broken up into five classes in three inheritance hierarchies.
o DBM::Deep is the parent of DBM::Deep::Array and DBM::Deep::Hash. These classes form the immediate interface to the outside world. They
are the classes that provide the TIE mechanisms as well as the OO methods.
o DBM::Deep::Engine is the layer that deals with the mechanics of reading and writing to the file. This is where the logic of the file
layout is handled.
o DBM::Deep::File is the layer that deals with the physical file. As a singleton that every other object has a reference to, it also
provides a place to handle datastructure-wide items, such as transactions.
FILE LAYOUT
This describes the 1.0003 and 2.0000 formats, which internally are numbered 3 and 4, respectively. The internal numbers are used in this
section. These two formats are almost identical.
DBM::Deep uses a tagged file layout. Every section has a tag, a size, and then the data.
File header
The file header consists of two parts. The first part is a fixed length of 13 bytes:
DPDB h VVVV SSSS
/ |
/ '---. '--- size of the second part of the header
file '--- version
signature tag
o File Signature
The first four bytes are 'DPDB' in network byte order, signifying that this is a DBM::Deep file.
o File tag
A literal ASCII 'h', indicating that this is the header. The file used by versions prior to 1.00 had a different fifth byte, allowing
the difference to be determined.
o Version
This is four bytes containing the file version. This lets the file format change over time.
It is packed in network order, so version 4 is stored as "