remove idea of hosts

Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
This commit is contained in:
aramissennyeydd
2025-11-10 13:32:05 -05:00
parent 77fb3f37de
commit dbf5eae24d
3 changed files with 9 additions and 43 deletions
@@ -70,12 +70,6 @@ describe('SystemMetadataService', () => {
expect(instanceResponse.status).toBe(200);
expect(instanceResponse.body).toMatchObject([
{
hosts: [
{
external: `http://localhost:0`,
internal: `http://localhost:0`,
},
],
pluginId: 'test-plugin',
},
]);
@@ -108,12 +102,6 @@ describe('SystemMetadataService', () => {
expect(initialResponse.status).toBe(200);
expect(initialResponse.body).toMatchObject([
{
hosts: [
{
external: `http://localhost:0`,
internal: `http://localhost:0`,
},
],
pluginId: 'test-plugin',
},
]);
@@ -144,21 +132,9 @@ describe('SystemMetadataService', () => {
expect(responseAfterUpdate.status).toBe(200);
expect(responseAfterUpdate.body).toMatchObject([
{
hosts: [
{
external: 'http://test.internal',
internal: 'http://test.internal',
},
],
pluginId: 'your-new-plugin',
},
{
hosts: [
{
external: `http://localhost:0`,
internal: `http://localhost:0`,
},
],
pluginId: 'test-plugin',
},
]);
@@ -31,7 +31,6 @@ export class DefaultRootSystemMetadataService
{
#hostDiscovery: HostDiscovery;
#instanceMetadata: RootInstanceMetadataService;
#config: RootConfigService;
constructor(options: {
logger: LoggerService;
config: RootConfigService;
@@ -46,7 +45,6 @@ export class DefaultRootSystemMetadataService
});
});
this.#instanceMetadata = options.instanceMetadata;
this.#config = options.config;
}
public static create(pluginEnv: {
@@ -61,22 +59,15 @@ export class DefaultRootSystemMetadataService
RootSystemMetadataServicePluginInfo[]
> {
const resolutions = await this.#hostDiscovery.listResolutions();
const instanceAddress = this.#hostDiscovery.getInstanceAddress(
this.#config,
);
const currentInstance = await this.#instanceMetadata.getInstalledPlugins();
for (const plugin of currentInstance) {
if (!resolutions.has(plugin.pluginId)) {
resolutions.set(plugin.pluginId, []);
}
resolutions.get(plugin.pluginId)?.push(instanceAddress);
const plugins = [];
for (const pluginId of resolutions.keys()) {
plugins.push({ pluginId });
}
return Array.from(resolutions.entries()).map(([pluginId, targets]) => ({
pluginId,
hosts: Array.from(targets).filter(
(target): target is { external: string; internal: string } =>
Object.keys(target).length > 0,
),
}));
for (const plugin of await this.#instanceMetadata.getInstalledPlugins()) {
plugins.push({ pluginId: plugin.pluginId });
}
return plugins;
}
}
@@ -17,7 +17,6 @@
/** @public */
export interface RootSystemMetadataServicePluginInfo {
readonly pluginId: string;
readonly hosts: (string | { external: string; internal: string })[];
}
/** @public */