simple_version_tool Class Reference

#include <simpverstool.h>


Public Member Functions

virtual ~simple_version_tool ()
 simple_version_tool (const nstring &history_file_name, compression_algorithm_t comp_alg=compression_algorithm_not_set)
void checkin (const nstring &input_file_name, const rfc822 &meta_data)
void checkin (const nstring &input_file_name)
bool list (rfc822_functor &arg)
void checkout (const nstring &output_file_name, const nstring &version)
void checkout (output::pointer os, const nstring &version)

Private Member Functions

 simple_version_tool ()
 simple_version_tool (const simple_version_tool &)
simple_version_tooloperator= (const simple_version_tool &)

Private Attributes

nstring history_file_name
compression_algorithm_t compression_algorithm


Detailed Description

The simple_version_tool class is used to represent the current state of a simple version recording tool.

It stores all versions end-to-end in a compressed file, with RFC 882 headers between, to hold things like the version number and the content length. The trick is, it's all compressed using GNU gzip.

The idea is the same one as behind xdelta (RFC nnnn). Because all the versions are substantially similar most of the time, the compression state carries over between versions, resulting in very high compression ratios for versions later in the file.

We put the head revsion first, simply because it is accessed most often. It doesn't change the premise, or the results.

End-to-end issues:

Each version also has an Adler 32 checksum stored in the header. This lets us check that the data is valid when we extract it. The GNU gzip format also has an Adler 32 checksum in the trailer, and this is used for for confirming that previous version are still valid when we do a new checkin. The checksum in each version is because we don't always read to the end of the compressed file, ans to the checksum in the trailer is not verified.

Definition at line 58 of file simpverstool.h.


Constructor & Destructor Documentation

virtual simple_version_tool::~simple_version_tool (  )  [virtual]

The destructor.

simple_version_tool::simple_version_tool ( const nstring history_file_name,
compression_algorithm_t  comp_alg = compression_algorithm_not_set 
)

The constructor.

Parameters:
&history_file_name The name of the file being used to store the version history.
comp_alg The compression algorithm to use. Defaults to the best available (may be slow, may use much memory).

simple_version_tool::simple_version_tool (  )  [private]

The default constructor. Do not use.

simple_version_tool::simple_version_tool ( const simple_version_tool  )  [private]

The copy constructor. Do not use.


Member Function Documentation

void simple_version_tool::checkin ( const nstring input_file_name,
const rfc822 meta_data 
)

The checkin method is used to add another version to the file history. It will be stored in the history file supplied to the constructor.

Parameters:
input_file_name The name of the file to read for the latest version of the file.
meta_data Additional information to include in the file header.

void simple_version_tool::checkin ( const nstring input_file_name  ) 

The checkin method is used to add another version to the file history. It will be stored in the history file supplied to the constructor.

Parameters:
input_file_name The name of the file to read for the latest version of the file.

bool simple_version_tool::list ( rfc822_functor arg  ) 

The list method is used to extract and process the meta data of each version, from most recent to least.

Parameters:
arg The functor used to handle the data.
Returns:
boolean; false if any of the functor calls returned false, true if they all returned true (or the file was empty).

void simple_version_tool::checkout ( const nstring output_file_name,
const nstring version 
)

The checkout method is used to extract version of the file from the history archive.

Parameters:
output_file_name The name of the file in which to write for the selected version of the file. (The file name "-" understood to mean the standard output.)
version The version of the file to extract. Version zero is understood to mean the head revision (the most recently checked in version).

void simple_version_tool::checkout ( output::pointer  os,
const nstring version 
)

The checkout method is used to extract version of the file from the history archive.

Parameters:
os The output stream on which the selected file version is to be written.
version The version of the file to extract. Version zero is understood to mean the head revision (the most recently checked in version).

simple_version_tool& simple_version_tool::operator= ( const simple_version_tool  )  [private]

The assignment operator. Do not use.


Field Documentation

The &history_file_name instance variable is used to remember the name of the file being used to store the version history.

Definition at line 146 of file simpverstool.h.

The compression algorithm

Definition at line 151 of file simpverstool.h.


The documentation for this class was generated from the following file:

Generated on Wed Mar 12 23:37:44 2008 for Aegis by  doxygen 1.5.5