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))
| 903 | // Check(err) |
| 904 | // } |
| 905 | func (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 | |
| 918 | var errNoRoom = errors.New("No room for write") |
| 919 |
no test coverage detected