Class Metabank
Provides interface to METABASE - a metadata bank for the Sky.
Metabase is organized as a hierarchical directory structure with various files such as:
- configuration files that describe structure, policies, settings, hosts etc.
- configs files for particular components (i.e.: application, region, zone, db bank etc.)
- binary packages - resources necessary to distribute and run code across Sky (assemblies, images, static data files etc.)
Metabase is usually stored in a version-controlled system, such as SVN or GIT so the whole distribution
is versioned so any change can be rolled-back. This class is thread safe for using its instance methods
Inheritance
System.Object
Metabank
Implements
System.IDisposable
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 Metabank : ApplicationComponent, IDisposable, IApplicationComponent, IInstrumentable, IExternallyParameterized
Constructors
Opens metabase from the specified file system instance at the specified metabase root path
Declaration
public Metabank(IFileSystem fileSystem, FileSystemSessionConnectParams fsSessionParams, string rootPath)
Parameters
Type |
Name |
Description |
IFileSystem |
fileSystem |
An instance of a file system that stores the metabase files
|
FileSystemSessionConnectParams |
fsSessionParams |
File system connection params
|
System.String |
rootPath |
A path to the directory within the file system that contains metabase root data
|
Fields
Declaration
public const string APP_CATALOG = "app"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string BIN_CATALOG = "bin"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_ADDRESS_ATTR = "address"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_APP_CONFIG_INCLUDE_PRAGMA_ATTR = "app-config-include-pragma"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_APP_CONFIG_INCLUDE_PRAGMAS_DISABLED_ATTR = "app-config-include-pragmas-disabled"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_APP_CONFIG_SECTION = "app-config"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_AUTO_RUN_ATTR = "auto-run"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_BINDINGS_SECTION = "bindings"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_COMMON_FILE = "$.common"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_CONTRACTS_FILE = "contracts"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_DEFAULT_BINDING_ATTR = "default-binding"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_DESCRIPTION_ATTR = "description"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_EXE_ARGS_ATTR = "exe-args"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_EXE_FILE_ATTR = "exe-file"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_GDID_SECTION = "gdid"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_GEO_CENTER_ATTR = "geo-center"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_GROUP_SECTION = "group"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_HOST_DYNAMIC_ATTR = "dynamic"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_HOST_PROCESS_HOST_ATTR = "process-host"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_HOST_SET_BUILDER_SECTION = "host-set-builder"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_HOST_SET_HOST_SECTION = "host"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_HOST_SET_SECTION = "host-set"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_HOST_ZGOV_LOCK_FAILOVER_ATTR = "zgov-lock-failover"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_NAME_ATTR = "name"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_NETWORK_ROUTING_BINDING_ATTR = "binding"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_NETWORK_ROUTING_FROM_ATTR = "from"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_NETWORK_ROUTING_HOST_ATTR = "host"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_NETWORK_ROUTING_NETWORK_ATTR = "network"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_NETWORK_ROUTING_ROUTE_SECTION = "route"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_NETWORK_ROUTING_SECTION = "network-routing"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_NETWORK_ROUTING_SERVICE_ATTR = "service"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_NETWORK_ROUTING_TO_ADDRESS_ATTR = "to-address"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_NETWORK_ROUTING_TO_GROUP_ATTR = "to-group"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_NETWORK_ROUTING_TO_PORT_ATTR = "to-port"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_NETWORK_SECTION = "network"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_NETWORKS_FILE = "networks"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_OFFLINE_ATTR = "offline"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_OS_APP_CONFIG_INCLUDE_SECTION = "include-os-app-config"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_OS_ATTR = "os"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_OS_SECTION = "os"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_PACKAGE_SECTION = "package"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_PACKAGES_SECTION = "packages"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_PARENT_NOC_ZONE_ATTR = "parent-noc-zone"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_PATH_ATTR = "path"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_PLATFORM_SECTION = "platform"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_PLATFORMS_FILE = "platforms"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_PORT_ATTR = "port"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_PROCESSOR_HOST_ID_ATTR = "id"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_PROCESSOR_HOST_PRIMARY_PATH_ATTR = "primary-path"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_PROCESSOR_HOST_SECONDARY_PATH_ATTR = "secondary-path"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_PROCESSOR_HOST_SECTION = "host"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_PROCESSOR_SET_SECTION = "processor-set"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_ROLE_ATTR = "role"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_SCOPE_ATTR = "scope"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_SECTION_LEVEL_ANY_APP_FILE = "$.app"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_SECTION_LEVEL_APP_FILE_PREFIX = "$."
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_SECTION_LEVEL_APP_FILE_SUFFIX = ".app."
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_SECTION_LEVEL_FILE = "$"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_SERVICE_SECTION = "service"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_TARGET_SUFFIX_ATTR = "target-suffix"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string CONFIG_VERSION_ATTR = "version"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string DEFAULT_PACKAGE_VERSION = "head"
Field Value
Type |
Description |
System.String |
|
Declaration
public const int DEFAULT_RESOLVE_DYNAMIC_HOST_NET_SVC_TIMEOUT_MS = 2000
Field Value
Type |
Description |
System.Int32 |
|
Declaration
public const char HOST_DYNAMIC_SUFFIX_SEPARATOR = '~'
Field Value
Type |
Description |
System.Char |
|
Declaration
public const int MIN_RESOLVE_DYNAMIC_HOST_NET_SVC_TIMEOUT_MS = 1000
Field Value
Type |
Description |
System.Int32 |
|
Declaration
public const string REG_CATALOG = "reg"
Field Value
Type |
Description |
System.String |
|
Declaration
public const string SEC_CATALOG = "sec"
Field Value
Type |
Description |
System.String |
|
Properties
Returns false as soon as destruction starts
Declaration
public bool Active { get; }
Property Value
Type |
Description |
System.Boolean |
|
Returns application catalog instance
Declaration
public Metabank.AppCatalog CatalogApp { get; }
Property Value
Returns bin catalog instance
Declaration
public Metabank.BinCatalog CatalogBin { get; }
Property Value
Returns region catalog instance
Declaration
public Metabank.RegCatalog CatalogReg { get; }
Property Value
Returns all catalogs that this metabank has initialized
Declaration
public IRegistry<Metabank.Catalog> Catalogs { get; }
Property Value
Returns security catalog instance
Declaration
public Metabank.SecCatalog CatalogSec { get; }
Property Value
Returns common config for all levels, the one that gets included in all level configs of metabase
Declaration
public IConfigSectionNode CommonLevelConfig { get; }
Property Value
Declaration
public override string ComponentCommonName { get; }
Property Value
Type |
Description |
System.String |
|
Overrides
Declaration
public override string ComponentLogTopic { get; }
Property Value
Type |
Description |
System.String |
|
Overrides
Returns named parameters that can be used to control this component
Declaration
public IEnumerable<KeyValuePair<string, Type>> ExternalParameters { get; }
Property Value
Type |
Description |
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>> |
|
Returns file system that this bank is read from
Declaration
public IFileSystem FileSystem { get; }
Property Value
Returns root path of the metabase data in the file system
Declaration
public string FileSystemRootPath { get; }
Property Value
Type |
Description |
System.String |
|
Returns parameters for file system session establishment
Declaration
public FileSystemSessionConnectParams FileSystemSessionConnectParams { get; }
Property Value
Returns enumeration of Global Distributed ID generation Authorities declared in root metabase level
Declaration
public IEnumerable<GdidGenerator.AuthorityHost> GDIDAuthorities { get; }
Property Value
Controls instrumentation availability
Declaration
[Config]
[ExternalParameter(new string[]{"metabase", "instrumentation"})]
public bool InstrumentationEnabled { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Returns the list of network nodes declared in networks file
Declaration
public IEnumerable<IConfigSectionNode> NetworkConfNodes { get; }
Property Value
Returns the list of network names declared in networks file
Declaration
public IEnumerable<string> NetworkNames { get; }
Property Value
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
|
Returns the list of operating system nodes declared in platforms file
Declaration
public IEnumerable<IConfigSectionNode> OSConfNodes { get; }
Property Value
Returns the list of operating system names declared in platforms file
Declaration
public IEnumerable<string> OSNames { get; }
Property Value
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
|
Returns the list of platform nodes declared in platforms file
Declaration
public IEnumerable<IConfigSectionNode> PlatformConfNodes { get; }
Property Value
Returns the list of platform names declared in platforms file
Declaration
public IEnumerable<string> PlatformNames { get; }
Property Value
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
|
Declaration
[Config(Default = 2000)]
[ExternalParameter(new string[]{"metabase"})]
public int ResolveDynamicHostNetSvcTimeoutMs { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Returns root-level config for all applications that this meatabase defines
Declaration
public IConfigSectionNode RootAppConfig { get; }
Property Value
Returns root-level config for the whole meatabase
Declaration
public IConfigSectionNode RootConfig { get; }
Property Value
Returns metabase root section for service client hub from contracts.acmb
Declaration
public IConfigSectionNode ServiceClientHubConfNode { get; }
Property Value
Methods
Declaration
protected override void Destructor()
Overrides
DumpCacheStatus(StringBuilder)
Helper method to dump the status of metabase cache
Declaration
public void DumpCacheStatus(StringBuilder to)
Parameters
Type |
Name |
Description |
System.Text.StringBuilder |
to |
|
Gets external parameter value returning true if parameter was found
Declaration
public bool ExternalGetParameter(string name, out object value, params string[] groups)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Object |
value |
|
System.String[] |
groups |
|
Returns
Type |
Description |
System.Boolean |
|
Returns named parameters that can be used to control this component
Declaration
public IEnumerable<KeyValuePair<string, Type>> ExternalParametersForGroups(params string[] groups)
Parameters
Type |
Name |
Description |
System.String[] |
groups |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>> |
|
Sets external parameter value returning true if parameter was found and set
Declaration
public bool ExternalSetParameter(string name, object value, params string[] groups)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Object |
value |
|
System.String[] |
groups |
|
Returns
Type |
Description |
System.Boolean |
|
Returns conf node for the network or throws if network with requested name was not found
Declaration
public IConfigSectionNode GetNetworkConfNode(string netName)
Parameters
Type |
Name |
Description |
System.String |
netName |
|
Returns
Returns description for the network or throws if network with requested name was not found
Declaration
public string GetNetworkDescription(string netName)
Parameters
Type |
Name |
Description |
System.String |
netName |
|
Returns
Type |
Description |
System.String |
|
Returns conf node for the network group or throws if network group with requested name was not found
Declaration
public IConfigSectionNode GetNetworkGroupConfNode(string netName, string groupName)
Parameters
Type |
Name |
Description |
System.String |
netName |
|
System.String |
groupName |
|
Returns
Returns description for the network group or throws if network with requested name was not found
Declaration
public string GetNetworkGroupDescription(string netName, string groupName)
Parameters
Type |
Name |
Description |
System.String |
netName |
|
System.String |
groupName |
|
Returns
Type |
Description |
System.String |
|
Returns a list of group names for the named network
Declaration
public IEnumerable<string> GetNetworkGroupNames(string netName)
Parameters
Type |
Name |
Description |
System.String |
netName |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
|
Returns a list of config nodes for groups for the named network
Declaration
public IEnumerable<IConfigSectionNode> GetNetworkGroupNodes(string netName)
Parameters
Type |
Name |
Description |
System.String |
netName |
|
Returns
Returns network scope for the network or throws if network with requested name was not found
Declaration
public NetworkScope GetNetworkScope(string netName)
Parameters
Type |
Name |
Description |
System.String |
netName |
|
Returns
Returns conf node for named binding per network service, or if binding name is blank then returns default network binding.
If net service does not have default binding specified then takes fist available binding.
Throws if no match could be made
Declaration
public IConfigSectionNode GetNetworkSvcBindingConfNode(string net, string svc, string binding = null)
Parameters
Type |
Name |
Description |
System.String |
net |
|
System.String |
svc |
|
System.String |
binding |
|
Returns
Returns a list of service binding names for the named service in the named network
Declaration
public IEnumerable<string> GetNetworkSvcBindingNames(string netName, string svcName)
Parameters
Type |
Name |
Description |
System.String |
netName |
|
System.String |
svcName |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
|
Returns a list of config nodes for service bindings for the named service in the named network
Declaration
public IEnumerable<IConfigSectionNode> GetNetworkSvcBindingNodes(string netName, string svcName)
Parameters
Type |
Name |
Description |
System.String |
netName |
|
System.String |
svcName |
|
Returns
Returns conf node for the network service or throws if network service with requested name was not found
Declaration
public IConfigSectionNode GetNetworkSvcConfNode(string netName, string svcName)
Parameters
Type |
Name |
Description |
System.String |
netName |
|
System.String |
svcName |
|
Returns
Returns description for the network service or throws if network with requested name was not found
Declaration
public string GetNetworkSvcDescription(string netName, string svcName)
Parameters
Type |
Name |
Description |
System.String |
netName |
|
System.String |
svcName |
|
Returns
Type |
Description |
System.String |
|
Returns a list of service names for the named network
Declaration
public IEnumerable<string> GetNetworkSvcNames(string netName)
Parameters
Type |
Name |
Description |
System.String |
netName |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
|
Returns a list of config nodes for services for the named network
Declaration
public IEnumerable<IConfigSectionNode> GetNetworkSvcNodes(string netName)
Parameters
Type |
Name |
Description |
System.String |
netName |
|
Returns
Returns config node for the specified OS, or throws if this OS is not declared in platforms root file or it is declared more than once
Declaration
public IConfigSectionNode GetOSConfNode(string osName)
Parameters
Type |
Name |
Description |
System.String |
osName |
|
Returns
Gets Platform name per named OS
Declaration
public string GetOSPlatformName(string osName)
Parameters
Type |
Name |
Description |
System.String |
osName |
|
Returns
Type |
Description |
System.String |
|
Gets platform config node per named OS
Declaration
public IConfigSectionNode GetOSPlatformNode(string osName)
Parameters
Type |
Name |
Description |
System.String |
osName |
|
Returns
Joins paths per injected file system
Declaration
public string JoinPaths(string first, params string[] other)
Parameters
Type |
Name |
Description |
System.String |
first |
|
System.String[] |
other |
|
Returns
Type |
Description |
System.String |
|
Returns true when the network with the specified name exists in metabase netoworks definition
Declaration
public bool NetworkExists(string netName)
Parameters
Type |
Name |
Description |
System.String |
netName |
|
Returns
Type |
Description |
System.Boolean |
|
Resolves logical service name on the specified remote host into physical Glue.Node connection string suitable
for making remote calls from this machine
Declaration
public Node ResolveNetworkService(string host, string net, string svc, string binding = null, string fromHost = null)
Parameters
Type |
Name |
Description |
System.String |
host |
Metabase host name i.e. 'World/Us/East/CLE/A/I/wmed0001' of the destination to make a call to
|
System.String |
net |
Network name i.e. 'internoc'
|
System.String |
svc |
Service name i.e. 'zgov'
|
System.String |
binding |
Optional preferred binding name i.e. 'sync'
|
System.String |
fromHost |
Optional metabase host name for the host that calls will be made from. If null, then local host as determined at boot will be used
|
Returns
Type |
Description |
Node |
Glue Node instance with remote address visible to the calling party
|
Resolves logical service name on the specified remote host into physical Glue.Node connection string suitable
for making remote calls from this machine
Declaration
public string ResolveNetworkServiceToConnectString(string host, string net, string svc, string binding = null, string fromHost = null)
Parameters
Type |
Name |
Description |
System.String |
host |
Metabase host name i.e. 'World/Us/East/CLE/A/I/wmed0001' of the destination to make a call to
|
System.String |
net |
Network name i.e. 'internoc'
|
System.String |
svc |
Service name i.e. 'zgov'
|
System.String |
binding |
Optional preferred binding name i.e. 'sync'
|
System.String |
fromHost |
Optional metabase host name for the host that calls will be made from. If null, then local host as determined at boot will be used
|
Returns
Type |
Description |
System.String |
Glue Node as connection string string instance with remote address visible to the calling party
|
Validates metabase by checking all of it contents for consistency - may take time for large metabases.
This method is not expected to be called by business applications, only by tools
Declaration
public void Validate(IList<MetabaseValidationMsg> output)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IList<MetabaseValidationMsg> |
output |
A list where output such as erros and warnings is redirected.
May use Collections.EventedList for receiving notifications upon list addition
|
Implements
System.IDisposable
Extension Methods