Description
** DRAFT **
Description
Currently we have a lot of logic spread out throughout the codebase, a lot of places utilize different methods to get the same data and it has become hard for getting the data since it's spread and comes from different places. For this reason we need to make a new class DataManager
which would serve as a single source of truth.
Class Interface
export abstract class IDataManager {
public namespace: NamespaceName;
public deployment: DeploymentName;
public contextNames: ContextName[];
public clusterRefs: ClusterRef[];
public contextClusterMapping: Record<ContextName, ClusterRef>;
public clusterContextMapping: Record<ClusterRef, ContextName>;
public abstract nodes: ConsensusNode[];
public abstract existingNodes: ConsensusNode[];
public abstract nodeAliases: NodeAlias[];
public abstract existingNodeAliases: NodeAlias[];
public abstract leases: Lease[];
public abstract config: AnyObject;
/** To make it extensible and for type-safety, this method would be used when config data is needed */
public abstract getConfig<T>(): T;
public abstract readonly argv: AnyObject;
/** Flags that come from default values instead of passed via cli */
public abstract defaultFlags: CommandFlag[];
}