Put Data batch write
(key []byte, value []byte)
| 35 | |
| 36 | // Put Data batch write |
| 37 | func (wb *WriteBatch) Put(key []byte, value []byte) error { |
| 38 | // Check if the key is empty |
| 39 | if len(key) == 0 { |
| 40 | return _const.ErrKeyIsEmpty |
| 41 | } |
| 42 | wb.lock.Lock() |
| 43 | defer wb.lock.Unlock() |
| 44 | |
| 45 | // Temporarily store the LogRecord |
| 46 | logRecord := &data.LogRecord{ |
| 47 | Key: key, |
| 48 | Value: value, |
| 49 | } |
| 50 | |
| 51 | // Add the LogRecord to the temporaryDataWrites map using the key as a string |
| 52 | wb.temporaryDataWrites[string(key)] = logRecord |
| 53 | return nil |
| 54 | } |
| 55 | |
| 56 | // Delete Batch deletion of data |
| 57 | func (wb *WriteBatch) Delete(key []byte) error { |
no outgoing calls