readBytes method

  1. @override
Future<Uint8List> readBytes(
  1. String locator
)
override

The whole container, for the single-file kind.

A single-file container is stored under TomChangeset.containerPath — the same key TomChangeset.singleFile writes — so the sidecar's read and its commit address one thing, and a bundle locator asked for its bytes fails loudly rather than answering with one arbitrary member file.

Implementation

@override
Future<Uint8List> readBytes(String locator) async {
  _guardRead(locator);
  final bytes = remote.snapshot(locator)[TomChangeset.containerPath];
  if (bytes == null) {
    throw TomStorageException(
      locator,
      'not a single-file container — it holds '
      '${remote.snapshot(locator).length} member files',
    );
  }
  return bytes;
}