addDocument method

  1. @override
Future<void> addDocument(
  1. String documentId, {
  2. PeerId? author,
})
override

Register a document

Implementation

@override
Future<void> addDocument(String documentId, {PeerId? author}) async {
  if (await hasDocument(documentId)) {
    return;
  }
  // Opened now rather than on the first read, so a document that was just
  // added is already following its storage when the first change lands —
  // and before the catalog, because a catalog that stores identities would
  // mint one first, and a stored id always beats the `author` handed in.
  await _openDocument(documentId, author: author);
  await _catalog.add(documentId);
}