com.microsoft.tfs.core.clients.versioncontrol
Class UpdateLocalVersionQueue

java.lang.Object
  extended by com.microsoft.tfs.core.clients.versioncontrol.UpdateLocalVersionQueue
All Implemented Interfaces:
com.microsoft.tfs.util.Closable

public class UpdateLocalVersionQueue
extends java.lang.Object
implements com.microsoft.tfs.util.Closable

Class for handling deferred batch updates of the (server's) LocalVersion table. Holds up to N requests for a maximum of M seconds. We use time rather than byte counts because it more closely models the user's maximum threshold of pain, if the operation were to be cancelled. In effect, it is the byte count adjusted for bandwidth.

You must call close() when finished with an instance.

Since:
TEE-SDK-11.0
Thread-safety:
thread-safe

Constructor Summary
UpdateLocalVersionQueue(Workspace workspace)
          Constructs a queue for updating both the local workspace and server's local version tables.
UpdateLocalVersionQueue(Workspace workspace, UpdateLocalVersionQueueOptions options)
          Constructs a queue for updating one or both (according to options) of the local workspace and server's local version tables.
UpdateLocalVersionQueue(Workspace workspace, UpdateLocalVersionQueueOptions options, com.microsoft.tfs.core.clients.versioncontrol.internal.localworkspace.WorkspaceLock wLock)
          Constructs a queue for updating the workspace's local version table.
UpdateLocalVersionQueue(Workspace workspace, UpdateLocalVersionQueueOptions options, com.microsoft.tfs.core.clients.versioncontrol.internal.localworkspace.WorkspaceLock wLock, int flushTriggerLevel, int maximumLevel, int timeTriggerInMilliseconds)
          Constructs a queue for updating the workspace's local version table.
 
Method Summary
 void close()
          Send any pending requests to the server and close resources this instance is using.
 void flush()
          Send any pending requests to the server
 void queueUpdate(ILocalVersionUpdate update)
          Add the update to the queue, flushing if thresholds have been exceeded.
 void queueUpdate(java.lang.String sourceServerItem, int itemId, java.lang.String targetLocalItem, int localVersion, java.util.Calendar localVersionCheckinDate, int encoding, byte[] baselineHashValue, long baselineFileLength, PropertyValue[] properties)
          Queue a request to tell the server the local disk location of an item in the workspace.
 void queueUpdate(java.lang.String sourceServerItem, int itemId, java.lang.String targetLocalItem, int localVersion, PropertyValue[] properties)
          Queue a request to tell the server the local disk location of an item in the workspace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdateLocalVersionQueue

public UpdateLocalVersionQueue(Workspace workspace)
Constructs a queue for updating both the local workspace and server's local version tables.

Parameters:
workspace - the workspace that will be updated (must not be null)

UpdateLocalVersionQueue

public UpdateLocalVersionQueue(Workspace workspace,
                               UpdateLocalVersionQueueOptions options)
Constructs a queue for updating one or both (according to options) of the local workspace and server's local version tables.

Parameters:
workspace - the workspace that will be updated (must not be null)
options - options that control which version tables get updated (must not be null)

UpdateLocalVersionQueue

public UpdateLocalVersionQueue(Workspace workspace,
                               UpdateLocalVersionQueueOptions options,
                               com.microsoft.tfs.core.clients.versioncontrol.internal.localworkspace.WorkspaceLock wLock)
Constructs a queue for updating the workspace's local version table.

Parameters:
workspace - Workspace to queue local version updates for
options -
wLock - Which table locations to update (local, server, or both)

UpdateLocalVersionQueue

public UpdateLocalVersionQueue(Workspace workspace,
                               UpdateLocalVersionQueueOptions options,
                               com.microsoft.tfs.core.clients.versioncontrol.internal.localworkspace.WorkspaceLock wLock,
                               int flushTriggerLevel,
                               int maximumLevel,
                               int timeTriggerInMilliseconds)
Constructs a queue for updating the workspace's local version table. This constructor is called from GetEngine to provide the workspace lock which was opened for processGetOperations. (It may have been taken on a different thread.)

Parameters:
workspace - the workspace that will be updated (must not be null)
options - options that control which version tables get updated (must not be null)
wLock - a WorkspaceLock that this class should do its work inside (if null this class creates its own lock on demand)
Method Detail

queueUpdate

public void queueUpdate(java.lang.String sourceServerItem,
                        int itemId,
                        java.lang.String targetLocalItem,
                        int localVersion,
                        PropertyValue[] properties)
Queue a request to tell the server the local disk location of an item in the workspace.

Parameters:
sourceServerItem - The committed server path of the item in the workspace, or the target server item if the item is uncommitted (pending add or branch)
itemId - Item ID of the item in the workspace (optional; used for backwards compatibility with TFS 2010 and earlier servers)
targetLocalItem - New local path of the item, or null to remove it from the workspace
localVersion - The version of the item in the workspace. If zero, the request refers to the uncommitted slot for the item ID. If non-zero, the request refers to the committed slot for the item ID.

queueUpdate

public void queueUpdate(java.lang.String sourceServerItem,
                        int itemId,
                        java.lang.String targetLocalItem,
                        int localVersion,
                        java.util.Calendar localVersionCheckinDate,
                        int encoding,
                        byte[] baselineHashValue,
                        long baselineFileLength,
                        PropertyValue[] properties)
Queue a request to tell the server the local disk location of an item in the workspace.

Parameters:
sourceServerItem - The committed server path of the item in the workspace, or the target server item if the item is uncommitted (pending add or branch)
itemId - Item ID of the item in the workspace (optional; used for backwards compatibility with TFS 2010 and earlier servers)
targetLocalItem - New local path of the item, or null to remove it from the workspace
localVersion - The version of the item in the workspace. If zero, the request refers to the uncommitted slot for the item ID. If non-zero, the request refers to the committed slot for the item ID.

queueUpdate

public void queueUpdate(ILocalVersionUpdate update)
Add the update to the queue, flushing if thresholds have been exceeded.

Parameters:
update - the update

close

public void close()
Send any pending requests to the server and close resources this instance is using.

Specified by:
close in interface com.microsoft.tfs.util.Closable

flush

public void flush()
Send any pending requests to the server



© 2015 Microsoft. All rights reserved.