Set the current active file Hold a mutex before accessing this method
()
| 231 | // Set the current active file |
| 232 | // Hold a mutex before accessing this method |
| 233 | func (db *DB) setActiveDataFile() error { |
| 234 | var initialFileID uint32 = 0 |
| 235 | if db.activeFile != nil { |
| 236 | initialFileID = db.activeFile.FileID + 1 |
| 237 | } |
| 238 | |
| 239 | // Open a new data file |
| 240 | dataFile, err := data2.OpenDataFile(db.options.DirPath, initialFileID, |
| 241 | db.options.DataFileSize, db.options.FIOType) |
| 242 | if err != nil { |
| 243 | return err |
| 244 | } |
| 245 | db.activeFile = dataFile |
| 246 | return nil |
| 247 | } |
| 248 | |
| 249 | // Get Read data according to the key |
| 250 | func (db *DB) Get(key []byte) ([]byte, error) { |
no outgoing calls
no test coverage detected