Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBG-4268: Remove DBOnlineCallback #7122

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions db/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ type DatabaseContextOptions struct {
UnsupportedOptions *UnsupportedOptions
OIDCOptions *auth.OIDCOptions
LocalJWTConfig auth.LocalJWTConfig
DBOnlineCallback DBOnlineCallback // Callback function to take the DB back online
ImportOptions ImportOptions
EnableXattr bool // Use xattr for _sync
LocalDocExpirySecs uint32 // The _local doc expiry time in seconds
Expand Down Expand Up @@ -354,10 +353,6 @@ func getServerUUID(ctx context.Context, bucket base.Bucket) (string, error) {
return uuid.(string), err
}

// Function type for something that calls NewDatabaseContext and wants a callback when the DB is detected
// to come back online. A rest.ServerContext package cannot be passed since it would introduce a circular dependency
type DBOnlineCallback func(dbContext *DatabaseContext)

// Creates a new DatabaseContext on a bucket. The bucket will be closed when this context closes.
func NewDatabaseContext(ctx context.Context, dbName string, bucket base.Bucket, autoImport bool, options DatabaseContextOptions) (dbc *DatabaseContext, returnedError error) {
cleanupFunctions := make([]func(), 0)
Expand Down
7 changes: 0 additions & 7 deletions rest/server_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -1113,12 +1113,6 @@ func dbcOptionsFromConfig(ctx context.Context, sc *ServerContext, config *DbConf
}
}

// Create a callback function that will be invoked if the database goes offline and comes
// back online again
dbOnlineCallback := func(dbContext *db.DatabaseContext) {
sc.TakeDbOnline(base.NewNonCancelCtx(), dbContext)
}

oldRevExpirySeconds := base.DefaultOldRevExpirySeconds
if config.OldRevExpirySeconds != nil {
oldRevExpirySeconds = *config.OldRevExpirySeconds
Expand Down Expand Up @@ -1299,7 +1293,6 @@ func dbcOptionsFromConfig(ctx context.Context, sc *ServerContext, config *DbConf
UnsupportedOptions: config.Unsupported,
OIDCOptions: config.OIDCConfig,
LocalJWTConfig: config.LocalJWTConfig,
DBOnlineCallback: dbOnlineCallback,
ImportOptions: *importOptions,
EnableXattr: config.UseXattrs(),
SecureCookieOverride: secureCookieOverride,
Expand Down
Loading