is_journal 0.9.0
is_journal: ^0.9.0 copied to clipboard
An add-only journal of bytes: each entry chained to the one before it, naming the bytes and the hash of the code that wrote it.
Changelog #
0.9.0 #
- Breaking: two kinds renamed, under the naming rulings (a name says
literally what the thing is).
assignedis nowusers-assigned-to-journey-path, andendedis nowjourney-ended. The old names are no longer special: a sender table may list them as ordinary kinds. No entry of either old kind was ever written to a live record, so nothing has to read them. - Refusals renamed with them:
assigned-body,assigned-not-rootandassigned-againare nowusers-assigned-body,users-assigned-not-rootandusers-assigned-again;ended-bodyisjourney-ended-body; and an entry on an ended journey's chain is refusedjourney-ended <journey>, notclosed <journey>(a closed thing can be reopened; an ended journey can't). - Sender tables naming the old kinds must change in the same deploy.
- No kind is newly reserved: only
-andstartedare refused byKind.parse, as in 0.8.0. - The code hash changes:
lib/changed.
0.8.0 #
- Chain ownership. An
assignedentry starts a journey path's chain, and only the user it names asloopUsermay extend that chain. Anendedentry closes every chain of its journey. A kind on the sender table's newattaching:line starts a chain that names its parent on its first body line and belongs to the parent's path. The README's "Chains a journey path owns" gives the rules and each refusal. assignedandendedare now refused unless their bodies read as the README says. Any other kind is treated as it was.- A sender table with an
attaching:line is refused by 0.7.0 and older, which readattaching:as a user. - Who owns which chain is rebuilt from the journal on every start.
- The code hash changes:
lib/changed.
0.7.0 #
- Breaking, on the read socket:
follow <kinds> <after>is nowsubscribe <kinds> from <entry>, withstartfor the journal's start in place of-. The old request is refused (refused not-a-request); there is no transition.caught-upsaysstart, not-, when there is no entry to name.-now means only "no previous entry". - The header's second line is called
<previous>, not<follows>, in the docs and the code: the entry before this one in its chain. Only the name changed: no byte a writer sends, no entry and no hash differs. - The code hash changes:
lib/changed.
0.6.0 #
- The read socket answers
get <entry>: the entry with its bytes, asfollowsends it, plus its 96 bytes in hex, so a reader can check that the entry hashes to its name and the bytes to the object it names. Ornonewhen the journal holds no such entry,unreadable … missing|corruptwhen it does but its bytes are gone or changed, orfailed. - The service indexes every entry, including one whose object is lost or
that has no header, so
getnever saysnonefor an entry that was recorded, before or after a restart. When something other than the service has written to the journal, it reads the journal back. - A journal holds a lock on its
writer.<pid>while open, and opening deletes the claims no process holds, left by a process that ended without closing (aSIGKILL, or running out of memory). A journal 0.5.0 or older holds no such lock, so don't open a directory from both at once. - The code hash changes:
lib/changed.
0.5.0 #
package:is_journal/service.dartanddart run is_journal:service: a journal's one writer, which other processes send entries to over a Unix socket. It refuses a kind the sender's user may not write (read from the socket:SO_PEERCREDon Linux,LOCAL_PEERCREDon macOS) and an entry that does not follow its chain's tip, and adds astartedentry holding the sender table on every start. The checks are inlib/, so the code hash covers them.- A read socket (
JOURNAL_READ_SOCKET, optional), for readers who can only read:follow <kinds> <after>sends the matching entries after a point and then each new one as it is added, andtip <entry>answers a chain's tip. Every entry comes with the hashokanswered for it. Journal.addEntryadds asadddoes and returns the hash of the entry it wrote.
0.4.0 #
The format is unchanged, but every code hash changes: approve 0.4.0's anew.
- The code hash covers the
is_content_idthe journal runs with, not only this package: thelib/files of both, each path under its package's name. A newis_content_idchanges the hash, whichever version an app resolves,dependency_overridesincluded. - So the dependency is
^0.2.0again. 0.3.0's exact pin kept any app from combining the journal with a library that needs anis_content_idfix. - The README's bash check hashes both packages, finding them through
.dart_tool/package_config.json, from this package's root or an app's.
0.3.0 #
The format is unchanged: journals written by 0.2.0 read the same, and an entry 0.2.0 padded with zeros stays as it is.
- An entry torn by a crash is cut off before the next entry is written,
instead of padded with zeros and chained from. Its add never returned and
its object was never kept, so nothing recorded is lost, and
check()reports the journalIntactagain rather thanBrokenfor good. addthrowsObjectNotKept, aFileSystemExceptioncarrying the id, when its entry went in but its object did not, so a caller can tell that adding again would record the bytes twice.- The library comment says what "written and flushed" covers: this process crashing, not a power cut, since the renames that keep objects are not flushed to their folder.
- A compiled build can keep a journal.
dart run is_journal:code_hashprints-Dis_journal.code=<hash>from the source about to be compiled, andJournal.openuses it when there is no source to hash. Run from source,openthrows aStateErrorwhen that define is not this code's hash. - Depends on
is_content_id0.2.0 exactly, not ^0.2.0, and the library comment names that version, so the code hash changes when the pin does: the same code hash means the sameis_content_id. A test fails ifpubspec.yamlandlib/disagree, or if the pin becomes a range.
0.2.0 #
The format is unchanged: journals written by 0.1.0 read the same.
- The code hash is an
is_content_idFileSetId, the name of a set of files, whichis_content_id0.2.0 now holds.CodeHashis gone:Journal.codeHash,Journal.ownHash(),JournalEntry.codeandapproved()areFileSetIds. The samelib/has the same 32-byte hash. - Depends on
is_content_id^0.2.0, and re-exports it, soFileSetIdandListedPathcome with the journal.
Fixes from a review of 0.1.0:
- Processes take turns through a lock on a new file,
lock, instead of onentries. Closing any descriptor on a file gives up every lock its process holds on it, so anything in a writing process that readentriesended the lock, and two processes could write at once and break the chain. - A
Journalcannot be sent to another isolate. Sending copied it, and the copy wrote as a second writer that its claim could not see. openresolves a relative directory, so the journal stays where it opened when the working directory moves.closesucceeds when itswriter.<pid>is already gone.approved()reads past bytes that are not UTF-8.- The README's bash check says when there is no journal, or no
xxd, rather than reporting an empty journal.
0.1.0 #
- First release:
Journal, withJournalEntry,EntryHash,CodeHash,JournalCheck(NoJournal,Intact,Broken) andCorruptObject, onis_content_id'sObjectIdand sha256. Everyaddadds an entry of three names, in journal formatis_journal/1, and keeps the bytes whole.openclaims the directory for its process untilclose. Which code the person approved is read fromapprovedbyapproved(), never written into an entry.