Skip to content

ConfigSpecCollection

A directory-backed, runtime-managed collection of independent ConfigSpec files - one file per entry, each an ordinary ConfigSpec instance built by factory rather than a singleton object, since the number of entries isn't known at compile time. Existing files are discovered and loaded from directory on init. Its Cloth Config UI (a native add/remove net.kernelpanicsoft.archie.config.builder.ListFieldBuilder/net.kernelpanicsoft.archie.config.builder.MapFieldBuilder row, see ConfigSpecList/ConfigSpecMap) edits a scratch copy and only calls reconcile on save; add/remove act immediately instead, for programmatic use. Declare ConfigSpecList or ConfigSpecMap, not this directly.

A collection can be placed in two ways, and doesn't need to know which:

Either way, whatever attaches this collection assigns baseFolder before calling init.

Parameters

  • directory: Subfolder (under whatever baseFolder resolves to) this collection's files live in. Defaults to id.

  • synchronized: Whether factory produces ConfigSpec.Server entries that should sync to clients, server-authoritative: the server broadcasts which entries exist (a client's own add/remove is disabled in the UI - see buildCollectionEntry), and an existing entry's values sync like a normal ConfigSpec.Server's (permission-gated edits, reverted with a message if denied). All entries share one channel, registered once at attach time - a fresh payload type per entry can't be negotiated once the server has already accepted connections, so entries can't each get their own the way a standalone ConfigSpec.Server does.

  • factory: Builds a new/loading entry for the given entry id (typically its filename).

Inheritors

Properties

directory

Parameters

  • directory: Subfolder (under whatever baseFolder resolves to) this collection's files live in. Defaults to id.

id

open override val id: String

Stable identifier - this node's path segment when nested under a ConfigGroup.

synchronized

Parameters

  • synchronized: Whether factory produces ConfigSpec.Server entries that should sync to clients, server-authoritative: the server broadcasts which entries exist (a client's own add/remove is disabled in the UI - see buildCollectionEntry), and an existing entry's values sync like a normal ConfigSpec.Server's (permission-gated edits, reverted with a message if denied). All entries share one channel, registered once at attach time - a fresh payload type per entry can't be negotiated once the server has already accepted connections, so entries can't each get their own the way a standalone ConfigSpec.Server does.

title

open override val title: Component

Display title shown for this node's row in its parent's screen.

Functions

add

fun add(entryId: String): T

Creates, saves, and registers a new entry for entryId. For a synchronized collection, only ever call this server-side - see the class doc.

remove

fun remove(entryId: String)

Deletes entryId's file and drops it from this collection. No-op if absent. For a synchronized collection, only ever call this server-side - see the class doc.