-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
move over most trivial services to backend-defaults #24724
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,9 +20,9 @@ import { | |
coreServices, | ||
ServiceRef, | ||
ServiceFactory, | ||
LifecycleService, | ||
RootLifecycleService, | ||
} from '@backstage/backend-plugin-api'; | ||
import { BackendLifecycleImpl } from '../services/implementations/rootLifecycle/rootLifecycleServiceFactory'; | ||
camilaibs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import { BackendPluginLifecycleImpl } from '../services/implementations/lifecycle/lifecycleServiceFactory'; | ||
import { ServiceOrExtensionPoint } from './types'; | ||
// Direct internal import to avoid duplication | ||
// eslint-disable-next-line @backstage/no-forbidden-package-imports | ||
|
@@ -345,27 +345,42 @@ export class BackendInitializer { | |
} | ||
|
||
// Bit of a hacky way to grab the lifecycle services, potentially find a nicer way to do this | ||
async #getRootLifecycleImpl(): Promise<BackendLifecycleImpl> { | ||
async #getRootLifecycleImpl(): Promise< | ||
RootLifecycleService & { | ||
startup(): Promise<void>; | ||
shutdown(): Promise<void>; | ||
} | ||
> { | ||
const lifecycleService = await this.#serviceRegistry.get( | ||
coreServices.rootLifecycle, | ||
'root', | ||
); | ||
if (lifecycleService instanceof BackendLifecycleImpl) { | ||
return lifecycleService; | ||
|
||
const service = lifecycleService as any; | ||
if ( | ||
service && | ||
typeof service.startup === 'function' && | ||
typeof service.shutdown === 'function' | ||
) { | ||
return service; | ||
} | ||
|
||
throw new Error('Unexpected root lifecycle service implementation'); | ||
} | ||
|
||
async #getPluginLifecycleImpl( | ||
pluginId: string, | ||
): Promise<BackendPluginLifecycleImpl> { | ||
): Promise<LifecycleService & { startup(): Promise<void> }> { | ||
const lifecycleService = await this.#serviceRegistry.get( | ||
coreServices.lifecycle, | ||
pluginId, | ||
); | ||
if (lifecycleService instanceof BackendPluginLifecycleImpl) { | ||
return lifecycleService; | ||
|
||
const service = lifecycleService as any; | ||
if (service && typeof service.startup === 'function') { | ||
return service; | ||
} | ||
Comment on lines
+379
to
382
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
throw new Error('Unexpected plugin lifecycle service implementation'); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## API Report File for "@backstage/backend-defaults" | ||
|
||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). | ||
|
||
```ts | ||
import { CacheClient } from '@backstage/backend-common'; | ||
import { ServiceFactory } from '@backstage/backend-plugin-api'; | ||
|
||
// @public (undocumented) | ||
export const cacheServiceFactory: () => ServiceFactory<CacheClient, 'plugin'>; | ||
|
||
// (No @packageDocumentation comment for this package) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## API Report File for "@backstage/backend-defaults" | ||
|
||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). | ||
|
||
```ts | ||
import { PluginDatabaseManager } from '@backstage/backend-common'; | ||
import { ServiceFactory } from '@backstage/backend-plugin-api'; | ||
|
||
// @public (undocumented) | ||
export const databaseServiceFactory: () => ServiceFactory< | ||
PluginDatabaseManager, | ||
'plugin' | ||
>; | ||
|
||
// (No @packageDocumentation comment for this package) | ||
``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move the deprecated files to a
deprecated
folder? Just for making it easy to cleanup later?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah that could really help!