A
ResourceDB::gdbm
object implements a
Resource Database
using a GDBM file.
ResourceDB::gdbm
inherits from both
gdbm::ResourceDB
and
ResourceDB
.
Each dependency is stored in a record whose key based on the
dependency's resource's name.
For example, resource “libfoo=3.4-1” is saved in a record that's
named after “libfoo”.
Furthermore, for file-based dependencies, the key is the last component of the
filename path.
For example, the file “/usr/bin/foo”, is saved under the key of
“foo”.
This is done in order to meaningfully compare different filenames that
actually refer to the same file, because some intermediate filename component
is a soft link (if /usr/lib64
is a soft link to
/usr/lib
, for example, then
/usr/lib64/foo
and
/usr/lib/foo
is the same file, and the resources
based on these files will compare as equal, as described in
Section 3, “Special logic for file-based resources”).
To add a new dependency, the existing list of dependencies with the same key
is retrieved from the
gdbm::ResourceDB
superclass,
the new dependency is added to the list, and the updated list is saved under
the same key.
A particular dependency is removed using an analogous procedure.
The
find
method retrieves the record associated with each dependecy's key, then
checks each dependency associated with the key, one at a time.
The
enumerate
method uses the
superclass's enumeration function to get all keys in the
GDBM files.
Each record is retrieved via the superclass, and all dependencies in the
record gets enumerated.