omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / seed / authority / envelope.om
| 1 | note SC1-E pure public partition helper, not a scheduler or secrecy proof. |
| 2 | note Record8: format,owner,reservation-id,public-boundary,active,capacity,partition,zero. |
| 3 | note Open once before any secret work. Owner/id refer to existing writer reservation. |
| 4 | note Fixed public partition must cover descendants, cleanup and supervisor work too. |
| 5 | note Failure leaves record unchanged. State and boundary are trusted writer inputs. |
| 6 | note Copies do not mint authority: only the single serialized owner may mutate live state. |
| 7 | fn ep_valid e view ulong 8 to ulong |
| 8 | if ne get e 0 1 |
| 9 | ret 1 |
| 10 | end |
| 11 | if or eq get e 1 0 or eq get e 2 0 eq get e 3 0 |
| 12 | ret 1 |
| 13 | end |
| 14 | if or gt get e 4 1 ne get e 7 0 |
| 15 | ret 1 |
| 16 | end |
| 17 | if or eq get e 6 0 gt get e 6 get e 5 |
| 18 | ret 1 |
| 19 | end |
| 20 | ret 0 |
| 21 | end |
| 22 | fn ep_open e edit ulong 8 owner ulong id ulong boundary ulong cap ulong part ulong to ulong |
| 23 | for i ulong 8 |
| 24 | if ne get e i 0 |
| 25 | ret 1 |
| 26 | end |
| 27 | end |
| 28 | if or eq owner 0 or eq id 0 eq boundary 0 |
| 29 | ret 1 |
| 30 | end |
| 31 | if or eq part 0 gt part cap |
| 32 | ret 1 |
| 33 | end |
| 34 | put e 0 1 |
| 35 | put e 1 owner |
| 36 | put e 2 id |
| 37 | put e 3 boundary |
| 38 | put e 4 1 |
| 39 | put e 5 cap |
| 40 | put e 6 part |
| 41 | ret 0 |
| 42 | end |
| 43 | fn ep_available e view ulong 8 to ulong |
| 44 | if ne ep_valid e 0 |
| 45 | ret 0 |
| 46 | end |
| 47 | if eq get e 4 0 |
| 48 | ret get e 5 |
| 49 | end |
| 50 | ret sub get e 5 get e 6 |
| 51 | end |
| 52 | note event1 completion,2 cancellation,3 error,4 supervisor-work. None refunds. |
| 53 | fn ep_event e edit ulong 8 event ulong to ulong |
| 54 | if ne ep_valid e 0 |
| 55 | ret 1 |
| 56 | end |
| 57 | if or lt event 1 gt event 4 |
| 58 | ret 1 |
| 59 | end |
| 60 | ret 0 |
| 61 | end |
| 62 | note Unknown quiescence returns4 and retains. Do not certify secret-dependent release delay. |
| 63 | note Boundary is a public schedule identity, not a secret-selected completion timestamp. |
| 64 | fn ep_release e edit ulong 8 boundary ulong quiet bool to ulong |
| 65 | if ne ep_valid e 0 |
| 66 | ret 1 |
| 67 | end |
| 68 | if ne boundary get e 3 |
| 69 | ret 2 |
| 70 | end |
| 71 | if not quiet |
| 72 | ret 4 |
| 73 | end |
| 74 | put e 4 0 |
| 75 | ret 0 |
| 76 | end |