Class TreePublisher
java.lang.Object
ai.badmonkey.agentspaces.pdt.blob.TreePublisher
Publishes a directory as a map from relative path to
FileEntry
(srad/agentspaces-pdt.md ยง3.3, PD-B-05). Every regular file becomes a PBlob;
a symbolic link inside the root becomes an entry of mode 120000 whose blob
holds the link target, after Git; a symbolic link that leaves the root is refused;
empty directories have no entry. A publish with a previous result hands each
file's previous blob to PBlob.of(Path, NodeStore, PBlob), so an unchanged
file writes nothing and a changed file writes its delta.
The map itself is written through a TreePublisher.MapWriter. The default of
pmapWriter() builds a PMap<String, FileEntry> from the sorted
entries through one editor and returns its root; load(NodeStore, String) reads that map back.
This class walks files, builds blobs, and shares; the writer owns the map layout, and a
test may substitute one.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe seam to the persistent map: turns the entries into a map root.static final recordA published tree. -
Constructor Summary
ConstructorsConstructorDescriptionTreePublisher(NodeStore store) A publisher whose map is the persistent map ofpmapWriter().TreePublisher(NodeStore store, TreePublisher.MapWriter writer) A publisher. -
Method Summary
Modifier and TypeMethodDescriptionThe map apmapWriter()publish wrote.static TreePublisher.MapWriterThe map writer of PD-B-05: aPMap<String, FileEntry>keyed by relative path, built through one editor so the publish writes each new map node once.Publishes a directory from scratch.publish(Path dir, TreePublisher.Published previous) Publishes a directory, sharing every unchanged file's blob with a previous tree.
-
Constructor Details
-
TreePublisher
A publisher whose map is the persistent map ofpmapWriter().- Parameters:
store- where blobs and the map go
-
TreePublisher
A publisher.- Parameters:
store- where blobs and the map gowriter- the map seam
-
-
Method Details
-
pmapWriter
The map writer of PD-B-05: aPMap<String, FileEntry>keyed by relative path, built through one editor so the publish writes each new map node once. -
load
The map apmapWriter()publish wrote.- Parameters:
store- the store that holds itroot- the map root of aTreePublisher.Published- Returns:
- the map from relative path to entry
-
publish
Publishes a directory from scratch.- Parameters:
dir- the directory- Returns:
- the tree
- Throws:
IllegalArgumentException- when a symbolic link leaves the rootUncheckedIOException- when the walk fails
-
publish
Publishes a directory, sharing every unchanged file's blob with a previous tree.- Parameters:
dir- the directoryprevious- the previous tree, or null- Returns:
- the tree
- Throws:
IllegalArgumentException- when a symbolic link leaves the rootUncheckedIOException- when the walk fails
-