commit writes the contents of the mutationMap on a batch mutation and commits that batch. It also updates the deletes cache.
(mm *mutationMap)
| 292 | // mutation and commits that batch. It also updates the deletes |
| 293 | // cache. |
| 294 | func (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 | |
| 316 | func (ix *Index) verifySignature(ctx context.Context, fetcher *missTrackFetcher, schemaBlob *schema.Blob) (*jsonsign.VerifyRequest, error) { |
| 317 | tf := &trackErrorsFetcher{f: fetcher} |
no test coverage detected