@@ -941,7 +941,8 @@ func (db *DB) doWrites(lc *z.Closer) {
941941
942942// batchSet applies a list of badger.Entry. If a request level error occurs it
943943// will be returned.
944- // Check(kv.BatchSet(entries))
944+ //
945+ // Check(kv.BatchSet(entries))
945946func (db * DB ) batchSet (entries []* Entry ) error {
946947 req , err := db .sendToWriteCh (entries )
947948 if err != nil {
@@ -954,9 +955,10 @@ func (db *DB) batchSet(entries []*Entry) error {
954955// batchSetAsync is the asynchronous version of batchSet. It accepts a callback
955956// function which is called when all the sets are complete. If a request level
956957// error occurs, it will be passed back via the callback.
957- // err := kv.BatchSetAsync(entries, func(err error)) {
958- // Check(err)
959- // }
958+ //
959+ // err := kv.BatchSetAsync(entries, func(err error)) {
960+ // Check(err)
961+ // }
960962func (db * DB ) batchSetAsync (entries []* Entry , f func (error )) error {
961963 req , err := db .sendToWriteCh (entries )
962964 if err != nil {
@@ -1028,26 +1030,6 @@ func (db *DB) HandoverSkiplist(skl *skl.Skiplist, callback func()) error {
10281030
10291031 mt := & memTable {sl : skl }
10301032
1031- // Iterate over the skiplist and send the entries to the publisher.
1032- it := skl .NewIterator ()
1033-
1034- var entries []* Entry
1035- for it .SeekToFirst (); it .Valid (); it .Next () {
1036- v := it .Value ()
1037- e := & Entry {
1038- Key : it .Key (),
1039- Value : v .Value ,
1040- ExpiresAt : v .ExpiresAt ,
1041- UserMeta : v .UserMeta ,
1042- }
1043- entries = append (entries , e )
1044- }
1045- req := & request {
1046- Entries : entries ,
1047- }
1048- reqs := []* request {req }
1049- db .pub .sendUpdates (reqs )
1050-
10511033 select {
10521034 case db .flushChan <- flushTask {mt : mt , cb : callback }:
10531035 db .imm = append (db .imm , mt )
@@ -1945,16 +1927,16 @@ func (db *DB) DropPrefix(prefixes ...[]byte) error {
19451927}
19461928
19471929// DropPrefix would drop all the keys with the provided prefix. It does this in the following way:
1948- // - Stop accepting new writes.
1949- // - Stop memtable flushes before acquiring lock. Because we're acquring lock here
1950- // and memtable flush stalls for lock, which leads to deadlock
1951- // - Flush out all memtables, skipping over keys with the given prefix, Kp.
1952- // - Write out the value log header to memtables when flushing, so we don't accidentally bring Kp
1953- // back after a restart.
1954- // - Stop compaction.
1955- // - Compact L0->L1, skipping over Kp.
1956- // - Compact rest of the levels, Li->Li, picking tables which have Kp.
1957- // - Resume memtable flushes, compactions and writes.
1930+ // - Stop accepting new writes.
1931+ // - Stop memtable flushes before acquiring lock. Because we're acquring lock here
1932+ // and memtable flush stalls for lock, which leads to deadlock
1933+ // - Flush out all memtables, skipping over keys with the given prefix, Kp.
1934+ // - Write out the value log header to memtables when flushing, so we don't accidentally bring Kp
1935+ // back after a restart.
1936+ // - Stop compaction.
1937+ // - Compact L0->L1, skipping over Kp.
1938+ // - Compact rest of the levels, Li->Li, picking tables which have Kp.
1939+ // - Resume memtable flushes, compactions and writes.
19581940func (db * DB ) DropPrefixBlocking (prefixes ... []byte ) error {
19591941 if len (prefixes ) == 0 {
19601942 return nil
0 commit comments