Skip to content

Commit

Permalink
feat(core-api): plugin async initializer method
Browse files Browse the repository at this point in the history
Signed-off-by: TonyRowntree <33454202+TonyRowntree@users.noreply.github.com>
  • Loading branch information
TonyRowntree authored and petermetz committed Jun 26, 2021
1 parent 63f5ff6 commit 9678c2e
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export interface ICactusPlugin {
* Hyperledger Besu deployment)
*/
getPackageName(): string;

onPluginInit(): Promise<unknown>;
}

export function isICactusPlugin(x: unknown): x is ICactusPlugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ export class PluginConsortiumManual
return this.instanceId;
}

public async onPluginInit(): Promise<unknown> {
return;
}

public getPrometheusExporter(): PrometheusExporter {
return this.prometheusExporter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export class PluginHtlcEthBesuErc20
return;
}

public async onPluginInit(): Promise<unknown> {
return;
}

public getInstanceId(): string {
return this.instanceId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ export class PluginHtlcEthBesu implements ICactusPlugin, IPluginWebService {
return "@hyperledger/cactus-plugin-htlc-eth-besu";
}

public async onPluginInit(): Promise<unknown> {
return;
}

async registerWebServices(app: Express): Promise<IWebServiceEndpoint[]> {
const webServices = await this.getOrCreateWebServices();
webServices.forEach((ws) => ws.registerExpress(app));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ export class PluginKeychainMemory {
return `@hyperledger/cactus-plugin-keychain-memory`;
}

public async onPluginInit(): Promise<unknown> {
return;
}

async get<T>(key: string): Promise<T> {
return this.backend.get(key) as T;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ export class PluginKeychainVault implements ICactusPlugin, IPluginWebService {
return `@hyperledger/cactus-plugin-keychain-vault`;
}

public async onPluginInit(): Promise<unknown> {
return;
}

async rotateEncryptionKeys(): Promise<void> {
throw new Error("Method not implemented.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ export class PluginLedgerConnectorBesu
return this.instanceId;
}

public async onPluginInit(): Promise<unknown> {
return;
}

public getHttpServer(): Optional<Server | SecureServer> {
return Optional.ofNullable(this.httpServer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ export class PluginLedgerConnectorCorda
return "@hyperledger/cactus-plugin-ledger-connector-corda";
}

public async onPluginInit(): Promise<unknown> {
return;
}

public deployContract(): Promise<any> {
throw new Error("Method not implemented.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export class PluginLedgerConnectorFabric
return Optional.empty();
}

public async onPluginInit(): Promise<unknown> {
return;
}

public async getConsensusAlgorithmFamily(): Promise<
ConsensusAlgorithmFamily
> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ export class PluginLedgerConnectorQuorum
}
}

public async onPluginInit(): Promise<unknown> {
return;
}

async registerWebServices(app: Express): Promise<IWebServiceEndpoint[]> {
const webServices = await this.getOrCreateWebServices();
await Promise.all(webServices.map((ws) => ws.registerExpress(app)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ export class PluginLedgerConnectorXdai
return this.instanceId;
}

public async onPluginInit(): Promise<unknown> {
return;
}

public getHttpServer(): Optional<Server | SecureServer> {
return Optional.ofNullable(this.httpServer);
}
Expand Down

0 comments on commit 9678c2e

Please sign in to comment.