Interface ITransaction
Provides methods to commit the state of dataset version, upload new artifacts and delete pending artifacts if Version wasn't committed.
Namespace: Unity.Cloud.Storage
Syntax
public interface ITransaction
Properties
Version
Gets the dataset version from which this transaction has been created.
Declaration
IDatasetVersion Version { get; }
Property Value
Type | Description |
---|---|
IDatasetVersion |
Methods
CommitAsync(String, CancellationToken)
Asynchronously commits the pending artifacts to the dataset version. Artifacts can't be uploaded or deleted after commit is performed.
Declaration
Task CommitAsync(string comment, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | comment | A comment to the commit. It will be available at |
CancellationToken | cancellationToken | An optional cancellation token. |
Returns
Type | Description |
---|---|
Task | A task with no result. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if the Version is already committed |
See Also
DeleteArtifactAsync(String, CancellationToken)
Declaration
Task DeleteArtifactAsync(string name, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the artifact to be deleted |
CancellationToken | cancellationToken | An optional cancellation token. |
Returns
Type | Description |
---|---|
Task | A task with no result. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if the Version is already committed |
UploadArtifactAsync(String, Stream, CancellationToken)
Asynchronously creates an artifact with the given name in Version and uploads the data from the given stream as the artifact's content if Version wasn't committed. Advances the position within the stream by the number of bytes read.
Declaration
Task UploadArtifactAsync(string newArtifactName, Stream sourceStream, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | newArtifactName | The name of the artifact to be created. |
Stream | sourceStream | The stream from which the contents will be uploaded to the created artifact. |
CancellationToken | cancellationToken | An optional cancellation token. |
Returns
Type | Description |
---|---|
Task | Returns a Task that results in an |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if the Version is already committed |
ArgumentNullException | Thrown if |
UploadArtifactAsync(String, String, CancellationToken)
Asynchronously creates an artifact with the given name Version and uploads the data from the given file as the artifact's content if Version wasn't committed.
Declaration
Task UploadArtifactAsync(string newArtifactName, string sourceFilePath, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | newArtifactName | The name of the artifact to be created. |
String | sourceFilePath | A relative or absolute path for the file from which the contents will be uploaded to the created artifact. |
CancellationToken | cancellationToken | An optional cancellation token. |
Returns
Type | Description |
---|---|
Task | Returns a Task that results in an |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if the Version is already committed |
ArgumentNullException | Thrown if |