docs.unity3d.com
    Show / Hide Table of Contents

    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 after the version is committed.

    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
    IsCommitted

    DeleteArtifactAsync(String, CancellationToken)

    Asynchronously deletes an artifact with the given name from Version if Version wasn't committed.

    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 when completed.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if the Version is already committed

    ArgumentNullException

    Thrown if sourceStream is null.

    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 when completed.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if the Version is already committed

    ArgumentNullException

    Thrown if sourceFilePath is null.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023