From 6714971845c9f331abc6e32266a8fb7240bcba47 Mon Sep 17 00:00:00 2001 From: Kiss Miklos Date: Thu, 7 Jul 2022 12:03:37 +0200 Subject: [PATCH] remove refreshing by keys from refresh service Signed-off-by: Kiss Miklos --- .../src/service/AuthorizedRefreshService.test.ts | 1 - .../src/service/AuthorizedRefreshService.ts | 9 +-------- .../src/service/DefaultRefreshService.ts | 11 +---------- .../catalog-backend/src/service/createRouter.test.ts | 4 ++-- plugins/catalog-backend/src/service/types.ts | 4 ---- 5 files changed, 4 insertions(+), 25 deletions(-) diff --git a/plugins/catalog-backend/src/service/AuthorizedRefreshService.test.ts b/plugins/catalog-backend/src/service/AuthorizedRefreshService.test.ts index f22b5b86f4..5d0a192470 100644 --- a/plugins/catalog-backend/src/service/AuthorizedRefreshService.test.ts +++ b/plugins/catalog-backend/src/service/AuthorizedRefreshService.test.ts @@ -22,7 +22,6 @@ import { AuthorizedRefreshService } from './AuthorizedRefreshService'; describe('AuthorizedRefreshService', () => { const refreshService = { refresh: jest.fn(), - refreshByRefreshKeys: jest.fn(), }; const permissionApi = { authorize: jest.fn(), diff --git a/plugins/catalog-backend/src/service/AuthorizedRefreshService.ts b/plugins/catalog-backend/src/service/AuthorizedRefreshService.ts index 19f6270da6..8634fbf86d 100644 --- a/plugins/catalog-backend/src/service/AuthorizedRefreshService.ts +++ b/plugins/catalog-backend/src/service/AuthorizedRefreshService.ts @@ -20,11 +20,7 @@ import { AuthorizeResult, PermissionEvaluator, } from '@backstage/plugin-permission-common'; -import { - RefreshByRefreshKeysOptions, - RefreshOptions, - RefreshService, -} from './types'; +import { RefreshOptions, RefreshService } from './types'; export class AuthorizedRefreshService implements RefreshService { constructor( @@ -49,7 +45,4 @@ export class AuthorizedRefreshService implements RefreshService { } await this.service.refresh(options); } - async refreshByRefreshKeys(options: RefreshByRefreshKeysOptions) { - await this.service.refreshByRefreshKeys(options); - } } diff --git a/plugins/catalog-backend/src/service/DefaultRefreshService.ts b/plugins/catalog-backend/src/service/DefaultRefreshService.ts index deb69bd041..3b982a0e46 100644 --- a/plugins/catalog-backend/src/service/DefaultRefreshService.ts +++ b/plugins/catalog-backend/src/service/DefaultRefreshService.ts @@ -15,11 +15,7 @@ */ import { DefaultProcessingDatabase } from '../database/DefaultProcessingDatabase'; -import { - RefreshByRefreshKeysOptions, - RefreshOptions, - RefreshService, -} from './types'; +import { RefreshOptions, RefreshService } from './types'; export class DefaultRefreshService implements RefreshService { private database: DefaultProcessingDatabase; @@ -49,9 +45,4 @@ export class DefaultRefreshService implements RefreshService { }); }); } - async refreshByRefreshKeys(options: RefreshByRefreshKeysOptions) { - await this.database.transaction(async tx => { - await this.database.refreshByRefreshKeys(tx, options); - }); - } } diff --git a/plugins/catalog-backend/src/service/createRouter.test.ts b/plugins/catalog-backend/src/service/createRouter.test.ts index b7eeb6f1bc..16a36eb8c4 100644 --- a/plugins/catalog-backend/src/service/createRouter.test.ts +++ b/plugins/catalog-backend/src/service/createRouter.test.ts @@ -57,7 +57,7 @@ describe('createRouter readonly disabled', () => { listLocations: jest.fn(), deleteLocation: jest.fn(), }; - refreshService = { refresh: jest.fn(), refreshByRefreshKeys: jest.fn() }; + refreshService = { refresh: jest.fn() }; orchestrator = { process: jest.fn() }; const router = await createRouter({ entitiesCatalog, @@ -712,7 +712,7 @@ describe('NextRouter permissioning', () => { listLocations: jest.fn(), deleteLocation: jest.fn(), }; - refreshService = { refresh: jest.fn(), refreshByRefreshKeys: jest.fn() }; + refreshService = { refresh: jest.fn() }; const router = await createRouter({ entitiesCatalog, locationService, diff --git a/plugins/catalog-backend/src/service/types.ts b/plugins/catalog-backend/src/service/types.ts index a073e5bb6c..f6cfa2e783 100644 --- a/plugins/catalog-backend/src/service/types.ts +++ b/plugins/catalog-backend/src/service/types.ts @@ -61,9 +61,6 @@ export type RefreshOptions = { authorizationToken?: string; }; -export type RefreshByRefreshKeysOptions = { - keys: string[]; -}; /** * A service that manages refreshes of entities in the catalog. * @@ -74,7 +71,6 @@ export interface RefreshService { * Request a refresh of entities in the catalog. */ refresh(options: RefreshOptions): Promise; - refreshByRefreshKeys(options: RefreshByRefreshKeysOptions): Promise; } /**