Skip to main content

is_journal 0.9.0 copy "is_journal: ^0.9.0" to clipboard
is_journal: ^0.9.0 copied to clipboard

discontinuedreplaced by: is_logbook

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). assigned is now users-assigned-to-journey-path, and ended is now journey-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-root and assigned-again are now users-assigned-body, users-assigned-not-root and users-assigned-again; ended-body is journey-ended-body; and an entry on an ended journey's chain is refused journey-ended <journey>, not closed <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 - and started are refused by Kind.parse, as in 0.8.0.
  • The code hash changes: lib/ changed.

0.8.0 #

  • Chain ownership. An assigned entry starts a journey path's chain, and only the user it names as loopUser may extend that chain. An ended entry closes every chain of its journey. A kind on the sender table's new attaching: 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.
  • assigned and ended are 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 read attaching: 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 now subscribe <kinds> from <entry>, with start for the journal's start in place of -. The old request is refused (refused not-a-request); there is no transition. caught-up says start, 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, as follow sends 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. Or none when the journal holds no such entry, unreadable … missing|corrupt when it does but its bytes are gone or changed, or failed.
  • The service indexes every entry, including one whose object is lost or that has no header, so get never says none for 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 (a SIGKILL, 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.dart and dart 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_PEERCRED on Linux, LOCAL_PEERCRED on macOS) and an entry that does not follow its chain's tip, and adds a started entry holding the sender table on every start. The checks are in lib/, 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, and tip <entry> answers a chain's tip. Every entry comes with the hash ok answered for it.
  • Journal.addEntry adds as add does 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_id the journal runs with, not only this package: the lib/ files of both, each path under its package's name. A new is_content_id changes the hash, whichever version an app resolves, dependency_overrides included.
  • So the dependency is ^0.2.0 again. 0.3.0's exact pin kept any app from combining the journal with a library that needs an is_content_id fix.
  • 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 journal Intact again rather than Broken for good.
  • add throws ObjectNotKept, a FileSystemException carrying 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_hash prints -Dis_journal.code=<hash> from the source about to be compiled, and Journal.open uses it when there is no source to hash. Run from source, open throws a StateError when that define is not this code's hash.
  • Depends on is_content_id 0.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 same is_content_id. A test fails if pubspec.yaml and lib/ 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_id FileSetId, the name of a set of files, which is_content_id 0.2.0 now holds. CodeHash is gone: Journal.codeHash, Journal.ownHash(), JournalEntry.code and approved() are FileSetIds. The same lib/ has the same 32-byte hash.
  • Depends on is_content_id ^0.2.0, and re-exports it, so FileSetId and ListedPath come with the journal.

Fixes from a review of 0.1.0:

  • Processes take turns through a lock on a new file, lock, instead of on entries. Closing any descriptor on a file gives up every lock its process holds on it, so anything in a writing process that read entries ended the lock, and two processes could write at once and break the chain.
  • A Journal cannot be sent to another isolate. Sending copied it, and the copy wrote as a second writer that its claim could not see.
  • open resolves a relative directory, so the journal stays where it opened when the working directory moves.
  • close succeeds when its writer.<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, with JournalEntry, EntryHash, CodeHash, JournalCheck (NoJournal, Intact, Broken) and CorruptObject, on is_content_id's ObjectId and sha256. Every add adds an entry of three names, in journal format is_journal/1, and keeps the bytes whole. open claims the directory for its process until close. Which code the person approved is read from approved by approved(), never written into an entry.
0
likes
150
points
830
downloads

Documentation

API reference

Publisher

verified publisherenspyr.co

Weekly Downloads

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.

License

Apache-2.0 (license)

Dependencies

is_content_id

More

Packages that depend on is_journal