2019-01-24 16:26:36 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
2018-11-08 14:19:42 +00:00
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2019-01-15 13:03:24 +00:00
|
|
|
package console
|
2018-11-08 14:19:42 +00:00
|
|
|
|
2019-03-06 15:54:48 +00:00
|
|
|
import (
|
|
|
|
"context"
|
2022-05-12 16:12:22 +01:00
|
|
|
|
|
|
|
"storj.io/storj/satellite/console/consoleauth"
|
2019-03-06 15:54:48 +00:00
|
|
|
)
|
2018-12-10 12:29:01 +00:00
|
|
|
|
2019-11-15 14:27:44 +00:00
|
|
|
// DB contains access to different satellite databases.
|
2019-09-10 14:24:16 +01:00
|
|
|
//
|
|
|
|
// architecture: Database
|
2018-11-08 14:19:42 +00:00
|
|
|
type DB interface {
|
2019-11-15 14:27:44 +00:00
|
|
|
// Users is a getter for Users repository.
|
2018-11-08 14:19:42 +00:00
|
|
|
Users() Users
|
2019-11-15 14:27:44 +00:00
|
|
|
// Projects is a getter for Projects repository.
|
2018-11-13 08:27:42 +00:00
|
|
|
Projects() Projects
|
2019-11-15 14:27:44 +00:00
|
|
|
// ProjectMembers is a getter for ProjectMembers repository.
|
2018-11-20 14:50:47 +00:00
|
|
|
ProjectMembers() ProjectMembers
|
2019-11-15 14:27:44 +00:00
|
|
|
// APIKeys is a getter for APIKeys repository.
|
2018-12-26 14:00:53 +00:00
|
|
|
APIKeys() APIKeys
|
2019-11-15 14:27:44 +00:00
|
|
|
// RegistrationTokens is a getter for RegistrationTokens repository.
|
2019-03-19 17:55:43 +00:00
|
|
|
RegistrationTokens() RegistrationTokens
|
2019-11-15 14:27:44 +00:00
|
|
|
// ResetPasswordTokens is a getter for ResetPasswordTokens repository.
|
2019-05-13 16:53:52 +01:00
|
|
|
ResetPasswordTokens() ResetPasswordTokens
|
2022-05-12 16:12:22 +01:00
|
|
|
// WebappSessions is a getter for WebappSessions repository.
|
|
|
|
WebappSessions() consoleauth.WebappSessions
|
2018-11-08 14:19:42 +00:00
|
|
|
|
2019-12-19 10:07:56 +00:00
|
|
|
// WithTx is a method for executing transactions with retrying as necessary.
|
|
|
|
WithTx(ctx context.Context, fn func(ctx context.Context, tx DBTx) error) error
|
2018-12-10 12:29:01 +00:00
|
|
|
}
|
|
|
|
|
2019-11-15 14:27:44 +00:00
|
|
|
// DBTx extends Database with transaction scope.
|
2018-12-10 12:29:01 +00:00
|
|
|
type DBTx interface {
|
|
|
|
DB
|
2019-12-19 10:07:56 +00:00
|
|
|
// Commit is a method for committing and closing transaction.
|
2018-12-10 12:29:01 +00:00
|
|
|
Commit() error
|
2019-12-19 10:07:56 +00:00
|
|
|
// Rollback is a method for rollback and closing transaction.
|
2018-12-10 12:29:01 +00:00
|
|
|
Rollback() error
|
2018-11-08 14:19:42 +00:00
|
|
|
}
|