Class Metabank.RegCatalog
Represents a system catalog of region objects
Inheritance
System.Object
Metabank.RegCatalog
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Azos.Sky.dll
public sealed class RegCatalog : Metabank.SystemCatalog, INamed
Fields
Declaration
public const string HST_EXT = ".h"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string NOC_EXT = ".noc"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string REG_EXT = ".r"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string ZON_EXT = ".z"
Field Value
Type |
Description |
System.String |
|
Properties
Enumerates all NOCs. This may fetch much data if enumerated to the end
Declaration
public IEnumerable<Metabank.SectionNOC> AllNOCs { get; }
Property Value
Navigates to region path and returns the corresponding section or null.
The path root starts at region catalog level i.e.: '/Us/East/Clev.noc/A/IV/wlarge0001' -
a path to a host called 'wlarge0001' located in zone A-IV in Cleveland network center etc.
NOTE: may omit the '.r', '.noc', and '.z' region/noc and zone designators.
The navigation is done using case-insensitive name comparison, however
the underlying file system may be case-sensitive and must be supplied the exact name
Declaration
public Metabank.SectionRegionBase this[string path] { get; }
Parameters
Type |
Name |
Description |
System.String |
path |
|
Property Value
Returns registry of top-level regions
Declaration
public IRegistry<Metabank.SectionRegion> Regions { get; }
Property Value
Methods
Returns true when all of the supplied paths are in the same NOC
Declaration
public bool ArePathsInSameNOC(params string[] paths)
Parameters
Type |
Name |
Description |
System.String[] |
paths |
|
Returns
Type |
Description |
System.Boolean |
|
Counts the number of matching region path segments that resolve to the same section in the region catalog.
Example: /US/East/CLE/A/I and /US/East/JFK/A/I returns 2
Declaration
public int CountMatchingPathSegments(Metabank.SectionRegionBase sect1, Metabank.SectionRegionBase sect2)
Parameters
Returns
Type |
Description |
System.Int32 |
|
Counts the number of matching region path segments that resolve to the same section in the region catalog.
Example: /US/East/CLE/A/I and /US/East/JFK/A/I returns 2
Declaration
public int CountMatchingPathSegments(string path1, string path2)
Parameters
Type |
Name |
Description |
System.String |
path1 |
|
System.String |
path2 |
|
Returns
Type |
Description |
System.Int32 |
|
Calculates the logical distance between two entities in the cloud.
Although the distance is measured in kilometers it is really a logical distance which is somewhat related to physical.
At first, the two paths are compared in terms of matching segment count, if paths match 100% (point to the same entity) then
the distance is zero, otherwise the path match ratio is prorated against the earth circumference to get distance value.
The second comparison is performed against physical geo centers that use haversine formula to compute the distance 'as the crow flies'.
The second step is necessary for the comparison of various non-matching paths. i.e.: '/world/us/east/cle...' and '/world/us/east/ny...' both yield
the same distance as far as paths comparison however, 'cle' is closer while compared with 'los angeles' than 'ny'
Declaration
public double GetDistanceBetweenPaths(string path1, string path2)
Parameters
Type |
Name |
Description |
System.String |
path1 |
|
System.String |
path2 |
|
Returns
Type |
Description |
System.Double |
|
Calculates the physical distance between two entities in the cloud.
The distance is based on paths geo centers and maybe inaccurate if geo coordinates are not properly set
Declaration
public double GetGeoDistanceBetweenPaths(string path1, string path2)
Parameters
Type |
Name |
Description |
System.String |
path1 |
|
System.String |
path2 |
|
Returns
Type |
Description |
System.Double |
|
Returns the ratio of matching region path segments that resolve to the same section in the region catalog, to maximum path length.
Example: /US/East/CLE/A and /US/East/JFK/A returns 0.5d = 50% match
Declaration
public double GetMatchingPathSegmentRatio(string path1, string path2)
Parameters
Type |
Name |
Description |
System.String |
path1 |
|
System.String |
path2 |
|
Returns
Type |
Description |
System.Double |
|
Tries to navigate to NOC section in the specified absolute path and returns it or null if path is invalid/does not lead to NOC.
Ignores anything after the NOC section (zones, hosts etc..). For example '/world/us/east/CLE.noc/a/ii/x' will return 'CLE.noc' section,
but '/world/us/east' will return null as there is no NOC in the path
Declaration
public Metabank.SectionNOC GetNOCofPath(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Combines region paths using '/' where needed
Declaration
public static string JoinPathSegments(params string[] segments)
Parameters
Type |
Name |
Description |
System.String[] |
segments |
|
Returns
Type |
Description |
System.String |
|
Navigates to host section or throws. NOTE: may omit the '.r','.noc','.z', and '.h' suffixes
Declaration
public Metabank.SectionHost NavigateHost(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Navigates to NOC section or throws. NOTE: may omit the '.r' and '.noc' suffixes
Declaration
public Metabank.SectionNOC NavigateNOC(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Navigates to region section or throws. NOTE: may omit the '.r' suffix
Declaration
public Metabank.SectionRegion NavigateRegion(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Navigates to zone section or throws. NOTE: may omit the '.r','.noc', and '.z' suffixes
Declaration
public Metabank.SectionZone NavigateZone(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Tries to navigate to region path as far as possible and returns the deepest section or null.
This method is needed to obtain root paths from detailed paths with wild cards.
Method also returns how deep it could navigate(how many path levels resolved).
For example:
'/Us/East/Clev.noc/{1}/{2}' - Clev.noc with depth=3 will be returned.
Declaration
public Metabank.SectionRegionBase TryNavigateAsFarAsPossible(string path, out int depth)
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.Int32 |
depth |
|
Returns
Validate(Metabank.ValidationContext)
Declaration
public override void Validate(Metabank.ValidationContext ctx)
Parameters
Overrides
Implements
Extension Methods