// populateDeleteClaim adds to mm the entries resulting from the delete claim cl. // It is assumed cl is a valid claim, and vr has already been verified. func (ix *Index) populateDeleteClaim(cl schema.Claim, vr *jsonsign.VerifyRequest, mm *mutationMap) { br := cl.Blob().BlobRef() target := cl.Target() if !target.Valid() { log.Print(fmt.Errorf("no valid target for delete claim %v", br)) return } meta, err := ix.GetBlobMeta(target) if err != nil { if err == os.ErrNotExist { // TODO: return a dependency error type, to schedule re-indexing in the future } log.Print(fmt.Errorf("Could not get mime type of target blob %v: %v", target, err)) return } // TODO(mpl): create consts somewhere for "claim" and "permanode" as camliTypes, and use them, // instead of hardcoding. Unless they already exist ? (didn't find them). if meta.CamliType != "permanode" && meta.CamliType != "claim" { log.Print(fmt.Errorf("delete claim target in %v is neither a permanode nor a claim: %v", br, meta.CamliType)) return } mm.Set(keyDeleted.Key(target, cl.ClaimDateString(), br), "") if meta.CamliType == "claim" { return } recentKey := keyRecentPermanode.Key(vr.SignerKeyId, cl.ClaimDateString(), br) mm.Set(recentKey, target.String()) attr, value := cl.Attribute(), cl.Value() claimKey := keyPermanodeClaim.Key(target, vr.SignerKeyId, cl.ClaimDateString(), br) mm.Set(claimKey, keyPermanodeClaim.Val(cl.ClaimType(), attr, value, vr.CamliSigner)) }