ChunkMetadata class

Describes one data chunk stored as part of a RAID stripe.

Metadata is serialised to JSON and saved in a companion .meta file next to every .chunk file.

Constructors

ChunkMetadata({required String filename, required int chunkIndex, required int totalChunks, required int diskIndex, required int originalSize, required String checksum, int? totalFileSize, String? parityChecksum, bool isParityChunk = false, bool compressed = false, bool encrypted = false, String raidType = 'raid5', DateTime? createdAt})
Creates a ChunkMetadata.
ChunkMetadata.fromJson(Map<String, dynamic> map)
Deserialises from a JSON-compatible Map.
factory
ChunkMetadata.fromJsonString(String source)
Deserialises from a JSON String.
factory

Properties

checksum → String
SHA-256 hex digest of the raw (post-compress/encrypt) chunk bytes.
final
chunkIndex → int
Zero-based index of this chunk within the stripe.
final
compressed → bool
Whether the payload was DEFLATE-compressed before writing.
final
createdAt → DateTime
When this chunk was first written.
final
diskIndex → int
The physical disk index this chunk was written to.
final
encrypted → bool
Whether the payload was AES-256 encrypted before writing.
final
filename → String
The logical filename this chunk belongs to.
final
hashCode → int
The hash code for this object.
no setterinherited
isParityChunk → bool
True when this metadata describes a parity chunk, not a data chunk.
final
originalSize → int
Byte size of the original (un-padded) chunk data.
final
parityChecksum → String?
SHA-256 hex digest of the parity block for this stripe row (nullable).
final
raidType → String
RAID type string (e.g. 'raid0', 'raid1', 'raid5').
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
totalChunks → int
Total number of data chunks in the stripe (excludes parity).
final
totalFileSize → int?
Total byte size of the whole logical file (all chunks combined, un-padded).
final

Methods

copyWith({String? filename, int? chunkIndex, int? totalChunks, int? diskIndex, int? originalSize, int? totalFileSize, String? checksum, String? parityChecksum, bool? isParityChunk, bool? compressed, bool? encrypted, String? raidType, DateTime? createdAt}) → ChunkMetadata
Returns a copy with optional overrides.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Serialises to a JSON-compatible Map.
toJsonBytes() → Uint8List
Encodes to UTF-8 JSON bytes ready to be written to disk.
toJsonString() → String
Encodes to a JSON String.
toString() → String
A string representation of this object.
override

Operators

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