@metreeca/wire
    Preparing search index...

    Function createBufferingRepository

    • Wraps a Repository to coalesce a transaction's updates into as few requests as possible.

      Returns a repository that delegates every operation to repository unchanged outside a transaction. Within execute, queries still run directly against the transaction scope, but updates and graph store writes are buffered rather than issued. On successful completion, the buffered writes are flushed in issue order: consecutive updates targeting equal datasets are joined with ; into a single update, while each merge and store is flushed as a separate request, so graph store writes are never folded into a SPARQL update.

      A task that issues no writes runs none, and a task that throws or rejects discards the buffer, so no partial write reaches the backend. A flush failing part-way leaves the earlier writes applied, unless the wrapped repository rolls back the enclosing transaction, as a repository with native transactions does.

      Parameters

      Returns Repository

      An immutable Repository that buffers a transaction's updates and flushes them coalesced on commit