MCPcopy Index your code
hub / github.com/ByteStorage/FlyDB / Close

Method Close

engine/db.go:114–133  ·  view source on GitHub ↗

Close the db instance

()

Source from the content-addressed store, hash-verified

112
113// Close the db instance
114func (db *DB) Close() error {
115 zap.L().Info("close db", zap.Any("options", db.options))
116 if db.activeFile == nil {
117 return nil
118 }
119 db.lock.Lock()
120 defer db.lock.Unlock()
121
122 // close active file
123 if err := db.activeFile.Close(); err != nil {
124 return err
125 }
126 // close older files
127 for _, file := range db.olderFiles {
128 if err := file.Close(); err != nil {
129 return err
130 }
131 }
132 return nil
133}
134
135// Sync the db instance
136func (db *DB) Sync() error {

Callers 9

TestDB_WriteBatchRestartFunction · 0.95
CleanMethod · 0.95
TestDB_PutFunction · 0.95
TestDB_ConcurrentPutFunction · 0.95
TestDB_GetFunction · 0.95
TestDB_DeleteFunction · 0.95
TestDB_CloseFunction · 0.95
TestDB_Merge2Function · 0.95
TestDB_Merge3Function · 0.95

Calls 1

CloseMethod · 0.65

Tested by 8

TestDB_WriteBatchRestartFunction · 0.76
TestDB_PutFunction · 0.76
TestDB_ConcurrentPutFunction · 0.76
TestDB_GetFunction · 0.76
TestDB_DeleteFunction · 0.76
TestDB_CloseFunction · 0.76
TestDB_Merge2Function · 0.76
TestDB_Merge3Function · 0.76