Coda File System

Chapter 2. Common Scenarios

There are several common scenarios that you may encounter. This chapter attempts to list as many of them as possible and suggest how to handle each scenario.

2.1. Constructing a hoardfile

Coda allows you to give files priorities that affect the cache manager. The higher the priority, the lower the possibility that a file will get flushed from the cache to make space for a another file. These priorities are stored in a hoard database internal to Venus. This database is preserved across invocations of Venus, but will be erased when Venus is re-initialized.

The best way to set up a hoard database is by creating hoard files. Afteryou've created the files once, you do not need to do it again for that set of files. You can create a hoard file by hand or by using the spy program. See the hoard (1) man page for more details.

To run spy :

  1. Run spy in the background, redirecting its output to a file.

  2. Run all of the programs and access files you want to hoard.

  3. Send a SIGTERM to spy (Do not use ^C )

  4. Sort the output file, removing duplicates

  5. Remove unnecessary entries

  6. On each line add a at the beginning and a priority at the end

The following is an example of creating a hoard file for gnu-emacs. Note that while running gnu-emacs, I explicitly enter scribe mode . This makes sure that the scribe-specific files are fetched.


%


spy
>
gemacs.out
&

[1] 316

%


gnu-emacs


%


kill %1


%

[1]    Done                 spy
>
gemacs.out

%


sort -u gemacs.out
>
gemacs.hdb


%


cat gemacs.hdb

/coda
/coda/i386_mach/omega/usr/local/emacs
/coda/i386_mach/omega/usr/misc/.gnu-emacs
/coda/misc/gnu-emacs/i386_mach/omega/bin/gnu-emacs
/coda/misc/gnu-emacs/i386_mach/omega/lisp/scribe.elc
/coda/misc/gnu-emacs/i386_mach/omega/lisp/term/x-win.el
/coda/misc/gnu-emacs/i386_mach/omega/lisp/x-mouse.elc
/coda/usr

Next you should delete the first and last line of the file as you do not need them. Then add the hoard specific commands. The final filelooks like:

a /coda/i386_mach/omega/usr/local/emacs 600
a /coda/i386_mach/omega/usr/misc/.gnu-emacs 600
a /coda/misc/gnu-emacs/i386_mach/omega/bin/gnu-emacs 600
a /coda/misc/gnu-emacs/i386_mach/omega/lisp/scribe.elc 600
a /coda/misc/gnu-emacs/i386_mach/omega/lisp/term/x-win.el 600
a /coda/misc/gnu-emacs/i386_mach/omega/lisp/x-mouse.elc 600

The a that starts each line tells hoard to add the named file to the database. The 600 that ends each line sets the file's priority. You may also specify additional attributes for each line. These attributes are separated from the priority by a : and are:

  • c Current children of the given directory will inherit its hoard status.

  • c+ Current and future children of the given directory will inherit its hoard status.

  • d Current descendents of the given directory will inherit its hoard status.

  • d+ Current and future descendents of the given directory will inherit its hoard status.

For example, to hoard all of the emacs directory, its descendents and any future descendents, I would include the following line in a hoardfile: a /coda/i386_mach/omega/usr/local/emacs 600:d+

This ensures you get all of the files you need, but you will use tens of megabytes of cache space to hoard many files that you do not need, so often you want to be more specific with respect to which files to hoard.

Other valid command to hoard are clear , delete , list , and modify . See the hoard (1) man page for more details on these commands.