HashedFiles class final

Files named by the SHA-256 of their bytes, in one folder: archives, catalog pieces. Every read checks the bytes again, so a damaged or replaced copy is never used — it is deleted, and reads as missing.

Constructors

HashedFiles(String dir, {String ext = 'bin'})
The files in dir, each named <sha256>.<ext>.

Properties

dir → String
The folder.
final
ext → String
Every file's extension.
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

fileFor(String sha256) → File
Where the file whose SHA-256 is sha256 lives.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(String sha256) → Uint8List?
The bytes whose SHA-256 is sha256, checked again; null when missing, damaged (a damaged copy is deleted), or busy in another process.
retainOnly(Set<String> keep) → void
Deletes every file of this kind not named in keep. A file another process holds stays; files of other names are never touched.
toString() → String
A string representation of this object.
inherited
write(String sha256, List<int> bytes) → void
Keeps bytes, whose SHA-256 the caller has checked is sha256.

Operators

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