Revision 99e6329f trunk/Pithos.Network/CloudFilesClient.cs
b/trunk/Pithos.Network/CloudFilesClient.cs | ||
---|---|---|
46 | 46 |
|
47 | 47 |
|
48 | 48 |
using System; |
49 |
using System.Collections; |
|
49 | 50 |
using System.Collections.Generic; |
50 | 51 |
using System.Collections.Specialized; |
51 | 52 |
using System.ComponentModel.Composition; |
... | ... | |
317 | 318 |
using (ThreadContext.Stacks["Share"].Push("List Objects")) |
318 | 319 |
{ |
319 | 320 |
if (Log.IsDebugEnabled) Log.DebugFormat("START"); |
320 |
|
|
321 |
var accounts = ListSharingAccounts(since); |
|
321 |
//'since' is not used here because we need to have ListObjects return a NoChange result |
|
322 |
//for all shared accounts,containers |
|
323 |
var accounts = ListSharingAccounts(); |
|
322 | 324 |
var items = from account in accounts |
323 | 325 |
let containers = ListContainers(account.name) |
324 | 326 |
from container in containers |
325 |
select ListObjects(account.name, container.Name); |
|
327 |
select ListObjects(account.name, container.Name,since);
|
|
326 | 328 |
var objects=items.SelectMany(r=> r).ToList(); |
327 | 329 |
/* |
328 | 330 |
var objects = new List<ObjectInfo>(); |
... | ... | |
605 | 607 |
|
606 | 608 |
client.AssertStatusOK("ListObjects failed"); |
607 | 609 |
|
608 |
//HACK: Must add it to all other operations as well
|
|
609 |
StatusCode = client.StatusCode;
|
|
610 |
if (client.StatusCode==HttpStatusCode.NotModified)
|
|
611 |
return new[]{new NoModificationInfo(account,container)};
|
|
610 | 612 |
//If the result is empty, return an empty list, |
611 | 613 |
var infos = String.IsNullOrWhiteSpace(content) |
612 | 614 |
? new List<ObjectInfo>() |
... | ... | |
625 | 627 |
} |
626 | 628 |
} |
627 | 629 |
|
628 |
public HttpStatusCode StatusCode { get; set; } |
|
629 |
|
|
630 |
|
|
631 | 630 |
public IList<ObjectInfo> ListObjects(string account, string container, string folder, DateTime? since = null) |
632 | 631 |
{ |
633 | 632 |
if (String.IsNullOrWhiteSpace(container)) |
... | ... | |
654 | 653 |
var content = client.DownloadStringWithRetry(container, 3); |
655 | 654 |
client.AssertStatusOK("ListObjects failed"); |
656 | 655 |
|
656 |
if (client.StatusCode==HttpStatusCode.NotModified) |
|
657 |
return new[]{new NoModificationInfo(account,container,folder)}; |
|
658 |
|
|
657 | 659 |
var infos = JsonConvert.DeserializeObject<IList<ObjectInfo>>(content); |
658 | 660 |
foreach (var info in infos) |
659 | 661 |
{ |
Also available in: Unified diff