VCP::DB_File::big_records - VCP::DB_File::sdbml subclass for large records
use VCP::DB_File;
VCP::DB_File->new;
sdbm files are limited to 1008 bytes per record, including key. That's just not
enough for storing revisions in (although it suffices for most other VCP
needs).
This subclass assumes your disk is large enough and that you won't be altering
records in place, but allows for unlimited record sizes. No attempt is made to
reclaim free space; so far our application doesn't need that.
Records are retrievable in the order they were added in (so this
"file" may be a queue) or in random order (like a DB file).
There are three related data sets:
- an sdbm database "db", which is an index to the location and size
of each record for the key of the record
- a file "records.mdb", which is a set of ( key, record size, record data)
entries for each record
- a file "order.txt", which is a flat file with one key per record
in the order that they were added to the file
Generally, you should use this module only to read or write a dataset as an
error in reading could cause corruption if you write (the orders.txt is not
flushed or
seek() properly on a read error). This is sufficient for our
purposes, because these files are only used by but could be a problem if
read/write mode is needed.
foreach_record_do
$db->foreach_record_do( sub { ... } );
Iterate over the contents in as-stored order, executing sub { ... } for each one
found.
dump
BROKEN FOR NOW. Reports the pointers, not the pointed-to data
TODO: fix.
There is no way (yet) of telling the mapper to continue processing the rules
list. We could implement labels like " <<
label">
> to be allowed before pattern expressions (but not between pattern and
result), and we could then impelement " <<goto
label"> >. And a " <<next"> > could be
used to fall through to the next label. All of which is wonderful, but I want
to gain some real world experience with the current system and find a use case
for gotos and fallthroughs before I implement them. This comment is here to
solicit feedback :).
Barrie Slaymaker <barries@slaysys.com>
Copyright (c) 2000, 2001, 2002 Perforce Software, Inc. All rights reserved.
See VCP::License ("vcp help license") for the terms of use.
Hey!
The above document had some coding errors, which are explained
below:
- Around line 42:
- You can't have =items (as at line 237) unless the first thing after the
=over is an =item