Class IncrementalRegistry

java.lang.Object
network.ike.docs.plugin.registry.IncrementalRegistry

public final class IncrementalRegistry extends Object
The blob-keyed incremental registry (dev-adoc-packages, IKE-Network/ike-issues#1341). Every entry records the blob id of the content it was parsed from, and a run decides each file by one rule against the registry it wrote last time:
  • same path and same blob: keep the entry, without opening the file;
  • same blob at a path that is gone, a rename: re-key the entry to the new path, without opening the file;
  • a new or changed blob: parse the file;
  • a path that is gone: drop the entry.

Files that are not topics get an entry too, with their blob, so they are not opened again either. What is derived across files is derived again on every run from the entries: the duplicate-id findings, the counts, the domain grouping and the order. The result has the shape of TopicRegistry.model(List, Path, Instant), so it reads back through TopicRegistry.load(Path) and serves as the previous registry of the next run. A first run, or a run after the previous registry was deleted, parses everything.

Since:
136
  • Field Details

    • VERSION

      public static final String VERSION
      The registry-version of a registry whose entries carry blobs.
      See Also:
  • Method Details

    • update

      public static IncrementalRegistry.Outcome update(Map<String,Object> previous, Path root, BlobIndex index, Path base, Instant now) throws IOException
      Update a registry against the files a blob index lists.
      Parameters:
      previous - the registry written last time, from TopicRegistry.load(Path), or null for a first run
      root - the registry root the index paths are relative to
      index - every .adoc file under the root with its blob id
      base - the directory the root is shown relative to (the module base directory)
      now - the generation instant
      Returns:
      the outcome, with the new model
      Throws:
      IOException - if a file that must be parsed cannot be read