On this page

Named conduits, ownership transfer, and severing๏ƒ

Prerequisite: links and permissions. Names make dynamic conduits discoverable through their frame's cloud. They also make a useful application vocabulary: platform, services, and workflows can identify independently owned parts of a system.

Find the owner๏ƒ

The cloud lessons show lookup of already-created named conduits. Choose a distinct name for each root in the same frame. A fresh root still comes from a fresh book; lookup does not create a second root for an existing book.

Transfer stewardship๏ƒ

transfer_spell_ownership(...) moves stewardship to the target conduit and returns a report. By default (move_creations=True, since 0.2.8239) the objects the old owner's creations hold for the spell move with it: a unique stays one object, served by the new owner and disposed when the new owner is cleaned up. The many dependencies a moved object was built with do not move: they belong to the conduit or spell space that built them and are disposed when it ends. With move_creations=False those objects leave the old owner's creations without being moved or disposed, and the new owner builds its own. A transfer disposes nothing. The saved lesson requests move_creations=True, inspects the report, and resolves from the new home. Read that report when diagnosing a transfer; sharing and moving ownership have different lifecycle consequences.

A transfer hands over stewardship, not a working setup. The spells the transferred spell depends on stay with the old owner unless include_dependencies=True moves the direct ones, so expect the new owner to start out broken once the old owner tears down: its moved objects can hold dependencies that were just disposed. That is normal in a runtime agents iterate in. The new owner purges what it does not want, binds the dependencies it needs (a meld without them raises UnresolvedInputError naming each missing input) and builds its own version, while the old owner cleans up after itself.

End the relationship๏ƒ

sever_link(...) removes the relationship and the contracts carried by it. The sever lesson attempts another borrower meld, then checks the owner's live object. This distinguishes the borrower's resolution rights from the owner's retained creation. Application references you already hold still need their own lifecycle policy.

Finish with the connected-subsystem walkthrough.

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    source_book = dynamic_spellbook()
 3    spell_id = source_book.bind(spell=MigratingService, existence="unique")
 4    source = source_book.conjure(dynamic=True, name="old-home")
 5    target = dynamic_spellbook().conjure(dynamic=True, name="new-home")
 6    source.link(target)
 7
 8    report = source.transfer_spell_ownership(
 9        spell=spell_id, target_conduit=target, move_creations=True,
10    )
11
12    # THE PREFLIGHT SUMMARY IS THE POINT. Ownership moving is not a silent
13    # side effect - it hands back an auditable report of what it did.
14    assert isinstance(report, dict) and report, report
15    print("transfer report keys:", sorted(report))
16
17    # THE NEW HOME CAN MELD IT.
18    moved = target.meld("MigratingService")
19    assert isinstance(moved, MigratingService)
20    print("new home melds it:", type(moved).__name__)
21
22    # AND THE OLD HOME CANNOT. This is the assertion that makes it a
23    # TRANSFER rather than a share - if the source could still meld it,
24    # ownership would have been copied, not moved.
25    try:
26        source.meld("MigratingService")
27        raise AssertionError(
28            "the source still melds it - that is sharing, not transfer"
29        )
30    except Exception as gone:
31        print("old home refused -", type(gone).__name__, ":",
32              str(gone)[:70])
33        print("  stewardship MOVED. A copy would have left both able to")
34        print("  meld, and then `ownership` would mean nothing")

Runnable examples๏ƒ

All intermediate examples ยท Level contents ยท Full contents

Canonical page source