On this page

Create, seal, and read a checkpoint๏ƒ

Prerequisite: configuration ownership. These entry lessons introduce recording without requiring the complete Expert persistence guide.

Configure and activate Crystallizer before creating checkpoints. The creation lesson gets a checkpoint ID, lists it, describes it, and confirms that another checkpoint receives a different ID.

Know which operation completed๏ƒ

Operation

What you can conclude

create_checkpoint(...)

A checkpoint exists in the running record

flush_checkpoint(...)

The checkpoint is sealed locally; inspect remote delivery separately

list_cached_checkpoint_ids()

Which checkpoint IDs remain in the bounded local cache

reload_cached_checkpoint(...)

A cached record is read back into the record system

verify_checkpoint_chain(...)

A report about the recorded lineage

A bounded cache can evict older entries. A successful local seal does not establish remote durability. Reloading a record is also different from rebuilding its runtime objects: use restore and cold boot for that next step.

The workflow in code๏ƒ

These are the core steps from the saved example. Use its complete linked script for all class definitions and setup.

 1def main() -> None:
 2    crystallizer = md.Crystallizer()
 3    print("crystallizer activated at start:", crystallizer.activated)
 4    assert crystallizer.activated is False
 5
 6    # THE CONFIG. Bare constructor - unlike the frame posture in lesson 06,
 7    # this one you build empty and fill in.
 8    config = md.CrystallizerConfiguration()
 9    config.with_defaults()
10
11    # AETHER'S LADDER, NOT NEXUS'S. Rung 1: seal it.
12    config.finalize()
13    assert config.activated is False
14    print("config finalized - activated:", config.activated)
15
16    # Rung 2: the caller activates. Nexus would have done this for us;
17    # Aether and Crystallizer both make it explicit.
18    config.activate()
19    assert config.activated is True
20    print("config activated - activated:", config.activated)
21
22    # Rung 3: the subsystem comes up.
23    crystallizer.activate(config)
24    assert crystallizer.activated is True
25    # NOTE: `is_activated` is a PROPERTY, not a method - calling it gives
26    # "TypeError: 'bool' object is not callable". Two read names for one
27    # bit, both properties.
28    assert crystallizer.is_activated is True
29    print("crystallizer activated:", crystallizer.activated)
30
31    # THE THREE-EXIT BUILDER. Same destination, you pick the rung. This is
32    # a SECOND configuration object - the one above is already installed.
33    builder = md.CrystallizerConfigurationBuilder()
34    for terminator in ("build", "finalize", "activate"):
35        assert hasattr(builder, terminator), terminator
36    print()
37    print("CrystallizerConfigurationBuilder terminators: build/finalize/activate")
38    print("AetherConfigurationBuilder offers only build() - rung 2 is yours")
39
40    ready = md.CrystallizerConfigurationBuilder().with_defaults().activate()
41    assert isinstance(ready, md.CrystallizerConfiguration)
42    assert ready.activated is True
43    print("builder.activate() -> a config already in force")
44
45    # ------------------------------------------------------------------
46    # THE CHECKPOINT
47    # ------------------------------------------------------------------
48    before = crystallizer.list_checkpoint_ids()
49    assert isinstance(before, list)
50    print()
51    print("checkpoints before:", len(before))
52
53    checkpoint_id = crystallizer.create_checkpoint(
54        description="advanced lesson 17 - first checkpoint",
55    )
56    assert isinstance(checkpoint_id, str) and checkpoint_id
57    print("created checkpoint:", checkpoint_id)
58
59    after = crystallizer.list_checkpoint_ids()
60    assert checkpoint_id in after
61    assert len(after) == len(before) + 1
62    print("checkpoints after: ", len(after))
63
64    # THE ID IS THE HANDLE. Everything else keys off it.
65    described = crystallizer.describe_checkpoint(checkpoint_id)
66    assert isinstance(described, dict)
67    print("describe_checkpoint ->", len(described), "keys")
68    print("  keys:", sorted(described)[:6])
69
70    # A second checkpoint gets its own id - they are not overwritten.
71    second_id = crystallizer.create_checkpoint(description="second")
72    assert second_id != checkpoint_id
73    assert len(crystallizer.list_checkpoint_ids()) == len(before) + 2
74    print("second checkpoint is a distinct id, not an overwrite")
75
76    print()
77    print("caller-driven activation is the house rule - nexus is the exception")
78    print("create_checkpoint hands back an ID; the ID is the whole handle")

Runnable examples๏ƒ

All advanced examples ยท Level contents ยท Full contents

Canonical page source