Synch seems OK. Identified problem with poll differencer
authorPanagiotis Kanavos <pkanavos@gmail.com>
Wed, 22 Feb 2012 16:55:20 +0000 (18:55 +0200)
committerPanagiotis Kanavos <pkanavos@gmail.com>
Wed, 22 Feb 2012 16:55:20 +0000 (18:55 +0200)
trunk/Pithos.Client.WPF/SelectiveSynch/SelectiveSynchViewModel.cs
trunk/Pithos.Core/Agents/PollAgent.cs
trunk/Pithos.Network/CloudFilesClient.cs

index c354066..ab9e655 100644 (file)
@@ -152,16 +152,13 @@ namespace Pithos.Client.WPF.SelectiveSynch
                                    DisplayName = AccountName ,
                                    Directories = ownFolders.ToList()
                                };
-            
+
+            this.RootNodes.Add(rootItem);
+            this.RootNodes.Add(othersNode);
 
             SetInitialSelections(Account);
             
-            Execute.OnUIThread(()=>
-                                   {
-                                       this.RootNodes.Add(rootItem);
-                                       this.RootNodes.Add(othersNode);
-                                       IsBusy = false;
-                                   });
+            IsBusy = false;
         }
 
         public bool IsBusy
@@ -184,7 +181,7 @@ namespace Pithos.Client.WPF.SelectiveSynch
             
             var selects = from rootRecord in RootNodes
                           from record in rootRecord
-                          where record.ObjectInfo!=null &&  selections.Contains(record.ObjectInfo.Name)
+                          where record.Uri !=null &&  selections.Contains(record.Uri.ToString())
                           select record;
 
             selects.Apply(record=>record.IsChecked=true);
index 28308f6..fc8a5a6 100644 (file)
@@ -212,7 +212,9 @@ namespace Pithos.Core.Agents
                     var listObjects = (from container in containers\r
                                        select Task<IList<ObjectInfo>>.Factory.StartNew(_ =>\r
                                              client.ListObjects(accountInfo.UserName, container.Name, since), container.Name)).ToList();\r
-\r
+                    //BUG: Can't detect difference between no changes or no objects\r
+                    //ListObjects returns nothing if there are no changes since the last check time (since value)                    \r
+                    //TODO: Must detect the difference between no server objects an\r
                     var listShared = Task<IList<ObjectInfo>>.Factory.StartNew(_ => client.ListSharedObjects(since), "shared");\r
                     listObjects.Add(listShared);\r
                     var listTasks = await Task.Factory.WhenAll(listObjects.ToArray());\r
index 3433984..2d25aa9 100644 (file)
@@ -318,17 +318,19 @@ namespace Pithos.Network
             {
                 if (Log.IsDebugEnabled) Log.DebugFormat("START");
 
-                var objects = new List<ObjectInfo>();
                 var accounts = ListSharingAccounts(since);
-                foreach (var account in accounts)
+                var items = from account in accounts 
+                            let containers = ListContainers(account.name) 
+                            from container in containers 
+                            select ListObjects(account.name, container.Name);
+                var objects=items.SelectMany(r=> r).ToList();
+/*
+                var objects = new List<ObjectInfo>();
+                foreach (var containerObjects in items)
                 {
-                    var containers = ListContainers(account.name);
-                    foreach (var container in containers)
-                    {
-                        var containerObjects = ListObjects(account.name, container.Name);
-                        objects.AddRange(containerObjects);
-                    }
+                    objects.AddRange(containerObjects);
                 }
+*/
                 if (Log.IsDebugEnabled) Log.DebugFormat("END");
                 return objects;
             }
@@ -603,6 +605,8 @@ namespace Pithos.Network
 
                     client.AssertStatusOK("ListObjects failed");
 
+                    //HACK: Must add it to all other operations as well
+                    StatusCode = client.StatusCode;
                     //If the result is empty, return an empty list,
                     var infos = String.IsNullOrWhiteSpace(content)
                                     ? new List<ObjectInfo>()
@@ -615,12 +619,13 @@ namespace Pithos.Network
                         info.Account = account;
                         info.StorageUri = this.StorageUrl;
                     }
-                    if (Log.IsDebugEnabled) Log.DebugFormat("START");
+                    if (Log.IsDebugEnabled) Log.DebugFormat("END");
                     return infos;
                 }
             }
         }
 
+        public HttpStatusCode StatusCode { get; set; }
 
 
         public IList<ObjectInfo> ListObjects(string account, string container, string folder, DateTime? since = null)