MCPcopy
hub / github.com/dgraph-io/badger / batchSetAsync

Method batchSetAsync

db.go:905–916  ·  view source on GitHub ↗

batchSetAsync is the asynchronous version of batchSet. It accepts a callback function which is called when all the sets are complete. If a request level error occurs, it will be passed back via the callback. err := kv.BatchSetAsync(entries, func(err error)) { Check(err) }

(entries []*Entry, f func(error))

Source from the content-addressed store, hash-verified

903// Check(err)
904// }
905func (db *DB) batchSetAsync(entries []*Entry, f func(error)) error {
906 req, err := db.sendToWriteCh(entries)
907 if err != nil {
908 return err
909 }
910 go func() {
911 err := req.Wait()
912 // Write is complete. Let's call the callback function now.
913 f(err)
914 }()
915 return nil
916}
917
918var errNoRoom = errors.New("No room for write")
919

Callers 2

sendMethod · 0.80
compactMethod · 0.80

Calls 2

sendToWriteChMethod · 0.95
WaitMethod · 0.45

Tested by

no test coverage detected