//TODO: values will vary depending on the "Role" ! public static ProcessRoleMetrics Create(Dictionary <string, object?>?data) { string?role = TinyJsonParser.GetStringField(data, "role"); switch (role) { case null: return(null !); //invalid! case "master": return(new MasterRoleMetrics(data)); case "proxy": return(new ProxyRoleMetrics(data)); case "resolver": return(new ResolverRoleMetrics(data)); case "cluster_controller": return(new ClusterControllerRoleMetrics(data)); case "log": return(new LogRoleMetrics(data)); case "storage": return(new StorageRoleMetrics(data)); default: return(new ProcessRoleMetrics(data, role)); } }
//TODO: values will vary depending on the "Role" ! public static ProcessRoleMetrics Create(Dictionary <string, object?>?data) { string?role = TinyJsonParser.GetStringField(data, "role"); return(role switch { null => null !, //invalid! "master" => new MasterRoleMetrics(data), "proxy" => new ProxyRoleMetrics(data), "commit_proxy" => new CommitProxyRoleMetrics(data), "grv_proxy" => new GrvProxyRoleMetrics(data), "resolver" => new ResolverRoleMetrics(data), "cluster_controller" => new ClusterControllerRoleMetrics(data), "log" => new LogRoleMetrics(data), "storage" => new StorageRoleMetrics(data), "ratekeeper" => new RateKeeperRoleMetrics(data), "data_distributor" => new DataDistributorRoleMetrics(data), _ => new ProcessRoleMetrics(data, role) });
protected string?GetString(string field1, string field2) { return(TinyJsonParser.GetStringField(TinyJsonParser.GetMapField(m_data, field1), field2)); }
protected string?GetString(string field) { return(TinyJsonParser.GetStringField(m_data, field)); }