MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / getRecentlyNonMergeFileId

Method getRecentlyNonMergeFileId

engine/merge.go:246–266  ·  view source on GitHub ↗

Gets the id of the file that did not participate in the merge recently

(dirPath string)

Source from the content-addressed store, hash-verified

244
245// Gets the id of the file that did not participate in the merge recently
246func (db *DB) getRecentlyNonMergeFileId(dirPath string) (uint32, error) {
247 mergeFinaFile, err := data2.OpenMergeFinaFile(dirPath, db.options.DataFileSize, db.options.FIOType)
248 if err != nil {
249 return 0, err
250 }
251
252 // Read the log record at offset 0 from mergeFinaFile
253 record, _, err := mergeFinaFile.ReadLogRecord(0)
254 if err != nil {
255 return 0, err
256 }
257
258 // Convert the value of the log record to an integer
259 nonMergeFileID, err := strconv.Atoi(string(record.Value))
260 if err != nil {
261 return 0, err
262 }
263
264 return uint32(nonMergeFileID), nil
265
266}
267
268// Load the index from the hint file
269func (db *DB) loadIndexFromHintFile() error {

Callers 2

loadMergeFilesMethod · 0.95

Calls 1

ReadLogRecordMethod · 0.80

Tested by

no test coverage detected