Class DirectoryContentFileStore
Abstract IContentFileStore implementation that stores files in a file system directory.
Inheritance
Namespace: Tableau.Migration.Content.Files
Assembly: Tableau.Migration.dll
Syntax
public class DirectoryContentFileStore : IContentFileStore, IAsyncDisposable
Constructors
DirectoryContentFileStore(IFileSystem, IContentFilePathResolver, IConfigReader, IMemoryStreamManager, string)
Creates a new DirectoryContentFileStore object.
Declaration
public DirectoryContentFileStore(IFileSystem fileSystem, IContentFilePathResolver pathResolver, IConfigReader configReader, IMemoryStreamManager memoryStreamManager, string storeDirectoryName)
Parameters
Type | Name | Description |
---|---|---|
IFileSystem | fileSystem | The file system to use. |
IContentFilePathResolver | pathResolver | The path resolver to use. |
IConfigReader | configReader | A config reader to get the root path and other options from. |
IMemoryStreamManager | memoryStreamManager | The memory stream manager to user. |
string | storeDirectoryName | The relative directory name to use for this file store. |
Properties
BaseStorePath
Gets the base path of the file store.
Declaration
protected string BaseStorePath { get; }
Property Value
Type | Description |
---|---|
string |
FileSystem
Gets the file system to use.
Declaration
protected IFileSystem FileSystem { get; }
Property Value
Type | Description |
---|---|
IFileSystem |
HasOpenTableauFileEditor
Indicates if the store has any Tableau File Editor Open.
Declaration
public bool HasOpenTableauFileEditor { get; }
Property Value
Type | Description |
---|---|
bool |
MemoryStreamManager
Gets the memory stream manager.
Declaration
protected IMemoryStreamManager MemoryStreamManager { get; }
Property Value
Type | Description |
---|---|
IMemoryStreamManager |
PathResolver
Gets the content file path resolver.
Declaration
protected IContentFilePathResolver PathResolver { get; }
Property Value
Type | Description |
---|---|
IContentFilePathResolver |
TrackedFilePaths
Gets the content files being tracked by the file store.
Declaration
protected ConcurrentSet<string> TrackedFilePaths { get; }
Property Value
Type | Description |
---|---|
ConcurrentSet<string> |
Methods
CloseTableauFileEditorAsync(IContentFileHandle, CancellationToken)
Closes the current Tableau file format editor for the content file, if one is open. Changes will be flushed before closing.
Declaration
public Task CloseTableauFileEditorAsync(IContentFileHandle handle, CancellationToken cancel)
Parameters
Type | Name | Description |
---|---|---|
IContentFileHandle | handle | The handle to the file to close the editor for. |
CancellationToken | cancel | The cancellation token to obey. |
Returns
Type | Description |
---|---|
Task | A task to await. |
Create(string, string)
Creates a file managed by the file store.
Declaration
public IContentFileHandle Create(string relativeStorePath, string originalFileName)
Parameters
Type | Name | Description |
---|---|---|
string | relativeStorePath | The relative path and file name to create a file for within the file store. |
string | originalFileName | The original file name external to the file store to preserve when publishing content items. |
Returns
Type | Description |
---|---|
IContentFileHandle | A handle to the newly created file. |
Create<TContent>(TContent, string)
Creates a file managed by the file store.
Declaration
public IContentFileHandle Create<TContent>(TContent contentItem, string originalFileName)
Parameters
Type | Name | Description |
---|---|---|
TContent | contentItem | The content item to resolve a relative file store path from. |
string | originalFileName | The original file name external to the file store to preserve when publishing content items. |
Returns
Type | Description |
---|---|
IContentFileHandle | A handle to the newly created file. |
Type Parameters
Name | Description |
---|---|
TContent | The content type. |
DeleteAsync(IContentFileHandle, CancellationToken)
Deletes a file managed by the file store.
Declaration
public Task DeleteAsync(IContentFileHandle handle, CancellationToken cancel)
Parameters
Type | Name | Description |
---|---|---|
IContentFileHandle | handle | The handle to the file to delete. |
CancellationToken | cancel | The cancellation token to obey. |
Returns
Type | Description |
---|---|
Task | A task to await. |
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
Declaration
public virtual ValueTask DisposeAsync()
Returns
Type | Description |
---|---|
ValueTask | A task that represents the asynchronous dispose operation. |
GetTableauFileEditorAsync(IContentFileHandle, CancellationToken, bool?)
Gets the current Tableau file format editor for the content file, opening a new editor if necessary.
Declaration
public Task<ITableauFileEditor> GetTableauFileEditorAsync(IContentFileHandle handle, CancellationToken cancel, bool? zipFormatOverride = null)
Parameters
Type | Name | Description |
---|---|---|
IContentFileHandle | handle | The handle to the file to get the editor for. |
CancellationToken | cancel | The cancellation token to obey. |
bool? | zipFormatOverride | True to consider the file a zip archive, false to consider the file an XML file, or null to detect whether the file is a zip archive. |
Returns
Type | Description |
---|---|
Task<ITableauFileEditor> | The editor to use. Changes made will be flushed automatically before the content item is published. |
OpenReadAsync(IContentFileHandle, CancellationToken)
Opens a stream to read from a file.
Declaration
public Task<IContentFileStream> OpenReadAsync(IContentFileHandle handle, CancellationToken cancel)
Parameters
Type | Name | Description |
---|---|---|
IContentFileHandle | handle | The handle to the file to read from. |
CancellationToken | cancel | The cancellation token to obey. |
Returns
Type | Description |
---|---|
Task<IContentFileStream> | The stream to read from. |
OpenWriteAsync(IContentFileHandle, CancellationToken)
Opens a stream to write to a file.
Declaration
public Task<IContentFileStream> OpenWriteAsync(IContentFileHandle handle, CancellationToken cancel)
Parameters
Type | Name | Description |
---|---|---|
IContentFileHandle | handle | The handle to the file to write to. |
CancellationToken | cancel | The cancellation token to obey. |
Returns
Type | Description |
---|---|
Task<IContentFileStream> | The stream to write to. |