MCPcopy Index your code
hub / github.com/docker/docker-agent / openAndMigrateSQLiteStore

Function openAndMigrateSQLiteStore

pkg/session/store.go:523–538  ·  view source on GitHub ↗

openAndMigrateSQLiteStore opens the database and runs migrations

(ctx context.Context, path string)

Source from the content-addressed store, hash-verified

521
522// openAndMigrateSQLiteStore opens the database and runs migrations
523func openAndMigrateSQLiteStore(ctx context.Context, path string) (*SQLiteSessionStore, error) {
524 db, err := sqliteutil.OpenDB(ctx, path)
525 if err != nil {
526 return nil, err
527 }
528
529 if err := setupAndMigrate(ctx, db); err != nil {
530 db.Close()
531 if sqliteutil.IsCantOpenError(err) {
532 return nil, sqliteutil.DiagnoseDBOpenError(path, err)
533 }
534 return nil, err
535 }
536
537 return &SQLiteSessionStore{db: db}, nil
538}
539
540// setupAndMigrate creates the bootstrap sessions table (if missing) and runs
541// all pending schema migrations. The bootstrap schema only declares the

Callers 1

NewSQLiteSessionStoreFunction · 0.85

Calls 5

OpenDBFunction · 0.92
IsCantOpenErrorFunction · 0.92
DiagnoseDBOpenErrorFunction · 0.92
setupAndMigrateFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected