discontinuedPackage is_journal has been discontinued and replaced by is_logbook.

Journal class final

Properties

codeHash → FileSetId
The hash of this package's code: computed from its source when the journal opened, or, in a compiled build, the one it was given (builtDefine). Every entry it adds names it.
final
dir → Directory
Holds objects/, entries, approved, lock and, while a journal has it open, writer.<pid>.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(Uint8List bytes) → ObjectId
Adds an entry naming bytes, keeps them, and returns their id. Every call adds an entry, so the same bytes added twice have two entries. The entry goes in before the object: a crash between the two leaves an entry naming an object that never arrived, which check reports, never bytes kept with no entry naming them. Throws ObjectNotKept when the entry went in and the object did not.
addEntry(Uint8List bytes) → EntryHash
Adds as add does, and returns the hash of the entry it wrote, which a later entry's bytes can name.
approved() → Set<FileSetId>
The code hashes the person has approved: the first word of each line of approved, so the line shasum prints (<hash> -) goes in as it is, and the rest of a line is theirs, in whatever bytes. Read each time it is asked: an entry came from code they checked when its JournalEntry.code is here.
check() → JournalCheck
Every entry checked against the one before it, and for whether the object it names is here. Not whether that object still holds its bytes: that reads every byte ever added, and get checks it on each read.
close() → void
Gives up this journal's claim on dir, so another journal in this process can open it. This journal writes nothing after.
get(ObjectId id) → Uint8List?
The bytes named id, or null when they are not here. Throws CorruptObject when they no longer hash to id.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

open(Directory dir) → Journal?
A journal writing into dir, which it claims for this process until close (see the library comment). Throws a StateError when dir is already claimed by this process; any other failure to claim it, such as a folder it cannot write, throws as itself. Null when this package cannot name its own code the way the library comment does: from its source (ownHash), or in a compiled build from builtDefine. Every entry names the code that wrote it, and a journal that cannot name its code writes none. Throws a StateError when builtDefine is not a code hash, or, run from source, is not this code's. A relative dir is resolved when it opens, so the journal stays where it is when the working directory moves.
ownHash() → FileSetId?
The hash of this package's lib/ and is_content_id's, as the library comment computes it. Null when it cannot be computed exactly that way: the source is not on disk, as in a compiled build; a lib/ holds a link, which find and this code would walk differently; or a file's name is one shasum would print differently from how it is written (ListedPath.parse).

Constants

builtDefine → const String
The name of the define that gives a compiled build its code hash, which dart run is_journal:code_hash prints in full.