MCPcopy
hub / github.com/perkeep/perkeep / commit

Method commit

pkg/index/receive.go:294–314  ·  view source on GitHub ↗

commit writes the contents of the mutationMap on a batch mutation and commits that batch. It also updates the deletes cache.

(mm *mutationMap)

Source from the content-addressed store, hash-verified

292// mutation and commits that batch. It also updates the deletes
293// cache.
294func (ix *Index) commit(mm *mutationMap) error {
295 // We want the update of the deletes cache to be atomic
296 // with the transaction commit, so we lock here instead
297 // of within updateDeletesCache.
298 ix.deletes.Lock()
299 defer ix.deletes.Unlock()
300 bm := ix.s.BeginBatch()
301 for k, v := range mm.kv {
302 bm.Set(k, v)
303 }
304 err := ix.s.CommitBatch(bm)
305 if err != nil {
306 return err
307 }
308 for _, cl := range mm.deletes {
309 if err := ix.updateDeletesCache(cl); err != nil {
310 return fmt.Errorf("Could not update the deletes cache after deletion from %v: %v", cl, err)
311 }
312 }
313 return nil
314}
315
316func (ix *Index) verifySignature(ctx context.Context, fetcher *missTrackFetcher, schemaBlob *schema.Blob) (*jsonsign.VerifyRequest, error) {
317 tf := &trackErrorsFetcher{f: fetcher}

Callers 1

ReceiveBlobMethod · 0.95

Calls 6

updateDeletesCacheMethod · 0.95
LockMethod · 0.80
UnlockMethod · 0.80
BeginBatchMethod · 0.65
SetMethod · 0.65
CommitBatchMethod · 0.65

Tested by

no test coverage detected