status method

Future<KnowledgeIndexStatus> status(
  1. ProjectBundle bundle
)

The saved index of bundle compared with the bundle as it is now: KnowledgeIndexRefreshing while another operation indexes or forgets it. Holds no lock, probing the writer's, and opens no encoder.

Implementation

Future<KnowledgeIndexStatus> status(ProjectBundle bundle) => _admit(() async {
  final index = await _namespace(bundle);
  final files = await _inventory(index.root);
  KnowledgeIndexStatus status;
  try {
    status = _assess(index, files, (await _pin(index))?.saved);
  } on WayfinderException catch (error) {
    if (error.code != 'index-incompatible') rethrow;
    status = KnowledgeIndexIncompatible(error.message);
  }
  if (await WayfinderFileLock.isHeld(index.writer)) {
    return KnowledgeIndexRefreshing(status);
  }
  await _recordUse(index);
  return status;
});