Record Class ScaffoldLockfile
java.lang.Object
java.lang.Record
network.ike.plugin.scaffold.ScaffoldLockfile
- Record Components:
schema- lockfile schema version (currentlyCURRENT_SCHEMA); future schema bumps will be accompanied by an in-place migratorstandardsVersion-ike-build-standardsversion that produced the last applied state; may benullfor a newly created lockfile that has not yet had a successful publishapplied- UTC timestamp of the last successful publish; may benull(never published)files- per-file entries, keyed by scaffold path. Paths are normalised to forward slashes and may use the"~/"prefix for user-home scope. Insertion order is preserved. The stored map is unmodifiable.
public record ScaffoldLockfile(int schema, String standardsVersion, Instant applied, Map<String, LockfileEntry> files)
extends Record
In-memory representation of a scaffold lockfile.
Two lockfile instances exist per scaffold run:
{project.root}/.ike/scaffold.lock— committed to git, tracks what the scaffold has installed in a project.{user.home}/.ike/scaffold.lock— local to a machine, tracks what the scaffold has installed in the user-home tier (~/.git-hooks/,~/.m2/settings.xml, etc.).
The on-disk format is YAML; see
ScaffoldLockfileIo for parse/emit.
This class records only current scaffold-owned state; it never stores user secrets or free-form user content.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe current on-disk schema version. -
Constructor Summary
ConstructorsConstructorDescriptionScaffoldLockfile(int schema, String standardsVersion, Instant applied, Map<String, LockfileEntry> files) Canonical constructor with validation and defensive copying of the file map. -
Method Summary
Modifier and TypeMethodDescriptionapplied()Returns the value of theappliedrecord component.static ScaffoldLockfileempty()Create an empty lockfile at the current schema with no entries and no applied state.final booleanIndicates whether some other object is "equal to" this one.files()Returns the value of thefilesrecord component.final inthashCode()Returns a hash code value for this object.intschema()Returns the value of theschemarecord component.Returns the value of thestandardsVersionrecord component.final StringtoString()Returns a string representation of this record class.withAppliedStamp(String standardsVersion, Instant applied) Return a copy with the top-levelstandardsVersionandappliedstamps updated (used when publish completes).withEntry(String path, LockfileEntry entry) Return a copy of this lockfile with one entry added or replaced.withoutEntry(String path) Return a copy of this lockfile with one entry removed.
-
Field Details
-
CURRENT_SCHEMA
public static final int CURRENT_SCHEMAThe current on-disk schema version. Bumps here must be paired with a migration inScaffoldLockfileIo.- See Also:
-
-
Constructor Details
-
ScaffoldLockfile
public ScaffoldLockfile(int schema, String standardsVersion, Instant applied, Map<String, LockfileEntry> files) Canonical constructor with validation and defensive copying of the file map.
-
-
Method Details
-
empty
Create an empty lockfile at the current schema with no entries and no applied state. Useful for initialising a new scaffold target.- Returns:
- a blank
ScaffoldLockfileatCURRENT_SCHEMA
-
withEntry
Return a copy of this lockfile with one entry added or replaced.- Parameters:
path- scaffold path keyentry- entry to store- Returns:
- a new lockfile with the entry in place (insertion order preserved: new keys append; existing keys keep their position)
-
withoutEntry
Return a copy of this lockfile with one entry removed.- Parameters:
path- scaffold path key to drop; missing keys are ignored- Returns:
- a new lockfile without that entry; the same instance if the entry was already absent
-
withAppliedStamp
Return a copy with the top-levelstandardsVersionandappliedstamps updated (used when publish completes).- Parameters:
standardsVersion- the ike-build-standards version just applied; must not benullapplied- timestamp of the publish; must not benull- Returns:
- a new lockfile with updated stamps
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
schema
-
standardsVersion
Returns the value of thestandardsVersionrecord component.- Returns:
- the value of the
standardsVersionrecord component
-
applied
-
files
-