(ctx context.Context, conn blob.ConnectionInfo, password string, connectOpts *repo.ConnectOptions, opts *Options)
| 345 | } |
| 346 | |
| 347 | func connectAndOpen(ctx context.Context, conn blob.ConnectionInfo, password string, connectOpts *repo.ConnectOptions, opts *Options) (repo.Repository, error) { |
| 348 | st, err := blob.NewStorage(ctx, conn, false) |
| 349 | if err != nil { |
| 350 | return nil, errors.Wrap(err, "can't open storage") |
| 351 | } |
| 352 | defer st.Close(ctx) //nolint:errcheck |
| 353 | |
| 354 | if err = passwordpersist.OnSuccess( |
| 355 | ctx, repo.Connect(ctx, opts.ConfigFile, st, password, connectOpts), |
| 356 | opts.PasswordPersist, opts.ConfigFile, password); err != nil { |
| 357 | return nil, errors.Wrap(err, "error connecting") |
| 358 | } |
| 359 | |
| 360 | //nolint:wrapcheck |
| 361 | return repo.Open(ctx, opts.ConfigFile, password, nil) |
| 362 | } |
| 363 | |
| 364 | func handleRepoDisconnect(ctx context.Context, rc requestContext) (any, *apiError) { |
| 365 | if err := rc.srv.disconnect(ctx); err != nil { |
no test coverage detected