readBundle method

  1. @override
Future<TomBundleMedium> readBundle(
  1. String locator
)
override

A read-through view of the folder, not a copy of it.

It used to read every file into memory before returning — including .history/, so the cost of opening a bundle grew with the document's entire edit history and a one-word save paid for all of it. Reading on demand makes a save cost the manifest plus the sections it compares.

The LFS refusal moves with the read, which is an improvement rather than a compromise: a pointer is now refused when the file holding it is actually read, instead of failing the whole open because some unrelated snapshot nobody was going to look at is LFS-stored.

Implementation

@override
Future<TomBundleMedium> readBundle(String locator) async {
  final dir = Directory(locator);
  if (!dir.existsSync()) throw TomContainerNotFoundException(locator);
  _recover(dir);
  return TomReadOnlyBundleMedium(_LocalBundleMedium(dir, locator));
}