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

Method remove

internal/caches/list_file_sqlite.go:441–470  ·  view source on GitHub ↗
(hash string, isDeleted bool)

Source from the content-addressed store, hash-verified

439}
440
441func (this *SQLiteFileList) remove(hash string, isDeleted bool) (notFound bool, err error) {
442 var db = this.GetDB(hash)
443
444 if !db.IsReady() {
445 return false, nil
446 }
447
448 // HashMap中不存在,则确定不存在
449 if !db.hashMap.Exist(hash) {
450 return true, nil
451 }
452 defer db.hashMap.Delete(hash)
453
454 // 从缓存中删除
455 this.memoryCache.Delete(hash)
456
457 if !isDeleted {
458 err = db.DeleteSync(hash)
459 if err != nil {
460 return false, db.WrapError(err)
461 }
462 }
463
464 if this.onRemove != nil {
465 // when remove file item, no any extra information needed
466 this.onRemove(nil)
467 }
468
469 return false, nil
470}
471
472// 升级老版本数据库
473func (this *SQLiteFileList) upgradeOldDB() {

Callers 3

RemoveMethod · 0.95
PurgeMethod · 0.95
PurgeLFUMethod · 0.95

Calls 6

GetDBMethod · 0.95
DeleteSyncMethod · 0.80
WrapErrorMethod · 0.80
IsReadyMethod · 0.65
ExistMethod · 0.65
DeleteMethod · 0.65

Tested by

no test coverage detected