tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg.refcount database as a flat file?

Over the years, has there been any discussion about changing the
refcount database from a directory tree under /var/db/pkg.refcount
to a text file, perhaps in structured format like JSON or a Lua

When I originally wrote that refcount code, the choices at the time
for a text-file representation of the data were either XML or some
home-grown format.  I hated the idea of using XML and I didn't want
to invent a file format for all of the information that needed to
be stored, so I went the easy route and just dumped data directly
into the filesystem under a directory tree into a bunch of little
text files.

The problem with the directory tree is that it's really annoying
to deal with the stored data as opposed to a well-known structured
data file format like JSON or Lua tables.  With a text file, we
would gain all the usual benefits, like being able to version
control and rollback, easily diff for changes, backup a single file
instead of a directory tree, etc.  We can use text-manipulation
tools instead of filesystem-manipulation tools to handle the data.
If we pick a well-known format like JSON or a Lua table, we have
access to other tools to do more advanced manipulations of the

I ask only because I was writing some shell/awk code to back up
the refcount directory tree into a file and restore it later from
that file, and it's not much more to add the extra bits to insert
and delete data in the file.


-- Johnny C. Lam

Home | Main Index | Thread Index | Old Index