Revision 026a6c5a trunk/Pithos.Core/Agents/PollAgent.cs

b/trunk/Pithos.Core/Agents/PollAgent.cs
628 628
            SnapshotDifferencer differencer;
629 629
            _differencer.Differencers.TryRemove(accountInfo.AccountKey, out differencer);
630 630
        }
631

  
632
        public void SetSelectivePaths(AccountInfo accountInfo,Uri[] added, Uri[] removed)
633
        {
634
            AbortRemovedPaths(accountInfo,removed);
635
            DownloadNewPaths(accountInfo,added);
636
        }
637

  
638
        private void DownloadNewPaths(AccountInfo accountInfo, Uri[] added)
639
        {
640
            var client = new CloudFilesClient(accountInfo);
641
            foreach (var folderUri in added)
642
            {
643
                string account;
644
                string container;
645
                var segmentsCount = folderUri.Segments.Length;
646
                if (segmentsCount < 3)
647
                    continue;
648
                if (segmentsCount==3)
649
                {
650
                    account = folderUri.Segments[1].TrimEnd('/');
651
                    container = folderUri.Segments[2].TrimEnd('/');                    
652
                }
653
                else
654
                {
655
                    account = folderUri.Segments[2].TrimEnd('/');
656
                    container = folderUri.Segments[3].TrimEnd('/');                    
657
                }
658
                IList<ObjectInfo> items;
659
                if(segmentsCount>3)
660
                {
661
                    var folder =String.Join("", folderUri.Segments.Splice(4));
662
                    items = client.ListObjects(account, container, folder);
663
                }
664
                else
665
                {
666
                    items = client.ListObjects(account, container);
667
                }
668
                var actions=CreatesToActions(accountInfo, items);
669
                foreach (var action in actions)
670
                {
671
                    NetworkAgent.Post(action);    
672
                }                
673
            }
674

  
675
            //Need to get a listing of each of the URLs, then post them to the NetworkAgent
676
            //CreatesToActions(accountInfo,)
677

  
678
/*            NetworkAgent.Post();*/
679
        }
680

  
681
        private void AbortRemovedPaths(AccountInfo accountInfo, Uri[] removed)
682
        {
683
            /*this.NetworkAgent.*/
684
        }
631 685
    }
632 686
}

Also available in: Unified diff