本文整理匯總了Golang中camlistore/org/pkg/sorted.BatchMutation.Delete方法的典型用法代碼示例。如果您正苦於以下問題:Golang BatchMutation.Delete方法的具體用法?Golang BatchMutation.Delete怎麽用?Golang BatchMutation.Delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類camlistore/org/pkg/sorted.BatchMutation
的用法示例。
在下文中一共展示了BatchMutation.Delete方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: CommitBatch
func (kv *KeyValue) CommitBatch(bm sorted.BatchMutation) error {
kv.mu.RLock()
defer kv.mu.RUnlock()
b, ok := bm.(*batch)
if !ok {
return fmt.Errorf("unexpected BatchMutation type %T", bm)
}
var (
// A batch mutation for applying this mutation to the buffer.
bmbuf = kv.buf.BeginBatch()
// A lazily created batch mutation for deleting from the backing
// storage; this should be rare. (See Delete above.)
bmback sorted.BatchMutation
)
for _, m := range b.mods {
if m.isDelete {
bmbuf.Delete(m.key)
if bmback == nil {
bmback = kv.back.BeginBatch()
}
bmback.Delete(m.key)
continue
} else {
if err := sorted.CheckSizes(m.key, m.value); err != nil {
log.Printf("Skipping storing (%q:%q): %v", m.key, m.value, err)
continue
}
}
bmbuf.Set(m.key, m.value)
}
if err := kv.buf.CommitBatch(bmbuf); err != nil {
return err
}
if bmback != nil {
return kv.back.CommitBatch(bmback)
}
return nil
}