Skip to content

Commit

Permalink
chore: rename to preMigrationDaemons
Browse files Browse the repository at this point in the history
  • Loading branch information
mistahj67 committed Sep 18, 2024
1 parent 54eed40 commit b36844a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions cmd/api/src/bootstrap/initializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ type DatabaseConstructor[DBType database.Database, GraphType graph.Database] fun
type InitializerLogic[DBType database.Database, GraphType graph.Database] func(ctx context.Context, cfg config.Configuration, databaseConnections DatabaseConnections[DBType, GraphType]) ([]daemons.Daemon, error)

type Initializer[DBType database.Database, GraphType graph.Database] struct {
Configuration config.Configuration
PreEntrypoint InitializerLogic[DBType, GraphType]
Entrypoint InitializerLogic[DBType, GraphType]
Configuration config.Configuration
PreMigrationDaemons InitializerLogic[DBType, GraphType]
Entrypoint InitializerLogic[DBType, GraphType]
DBConnector DatabaseConstructor[DBType, GraphType]
}

Expand Down Expand Up @@ -70,8 +70,8 @@ func (s Initializer[DBType, GraphType]) Launch(parentCtx context.Context, handle
defer databaseConnections.Graph.Close(ctx)

// Daemons that start prior to blocking db migration
if s.PreEntrypoint != nil {
if daemonInstances, err := s.PreEntrypoint(ctx, s.Configuration, databaseConnections); err != nil {
if s.PreMigrationDaemons != nil {
if daemonInstances, err := s.PreMigrationDaemons(ctx, s.Configuration, databaseConnections); err != nil {
return fmt.Errorf("failed to start services: %w", err)
} else {
daemonManager.Start(ctx, daemonInstances...)
Expand Down
2 changes: 1 addition & 1 deletion cmd/api/src/cmd/bhapi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func main() {
initializer := bootstrap.Initializer[*database.BloodhoundDB, *graph.DatabaseSwitch]{
Configuration: cfg,
DBConnector: services.ConnectDatabases,
PreEntrypoint: services.PreEntrypoint,
PreMigrationDaemons: services.PreMigrationDaemons,
Entrypoint: services.Entrypoint,
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/api/src/services/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func ConnectDatabases(ctx context.Context, cfg config.Configuration) (bootstrap.
}
}

// PreEntrypoint Word of caution: These daemons will be launched prior to any migration starting
func PreEntrypoint(ctx context.Context, cfg config.Configuration, connections bootstrap.DatabaseConnections[*database.BloodhoundDB, *graph.DatabaseSwitch]) ([]daemons.Daemon, error) {
// PreMigrationDaemons Word of caution: These daemons will be launched prior to any migration starting
func PreMigrationDaemons(ctx context.Context, cfg config.Configuration, connections bootstrap.DatabaseConnections[*database.BloodhoundDB, *graph.DatabaseSwitch]) ([]daemons.Daemon, error) {
return []daemons.Daemon{
toolapi.NewDaemon(ctx, connections, cfg, schema.DefaultGraphSchema()),
}, nil
Expand Down

0 comments on commit b36844a

Please sign in to comment.