Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/node/journal-test.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / node / journal-test.om` 1136 lines ยท 23718 bytes Raw Blame History 1 note Concatenate after transport.om, pool.om, super.om, sched.om, 2 note seed/authority/action.om, journal.om and auth.om. CPU-only acceptance of 3 note DRA-289: a conductor forks a creator, makes it crash at each durable and 4 note effect boundary (exit 77 at jcrash points 1..6, or SIGKILL while a tool 5 note runs), restarts it, and then checks the journal, the effects and the 6 note recovered outcomes with its own reader (jt_load, not jn_scan). 7 note Journal directory build/node/jt, relative to the repository root. 8 note Job id kind*1000 + op. Tools (/bin/sh -c), all writing under the 9 note directory: kind 1 appends "" to sink; kind 2 sleeps 1 s first; 10 note kind 3 is idempotent: it creates key k. with ln (never replaces) 11 note and appends "" only when it did; kind 4 appends "s", sleeps 12 note 1 s, then acts as kind 3. Kinds 1 and 2 are class 1 (external effect), 13 note kinds 3 and 4 class 3 (idempotent, decided by the key at recovery). 14 text jtsh "/bin/sh" 15 text jtdc "-c" 16 text jtt2 "echo " 17 text jtt3 " >> build/node/jt/sink" 18 text jtt4 "sleep 1; " 19 text jtt5 " > build/node/jt/t." 20 text jtt6 " && ln build/node/jt/t." 21 text jtt7 " build/node/jt/k." 22 text jtt8 " && echo " 23 text jtt9 "; rm -f build/node/jt/t." 24 text jtts "echo s" 25 text jtdir "build/node/jt" 26 text jtfj "build/node/jt/journal" 27 text jtfl "build/node/jt/lock" 28 text jtfs "build/node/jt/sink" 29 text jtfk "build/node/jt/k." 30 text jtft "build/node/jt/t." 31 text jtok "PASS node journal\n" 32 global jtm long 1 33 global jtr ulong 4096 34 global jtn ulong 1 35 global jtb uchar 65536 36 global jtp uchar 64 37 38 fn jt_ok ok bool code int to void 39 if not ok 40 exit code 41 end 42 end 43 44 fn jt_tlen k ulong to ulong 45 if eq k 0 46 ret len jtsh 47 end 48 if eq k 1 49 ret len jtdc 50 end 51 if eq k 2 52 ret len jtt2 53 end 54 if eq k 3 55 ret len jtt3 56 end 57 if eq k 4 58 ret len jtt4 59 end 60 if eq k 5 61 ret len jtt5 62 end 63 if eq k 6 64 ret len jtt6 65 end 66 if eq k 7 67 ret len jtt7 68 end 69 if eq k 8 70 ret len jtt8 71 end 72 if eq k 9 73 ret len jtt9 74 end 75 ret len jtts 76 end 77 78 fn jt_tb k ulong i ulong to uchar 79 if eq k 0 80 ret get jtsh i 81 end 82 if eq k 1 83 ret get jtdc i 84 end 85 if eq k 2 86 ret get jtt2 i 87 end 88 if eq k 3 89 ret get jtt3 i 90 end 91 if eq k 4 92 ret get jtt4 i 93 end 94 if eq k 5 95 ret get jtt5 i 96 end 97 if eq k 6 98 ret get jtt6 i 99 end 100 if eq k 7 101 ret get jtt7 i 102 end 103 if eq k 8 104 ret get jtt8 i 105 end 106 if eq k 9 107 ret get jtt9 i 108 end 109 ret get jtts i 110 end 111 112 note Append text k to s at n; the new length. 113 fn jt_add s edit uchar 1024 n ulong k ulong to ulong 114 m = jt_tlen k 115 for i ulong m bound 64 116 put s add n i jt_tb k i 117 end 118 ret add n m 119 end 120 121 note Append the decimal v to s at n; the new length. 122 fn jt_num s edit uchar 1024 n ulong v ulong to ulong 123 d = new uchar 20 0 124 x = v 125 k = ulong 20 126 for i ulong 20 127 k = sub k 1 128 put d k uchar add rem x 10 48 129 x = div x 10 130 if eq x 0 131 break 132 end 133 end 134 for i ulong sub 20 k bound 20 135 put s add n i get d add k i 136 end 137 ret add n sub 20 k 138 end 139 140 note The idempotent part: echo N > t.N && ln t.N k.N && echo N >> sink; rm -f t.N 141 fn jt_keyed s edit uchar 1024 n ulong op ulong to ulong 142 m = jt_add s n 2 143 m = jt_num s m op 144 m = jt_add s m 5 145 m = jt_num s m op 146 m = jt_add s m 6 147 m = jt_num s m op 148 m = jt_add s m 7 149 m = jt_num s m op 150 m = jt_add s m 8 151 m = jt_num s m op 152 m = jt_add s m 3 153 m = jt_add s m 9 154 ret jt_num s m op 155 end 156 157 fn jt_script kind ulong op ulong s edit uchar 1024 to ulong 158 n = ulong 0 159 if eq kind 4 160 n = jt_add s n 10 161 n = jt_num s n op 162 n = jt_add s n 3 163 put s n 59 164 put s add n 1 32 165 n = add n 2 166 end 167 if or eq kind 2 eq kind 4 168 n = jt_add s n 4 169 end 170 if ge kind 3 171 ret jt_keyed s n op 172 end 173 n = jt_add s n 2 174 n = jt_num s n op 175 ret jt_add s n 3 176 end 177 178 note Packed argv: /bin/sh -c