Interface ISnapshotFlow


  • public interface ISnapshotFlow

    Snapshot flow is used to prepare a snapshot operation. The flow and the ultimate snapshot operation may affect a limited set of projects which is determined when the flow is created. The set of potentially affected projects may shrink randomly until the snapshot operation is created, e.g. because of project stops.

    Until the flow is converted to the snapshot operation or cancelled, it attempts to start exclusive operations for its potentially affected projects. When the flow is converted to the snapshot operation, the set of affected projects is finalized. The projects for which the exclusive operations were not started are released as well as the projects for which no snapshot creations or restorations were scheduled.

    A new snapshot flow can be created with IDtSnapshotManager.createFlow(java.util.Collection). Once created, the flow must be either converted to an operation with makeOperation(), or canceled with cancel().

    See Also:
    ISnapshotOperation, IDtSnapshotManager.createFlow(java.util.Collection)
    Restriction:
    This interface is not intended to be extended by clients.
    Restriction:
    This interface is not intended to be implemented by clients.
    • Method Detail

      • waitProjectsReady

        void waitProjectsReady​(long timeout)
                        throws InterruptedException
        Blocks until the locks for all potentially affected projects are acquired or the timeout elapsed.
        Parameters:
        timeout - the maximum waiting time in milliseconds, cannot be negative
        Throws:
        InterruptedException - if the calling thread was interrupted
        IllegalStateException - if the flow was already canceled or converted to the operation
      • scheduleSnapshotCreation

        void scheduleSnapshotCreation​(org.eclipse.core.resources.IProject project,
                                      Path snapshotPath)
        Schedules snapshot creation for the given project.

        The scheduled creation is not guaranteed to be included in the operation.

        Parameters:
        project - the project to create snapshot for, cannot be null
        snapshotPath - the path to store the snapshot, cannot be null
        Throws:
        IllegalStateException - if the flow was already canceled or converted to the operation, or finishScheduling() was called
        See Also:
        makeOperation()
      • scheduleSnapshotRestoration

        void scheduleSnapshotRestoration​(org.eclipse.core.resources.IProject project,
                                         Path snapshotPath)
        Schedules snapshot restoration for the given project.

        The scheduled restoration is not guaranteed to be included in the operation.

        Parameters:
        project - the project to restore snapshot for, cannot be null
        snapshotPath - the path to the snapshot, cannot be null
        Throws:
        IllegalStateException - if the flow was already canceled or converted to the operation, or finishScheduling() was called
        See Also:
        makeOperation()
      • finishScheduling

        void finishScheduling()
        Informs the flow that no more creations or restorations will be scheduled. At this point the flow may release locks for unaffected projects and manage operation priorities.
        Throws:
        IllegalStateException - if the flow was already canceled or converted to the operation, or finishScheduling() was called.
      • makeOperation

        IStartSnapshotOperationStep makeOperation()
        Converts the flow to a snapshot operation.

        A scheduled snapshot creation or restoration is included in the snapshot operation only if the exclusive lock was obtained for the respective project to this moment. Otherwise, the attempt to obtain a lock for the project is canceled.

        Returns:
        start step of the new snapshot operation, never null
        Throws:
        IllegalStateException - if the flow was already canceled or converted to the operation
      • cancel

        void cancel()
        Cancels the flow, releasing locks for all affected projects.
        Throws:
        IllegalStateException - if the flow was already canceled or converted to the operation