select new CloudDownloadAction(account, info, "Resolver");
downloadActions.Apply(action=> StatusAgent.SetFileState(action.FileState.FilePath,FileStatus.Unchanged,FileOverlayStatus.Normal,"Resolve by downloading"));
- downloadActions.Apply(NetworkAgent.Post);
+ //downloadActions.Apply(NetworkAgent.Post);
}
account.BlockSize, account.BlockHash,"Resolver",false);
actions.Apply(action => StatusAgent.SetFileState(action.FileState.FilePath, FileStatus.Modified, FileOverlayStatus.Normal, "Resolve by downloading"));
- actions.Apply(NetworkAgent.Post);
+ //actions.Apply(NetworkAgent.Post);
}
//Keeping both versions means that we need to copy one of them
{
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- private Agent<CloudAction> _agent;
+ //private Agent<CloudAction> _agent;
[System.ComponentModel.Composition.Import]
public DeleteAgent DeleteAgent { get; set; }
}
- public void Start()
+ /*public void Start()
{
if (_agent != null)
return;
loop();
});
- }
+ }*/
+/*
private async Task Process(CloudAction action)
{
if (action == null)
Log.WarnFormat("[REQUEUE] {0} : {1} -> {2}", action.Action, action.LocalFile, action.CloudFile);
}
}
-*/
+#1#
catch (OperationCanceledException ex)
{
Log.WarnFormat("Cancelling [{0}]",ex);
}
}
}
+*/
- private void ProcessChildUploads(CloudUploadAction uploadAction)
+ /* private void ProcessChildUploads(CloudUploadAction uploadAction)
{
if (!uploadAction.IsCreation || !(uploadAction.LocalFile is DirectoryInfo))
return;
folderActions.ApplyAction(PostUploadAction);
fileActions.ApplyAction(PostUploadAction);
}
-
+*/
+/*
private void PostUploadAction(CloudUploadAction action)
{
var state = StatusKeeper.GetStateByFilePath(action.LocalFile.FullName);
action.FileState = state;
Post(action);
}
+*/
- private CancellationToken CurrentOperationCancelToken
+ public CancellationToken CurrentOperationCancelToken
{
get { return _currentOperationCancellation.Token; }
}
StatusNotification.NotifyChange(message, TraceLevel.Warning);
}
+/*
public void Post(CloudAction cloudAction)
{
if (cloudAction == null)
else
_agent.Post(cloudAction);
}
+*/
+/*
public IEnumerable<CloudAction> GetEnumerable()
{
return _agent.GetEnumerable();
}
+*/
public Task GetDeleteAwaiter()
{
return DeleteAgent.ProceedEvent.WaitAsync();
}
+/*
public CancellationToken CancellationToken
{
get { return _agent.CancellationToken; }
}
+*/
public bool Pause
{
private async Task<DateTime?> WaitForScheduledOrManualPoll(DateTime? since)\r
{\r
var sync = _syncEvent.WaitAsync();\r
- var wait = TaskEx.Delay(TimeSpan.FromSeconds(Settings.PollingInterval), NetworkAgent.CancellationToken);\r
+ var wait = TaskEx.Delay(TimeSpan.FromSeconds(Settings.PollingInterval));\r
\r
var signaledTask = await TaskEx.WhenAny(sync, wait);\r
\r
DeleteCloudFile(accountInfo, tuple);\r
//updateRecord(Remove L, S) \r
}\r
+ //If both the local and server files are missing, the state is stale\r
+ else if (!localInfo.Exists && ( tuple.S==null || tuple.ObjectInfo==null))\r
+ {\r
+ StatusKeeper.ClearFileStatus(localInfo.FullName);\r
+ }\r
else\r
{\r
ReportConflictForMismatch(localFilePath);\r
\r
private string MoveForServerMove(AccountInfo accountInfo, StateTuple tuple)\r
{\r
+ if (tuple.ObjectInfo == null)\r
+ return null;\r
var relativePath = tuple.ObjectInfo.RelativeUrlToFilePath(accountInfo.UserName);\r
var serverPath = Path.Combine(accountInfo.AccountPath, relativePath);\r
-\r
- if (tuple.FilePath == serverPath) return serverPath;\r
+ \r
+ //Compare Case Insensitive\r
+ if (String.Equals(tuple.FilePath ,serverPath,StringComparison.InvariantCultureIgnoreCase)) return serverPath;\r
\r
if (tuple.FileInfo.Exists)\r
{ \r
public void SetSelectivePaths(AccountInfo accountInfo,Uri[] added, Uri[] removed)\r
{\r
AbortRemovedPaths(accountInfo,removed);\r
- DownloadNewPaths(accountInfo,added);\r
+ //DownloadNewPaths(accountInfo,added);\r
}\r
\r
+/*\r
private void DownloadNewPaths(AccountInfo accountInfo, Uri[] added)\r
{\r
var client = new CloudFilesClient(accountInfo);\r
//Need to get a listing of each of the URLs, then post them to the NetworkAgent\r
//CreatesToActions(accountInfo,)\r
\r
-/* NetworkAgent.Post();*/\r
+/* NetworkAgent.Post();#1#\r
}\r
+*/\r
\r
private void AbortRemovedPaths(AccountInfo accountInfo, Uri[] removed)\r
{\r
if (String.IsNullOrWhiteSpace(cloudFile.Container))\r
throw new ArgumentException("Invalid container", "cloudFile");\r
Contract.EndContractBlock();\r
-\r
\r
+\r
using (StatusNotification.GetNotifier("Uploading {0}", "Finished Uploading {0}", fileInfo.Name))\r
{\r
if (await WaitOrAbort(accountInfo,cloudFile, token)) \r
namespace Pithos.Core.Agents
{
+/*
[Export]
public class WorkflowAgent
{
public WorkflowAgent()
{
- _agent = Agent<WorkflowState>.Start(inbox =>
+ /*_agent = Agent<WorkflowState>.Start(inbox =>
{
Action loop = null;
loop = () =>
Log.ErrorFormat("[ERROR] Synch for {0}:\r{1}", message.Result.FileName, ex));
};
loop();
- });
+ });#1#
}
+/*
private Task<object> Process(WorkflowState state)
{
var accountInfo = state.AccountInfo;
}
}
}
+#1#
+/*
private void DeleteChildObjects(WorkflowState state, FileState fileState)
{
}
}
}
+#1#
/*private void MoveChildObjects(WorkflowState state)
{
oldMoveInfo, newMoveInfo));
}
}
- }*/
+ }#1#
//Starts interrupted files for a specific account
+/*
public void RestartInterruptedFiles(AccountInfo accountInfo)
{
pendingStates.ForEach(Post);
}
}
+#1#
+/*
public void Post(WorkflowState workflowState)
{
if (Log.IsDebugEnabled)
//Remove invalid state
//For now, ignore paths
/* if (Directory.Exists(workflowState.Path))
- return;*/
+ return;#2#
//TODO: Need to handle folder renames
_agent.Post(workflowState);
}
+#1#
}
+*/
}
//[Import]
public FileAgent FileAgent { get; private set; }
+/*
private WorkflowAgent _workflowAgent;
[Import]
//FileAgent.WorkflowAgent = value;
}
}
+*/
[Import]
public NetworkAgent NetworkAgent { get; set; }
//TODO; Warn user?
return;
- WorkflowAgent.StatusNotification = StatusNotification;
+ //WorkflowAgent.StatusNotification = StatusNotification;
StatusNotification.NotifyChange("Starting");
if (_started)
StartNetworkAgent();
- WorkflowAgent.RestartInterruptedFiles(_accountInfo);
+ //WorkflowAgent.RestartInterruptedFiles(_accountInfo);
_started = true;
}
//TODO: The Network and Poll agents are not account specific
//They should be moved outside PithosMonitor
+/*
NetworkAgent.Start();
+*/
PollAgent.AddAccount(_accountInfo);