UNPKG

@hashgraph/solo

Version:

An opinionated CLI tool to deploy and manage private Hedera Networks.

92 lines (91 loc) 5.5 kB
import { type ObjectMapper } from '../../../../data/mapper/api/object-mapper.js'; import { type ConfigMap } from '../../../../integration/kube/resources/config-map/config-map.js'; import { LedgerPhase } from '../../../../data/schema/model/remote/ledger-phase.js'; import { ComponentsDataWrapperApi } from '../../../../core/config/remote/api/components-data-wrapper-api.js'; import { type K8Factory } from '../../../../integration/kube/k8-factory.js'; import { type SoloLogger } from '../../../../core/logging/solo-logger.js'; import { type ConfigManager } from '../../../../core/config-manager.js'; import { type ClusterReferenceName, type ClusterReferences, type Context, type DeploymentName, Optional } from '../../../../types/index.js'; import { type AnyObject, type ArgvStruct, type NodeAlias, type NodeAliases } from '../../../../types/aliases.js'; import { NamespaceName } from '../../../../types/namespace/namespace-name.js'; import { ConsensusNode } from '../../../../core/model/consensus-node.js'; import { RemoteConfigRuntimeStateApi } from '../../api/remote-config-runtime-state-api.js'; import { type RemoteConfigValidatorApi } from '../../../../core/config/remote/api/remote-config-validator-api.js'; import { ComponentFactoryApi } from '../../../../core/config/remote/api/component-factory-api.js'; import { ComponentTypes } from '../../../../core/config/remote/enumerations/component-types.js'; import { LocalConfigRuntimeState } from '../local/local-config-runtime-state.js'; import { RemoteConfig } from './remote-config.js'; import { SemanticVersion } from '../../../utils/semantic-version.js'; export declare class RemoteConfigRuntimeState implements RemoteConfigRuntimeStateApi { private readonly k8Factory?; private readonly logger?; private readonly localConfig?; private readonly configManager?; private readonly remoteConfigValidator?; private readonly objectMapper?; private static readonly SOLO_REMOTE_CONFIGMAP_DATA_KEY; private phase; clusterReferences: Map<Context, ClusterReferenceName>; private namespace; private source?; private backend?; private _remoteConfig?; constructor(k8Factory?: K8Factory, logger?: SoloLogger, localConfig?: LocalConfigRuntimeState, configManager?: ConfigManager, remoteConfigValidator?: RemoteConfigValidatorApi, objectMapper?: ObjectMapper); get configuration(): RemoteConfig; get components(): Readonly<ComponentsDataWrapperApi>; get currentCluster(): ClusterReferenceName; load(namespace?: NamespaceName, context?: Context): Promise<void>; private populateFromConfigMap; private updateConfigMap; isLoaded(): boolean; private failIfNotLoaded; persist(): Promise<void>; create(argv: ArgvStruct, ledgerPhase: LedgerPhase, nodeAliases: NodeAliases, namespace: NamespaceName, deploymentName: DeploymentName, clusterReference: ClusterReferenceName, context: Context, dnsBaseDomain: string, dnsConsensusNodePattern: string): Promise<void>; createFromExisting(namespace: NamespaceName, clusterReference: ClusterReferenceName, deploymentName: DeploymentName, componentFactory: ComponentFactoryApi, dnsBaseDomain: string, dnsConsensusNodePattern: string, existingClusterContext: Context, argv: ArgvStruct, nodeAliases: NodeAliases): Promise<void>; addCommandToHistory(command: string): void; createConfigMap(namespace: NamespaceName, context: Context): Promise<ConfigMap>; private getConfigMap; populateFromExisting(namespace: NamespaceName, context: Context): Promise<void>; remoteConfigExists(namespace: NamespaceName, context: Context): Promise<boolean>; populateClusterReferences(deploymentName: DeploymentName): Context; /** * Performs the loading of the remote configuration. * Checks if the configuration is already loaded, otherwise loads and adds the command to history. * * @param argv - arguments containing command input for historical reference. * @param validate - whether to validate the remote configuration. * @param [skipConsensusNodesValidation] - whether or not to validate the consensusNodes */ loadAndValidate(argv: { _: string[]; } & AnyObject, validate?: boolean, skipConsensusNodesValidation?: boolean): Promise<void>; private initializeComponentVersions; deleteComponents(): Promise<void>; private setDefaultNamespaceAndDeploymentIfNotSet; private setDefaultContextIfNotSet; /** * Get the consensus nodes from the remoteConfig and use the localConfig to get the context * @returns an array of ConsensusNode objects */ getConsensusNodes(): ConsensusNode[]; /** * Gets a list of distinct contexts from the consensus nodes. * @returns an array of context strings. */ getContexts(): Context[]; /** * Gets a list of distinct cluster references from the consensus nodes. * @returns an object of cluster references. */ getClusterRefs(): ClusterReferences; private getContextForFirstCluster; getNamespace(): NamespaceName; extractContextFromConsensusNodes(nodeAlias: NodeAlias): Optional<string>; updateComponentVersion(type: ComponentTypes, version: SemanticVersion<string>): void; /** * Method used to map the component type to the specific version field * and pass it to a callback to apply modifications */ private applyCallbackToVersionField; getComponentVersion(type: ComponentTypes): SemanticVersion<string>; }