getLatestCommitID() retrieves the latest CommitID from the database
(db *pebble.DB, log lib.LoggerI)
| 446 | |
| 447 | // getLatestCommitID() retrieves the latest CommitID from the database |
| 448 | func getLatestCommitID(db *pebble.DB, log lib.LoggerI) (id *lib.CommitID) { |
| 449 | reader := db.NewSnapshot() |
| 450 | defer reader.Close() |
| 451 | vs := NewVersionedStore(reader, nil, lssVersion) |
| 452 | tx := NewTxn(vs, nil, nil, false, false, true, 0) |
| 453 | bz, err := tx.Get(lastCommitIDPrefix) |
| 454 | if err != nil { |
| 455 | log.Fatalf("getLatestCommitID() failed with err: %s", err.Error()) |
| 456 | } |
| 457 | id = new(lib.CommitID) |
| 458 | if err = lib.Unmarshal(bz, id); err != nil { |
| 459 | log.Fatalf("unmarshalCommitID() failed with err: %s", err.Error()) |
| 460 | } |
| 461 | return |
| 462 | } |
| 463 | |
| 464 | // MaybeCompact() checks if it is time to compact the LSS and HSS respectively |
| 465 | func (s *Store) MaybeCompact() { |
no test coverage detected