X-Git-Url: https://code.grnet.gr/git/pithos-ms-client/blobdiff_plain/23877270d5f12d2d1717524f7b721a1876dd2b7f..88e2300a132f903fe892721360f12ec0ebb0824a:/trunk/Pithos.Core/Agents/PollAgent.cs diff --git a/trunk/Pithos.Core/Agents/PollAgent.cs b/trunk/Pithos.Core/Agents/PollAgent.cs index d77b835..6d5d89b 100644 --- a/trunk/Pithos.Core/Agents/PollAgent.cs +++ b/trunk/Pithos.Core/Agents/PollAgent.cs @@ -370,8 +370,12 @@ namespace Pithos.Core.Agents select Task>.Factory.StartNew(_ => client.ListObjects(accountInfo.UserName, container.Name, since), container.Name,token)).ToList(); - var listShared = Task>.Factory.StartNew(_ => - client.ListSharedObjects(_knownContainers,since), "shared",token); + var selectiveEnabled = Selectives.IsSelectiveEnabled(accountInfo.AccountKey); + var listShared = selectiveEnabled? + Task>.Factory.StartNew(_ => + client.ListSharedObjects(_knownContainers,since), "shared",token) + :Task.Factory.FromResult((IList) new List(),"shared"); + listObjects.Add(listShared); var listTasks = await Task.Factory.WhenAll(listObjects.ToArray()).ConfigureAwait(false); @@ -446,14 +450,18 @@ namespace Pithos.Core.Agents var files = LoadLocalFileTuples(accountInfo, accountBatch); - var states = StatusKeeper.GetAllStates(); - + + //WARNING: GetFileSystemInfo may create state entries. + //TODO: Find a different way to create the tuples and block long filenames var infos = (from remote in currentRemotes let path = remote.RelativeUrlToFilePath(accountInfo.UserName) let info=agent.GetFileSystemInfo(path) + where info != null select Tuple.Create(info.FullName,remote)) .ToList(); + var states = StatusKeeper.GetAllStates(); + var tupleBuilder = new TupleBuilder(CancellationToken,StatusKeeper,StatusNotification,Settings); var tuples = tupleBuilder.MergeSources(infos, files, states,moves).ToList(); @@ -762,7 +770,7 @@ namespace Pithos.Core.Agents var action = new CloudUploadAction(accountInfo, localInfo, tuple.FileState, accountInfo.BlockSize, accountInfo.BlockHash, "Poll", isUnselectedRootFolder, token, progress,tuple.Merkle); - + using (StatusNotification.GetNotifier("Uploading {0}", "Uploaded {0}",true, localInfo.Name)) { @@ -788,9 +796,6 @@ namespace Pithos.Core.Agents private async Task MoveForLocalMove(AccountInfo accountInfo, StateTuple tuple) { - //Is the file a directory or previous path missing? - if (tuple.FileInfo is DirectoryInfo) - return false; //Is the previous path missing? if (String.IsNullOrWhiteSpace(tuple.OldFullPath)) return false; @@ -812,6 +817,7 @@ namespace Pithos.Core.Agents var client = new CloudFilesClient(accountInfo); var objectInfo = CloudAction.CreateObjectInfoFor(accountInfo, tuple.FileInfo); + objectInfo.X_Object_Hash = tuple.Merkle.TopHash.ToHashString(); var containerPath = Path.Combine(accountInfo.AccountPath, objectInfo.Container.ToUnescapedString()); //TODO: SImplify these multiple conversions from and to Uris var oldName = tuple.OldFullPath.AsRelativeTo(containerPath); @@ -820,6 +826,9 @@ namespace Pithos.Core.Agents { await client.MoveObject(objectInfo.Account, objectInfo.Container, oldName.Replace('\\','/').ToEscapedUri(), objectInfo.Container, objectInfo.Name).ConfigureAwait(false); + StatusKeeper.MoveFileState(tuple.OldFullPath, tuple.FilePath, objectInfo, tuple.Merkle); + //StatusKeeper.StoreInfo(tuple.FilePath,objectInfo,tuple.Merkle); + //StatusKeeper.ClearFolderStatus(tuple.FilePath); } return true; }