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

Method Close

internal/caches/list_file_db_sqlite.go:423–479  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

421}
422
423func (this *SQLiteFileListDB) Close() error {
424 if this.isClosed {
425 return nil
426 }
427
428 this.isClosed = true
429 this.isReady = false
430
431 if this.existsByHashStmt != nil {
432 _ = this.existsByHashStmt.Close()
433 }
434 if this.insertStmt != nil {
435 _ = this.insertStmt.Close()
436 }
437 if this.selectByHashStmt != nil {
438 _ = this.selectByHashStmt.Close()
439 }
440 if this.selectHashListStmt != nil {
441 _ = this.selectHashListStmt.Close()
442 }
443 if this.deleteByHashStmt != nil {
444 _ = this.deleteByHashStmt.Close()
445 }
446 if this.statStmt != nil {
447 _ = this.statStmt.Close()
448 }
449 if this.purgeStmt != nil {
450 _ = this.purgeStmt.Close()
451 }
452 if this.deleteAllStmt != nil {
453 _ = this.deleteAllStmt.Close()
454 }
455 if this.listOlderItemsStmt != nil {
456 _ = this.listOlderItemsStmt.Close()
457 }
458
459 var errStrings []string
460
461 if this.readDB != nil {
462 err := this.readDB.Close()
463 if err != nil {
464 errStrings = append(errStrings, err.Error())
465 }
466 }
467
468 if this.writeDB != nil {
469 err := this.writeDB.Close()
470 if err != nil {
471 errStrings = append(errStrings, err.Error())
472 }
473 }
474
475 if len(errStrings) == 0 {
476 return nil
477 }
478 return errors.New("close database failed: " + strings.Join(errStrings, ", "))
479}
480

Callers 1

loadHashMapMethod · 0.95

Calls 2

CloseMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected