Skip to content

Commit 22d6be4

Browse files
author
Tania Mathern
committed
fix: Docs
1 parent 340cd1b commit 22d6be4

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

docs/native-resources-management.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ Each `ManagedResource` tracks its state with a `LifecycleState` enum:
7474

7575
```mermaid
7676
stateDiagram-v2
77+
direction LR
7778
[*] --> UNINITIALIZED : __init__()
7879
UNINITIALIZED --> ACTIVE : native pointer created
79-
ACTIVE --> CLOSED : close() / __exit__ / __del__
80-
ACTIVE --> CLOSED : _mark_consumed()
80+
ACTIVE --> CLOSED : close() / __exit__ / __del__ / _mark_consumed()
8181
```
8282

8383
- `UNINITIALIZED`: The Python object exists but the native pointer has not been set yet. This is a transient state during construction.
@@ -169,10 +169,13 @@ A `Builder` follows the same pattern as Reader, with one difference: **signing c
169169
stateDiagram-v2
170170
direction LR
171171
[*] --> ACTIVE : Builder.from_json(manifest)
172-
ACTIVE --> CLOSED_BY_SIGN : .sign()
173-
ACTIVE --> CLOSED : close() without signing
174-
CLOSED_BY_SIGN --> [*]
172+
ACTIVE --> CLOSED : .sign() or close()
175173
CLOSED --> [*]
174+
175+
note left of CLOSED
176+
.sign() consumes the pointer
177+
close() frees it
178+
end note
176179
```
177180

178181
While `ACTIVE`, callers can use `.add_ingredient()`, `.add_action()`, etc. repeatedly. `.sign()` consumes the native pointer (ownership transfers to the native library), so the Builder cannot be reused afterward. Closing without signing frees the pointer normally.

0 commit comments

Comments
 (0)