With the new filesystem remapping and sfile blobs we are introducing a NFS-like index server. Basically all sfile reading and writing is handled by a single process that maintains a consistent view of the repository.

All the following will be hidden under the fslayer code. Normal bk code has no idea that something interesting or special is ever happening to get to the filesystem.

Initially only sfiles will be handled this way, but eventually other state files will be managed by a central server. (pfiles, dfiles, etc…​)

When a new bk process wants to read sfiles it needs to find a index server. A file ROOT/.bk/INDEX is consulted and it will contain an IP/PORT number of another bk process. If no INDEX is found or if the info is found to be stale then a new index server is spawned. That process will use sccs_lockfile(".bk/INDEX.lock") to acquire permissions to serve this repository. This process will continue to serve this repository until no new requests have been received for several minutes and then will write out state and exit.

The current INDEX is also put in the environment so that subprocesses do not need to read .bk/INDEX to know the INDEX.

Connections to the INDEX server are persistent and used for the duration of the process if possible. This means that current bkd code will NOT be used.

Properties of an INDEX server:

Commands from client to index server:

Issues