Skip to content

implement 'DataManager' and use it throughout the codebase #1463

Open
2 of 3 issues completed
Open
Feature
2 of 3 issues completed
@instamenta

Description

@instamenta

** 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[];  
}

Sub-issues

Metadata

Metadata

Assignees

Labels

Needs RefinementThe issue needs more refinement and/or design before it can be workedNew FeatureA new feature, service, or documentation. Major changes that are not backwards compatible.Pending TriageNew issue that needs to be triaged by the team

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions