proxiedStateStorePids function

Set<int> proxiedStateStorePids({
  1. required String pidRootPath,
  2. String? readPidFile(
    1. String path
    ) = readPidFileIfPresent,
})

The store PIDs bd's own artifacts name under pidRootPath.

The process census keys on a --config/--root argument, which a child only carries once it has exec'd; bd records both PIDs the moment it forks. These files are therefore the only account of a Dolt server that is already running but not yet recognisable, and they are read BEFORE a fence signals anything, because the first SIGKILL is what takes them away.

An absent file is a store that is already down, which readPidFile reports as null. Anything else PRESENT is refused by name: a PID file this cannot read names a process an exit fence cannot wait out, and a teardown that assumes there is nothing to wait for is how both harnesses leaked a live Dolt server in the first place.

Implementation

Set<int> proxiedStateStorePids({
  required String pidRootPath,
  String? Function(String path) readPidFile = readPidFileIfPresent,
}) {
  final pids = <int>{};
  for (final name in _proxyPidNames) {
    final path = p.join(pidRootPath, name);
    final contents = readPidFile(path);
    if (contents == null) continue;
    pids.add(_parsePidArtifact(path, contents).pid);
  }
  return pids;
}