Storage Manager

The storage manager acts like a storage for the corpus and is used to interact with storage adapters.

public class StorageManager

Constructors

Name Description
StorageManager(CdmCorpusDefinition)
corpus: The corpus that owns this storage manager.
Initializes a new instance of the StorageManager class.

Properties

Name Type Description
DefaultNamespace string The namespace that will be used when one isn't explicitly provided.
NamespaceAdapters IDictionary<string, StorageAdapter> The dictionary of registered namespaces to storage adapters.

Methods

Name Description Return Type
Mount(string, StorageAdapter)
nameSpace: The namespace to mount.
adapter: The storage adapter.
Mounts a namespace to the specified adapter.

For example, the corpus paths under a namespace named "local" would have the following form: "local:/path/to/document".
void
MountFromConfig(string, bool)
adapterConfig: A JSON string representing the configurations for the adapters we want to create and mount.
doesReturnErrorList [optional]: A boolean that denotes whether to return a list of configurations for adapters that were not recognized. The default value is false.
Creates storage adapters using the specified adapter configuration and mounts them to the namespaces found in the configuration. Multiple adapters can be specified in the configuration to be created and mounted. Returns a list of configurations for unrecognized adapters. List<string>
Unmount(string)
nameSpace: The namespace to unmount.
Unmounts a namespace. Returns true if the unmount is successful, false otherwise. bool
FetchAdapter(string)
nameSpace: The namespace.
Retrieves the adapter for the specified namespace. StorageAdapter
FetchRootFolder(string)
nameSpace: The namespace.
Given the namespace of a registered storage adapter, returns the root folder containing the sub-folders and documents. CdmFolderDefinition
AdapterPathToCorpusPath(string)
adapterPath: The path.
Takes the specified storage adapter domain path, figures out the right adapter to use, and then returns a corpus path. string
CorpusPathToAdapterPath(string)
corpusPath: The path.
Takes the specified corpus path, figures out the right adapter to use, and then returns a storage adapter domain path. string
CreateAbsoluteCorpusPath(string, CdmObject)
objectPath: The corpus path.
obj [optional]: The object that the objectPath parameter should be relative to. If not set, objectPath will be assumed to be relative to the root folder in the default namespace.
Takes the specified corpus path (relative or absolute) and creates a valid absolute path with the namespace. Returns the created path. string
CreateRelativeCorpusPath(string, CdmContainerDefinition)
objectPath: The corpus path.
relativeTo [optional]: The object that the path should be made relative to.
Takes the specified corpus path (relative or absolute) and creates a valid relative corpus path with the namespace. Returns the created path. string
FetchConfig() Generates a JSON string representing the configurations of all the adapters that exist on this storage manager. string
SaveAdaptersConfigAsync(string, StorageAdapter)
name: The name of the file to save.
adapter: The storage adapter to use to save the configurations to a file.
Saves the configurations of all the adapters that exist on this storage manager to a file with the specified name. Uses the specified adapter to save. void