MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / loadHashMap

Method loadHashMap

internal/caches/list_file_db_sqlite.go:603–627  ·  view source on GitHub ↗

加载Hash列表

()

Source from the content-addressed store, hash-verified

601
602// 加载Hash列表
603func (this *SQLiteFileListDB) loadHashMap() {
604 this.hashMapIsLoaded = false
605
606 err := this.hashMap.Load(this)
607 if err != nil {
608 remotelogs.Error("LIST_FILE_DB", "load hash map failed: "+err.Error()+"(file: "+this.dbPath+")")
609
610 // 自动修复错误
611 // TODO 将来希望能尽可能恢复以往数据库中的内容
612 if strings.Contains(err.Error(), "database is closed") || strings.Contains(err.Error(), "database disk image is malformed") {
613 _ = this.Close()
614 this.deleteDB()
615 remotelogs.Println("LIST_FILE_DB", "recreating the database (file:"+this.dbPath+") ...")
616 err = this.Open(this.dbPath)
617 if err != nil {
618 remotelogs.Error("LIST_FILE_DB", "recreate the database failed: "+err.Error()+" (file:"+this.dbPath+")")
619 } else {
620 _ = this.Init()
621 }
622 }
623 return
624 }
625
626 this.hashMapIsLoaded = true
627}

Callers 1

InitMethod · 0.95

Calls 9

CloseMethod · 0.95
deleteDBMethod · 0.95
OpenMethod · 0.95
InitMethod · 0.95
ErrorFunction · 0.92
PrintlnFunction · 0.92
LoadMethod · 0.45
ErrorMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected