commit cfed7823a8bd55d0a338f8ffb60e5734f930fb8b
Author: Panagiotis Kanavos <pkanavos@gmail.com>
Date:   Thu Oct 13 23:14:47 2011 +0300

    Added log4net for client profile
    Refactored to allow retrieval of shared objects

diff --git a/trunk/Pithos.Network/ICloudClient.cs b/trunk/Pithos.Network/ICloudClient.cs
index fde14dd..6643ab8 100644
--- a/trunk/Pithos.Network/ICloudClient.cs
+++ b/trunk/Pithos.Network/ICloudClient.cs
@@ -20,29 +20,40 @@ namespace Pithos.Network
         double UploadPercentLimit { get; set; }
         string AuthenticationUrl { get; set; }
 
-
-        IList<ContainerInfo> ListContainers();
-        IList<ObjectInfo> ListObjects(string container,DateTime? since=null);
-        IList<ObjectInfo> ListObjects(string container, string folder, DateTime? since = null); 
-        bool ContainerExists(string container);
-        ContainerInfo GetContainerInfo(string container);
-        void CreateContainer(string container);
-        void DeleteContainer(string container);
+        #region Container operations
         
-        Task GetObject(string container, string objectName, string fileName);
-        Task PutObject(string container, string objectName, string fileName, string hash = null);
-        void DeleteObject(string container, string objectName, string trashContainer);
-        void DeleteObject(string container, string objectName);
-        void MoveObject(string sourceContainer, string oldObjectName, string targetContainer,string newObjectName);
-        bool ObjectExists(string container,string objectName);
-        ObjectInfo GetObjectInfo(string container, string objectName);
-        void CreateFolder(string container, string folder);
-
-
-        Task<TreeHash> GetHashMap(string container, string objectName);
-        Task<IList<string>> PutHashMap(string container, string objectName, TreeHash hash);
-        Task PostBlock(string container,byte[] block,int offset,int count);
-        Task<byte[]> GetBlock(string container, Uri relativeUrl, long start, long? end);
+        IList<ContainerInfo> ListContainers(string account=null);
+        IList<ObjectInfo> ListObjects(string account, string container, DateTime? since = null);
+        IList<ObjectInfo> ListObjects(string account, string container, string folder, DateTime? since = null);
+        bool ContainerExists(string account, string container);
+        ContainerInfo GetContainerInfo(string account, string container);
+        void CreateContainer(string account, string container);
+        void DeleteContainer(string account, string container);
+        #endregion
+
+        #region Object operations        
+        Task GetObject(string account, string container, string objectName, string fileName);
+        Task PutObject(string account, string container, string objectName, string fileName, string hash = null);
+        void DeleteObject(string account, string container, string objectName, string trashContainer);
+        //void DeleteObject(string container, string objectName, string account = null);
+        void MoveObject(string account, string sourceContainer, string oldObjectName, string targetContainer, string newObjectName);
+        bool ObjectExists(string account, string container, string objectName);
+        ObjectInfo GetObjectInfo(string account, string container, string objectName);
+        void CreateFolder(string account, string container, string folder);
+        #endregion
+
+        #region Hashmap operations        
+        Task<TreeHash> GetHashMap(string account, string container, string objectName);
+        Task<IList<string>> PutHashMap(string account, string container, string objectName, TreeHash hash);
+        Task PostBlock(string account, string container, byte[] block, int offset, int count);
+        Task<byte[]> GetBlock(string account, string container, Uri relativeUrl, long start, long? end);
+        #endregion
+
+        #region Sharing operations        
+        IList<ObjectInfo> ListSharedObjects(DateTime? since);
+        void ShareObject(string account, string container, string objectName, string shareTo, bool read, bool write);
+
+        #endregion
     }
 
 
@@ -74,7 +85,7 @@ namespace Pithos.Network
             
         }
 
-        public IList<ContainerInfo> ListContainers()
+        public IList<ContainerInfo> ListContainers(string account=null)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl!=null);            
@@ -82,7 +93,27 @@ namespace Pithos.Network
             return default(IList<ContainerInfo>);
         }
 
-        public IList<ObjectInfo> ListObjects(string container, DateTime? since = null)
+        public IList<ObjectInfo> ListSharedObjects(DateTime? since)
+        {
+            Contract.Requires(!String.IsNullOrWhiteSpace(Token));
+            Contract.Requires(StorageUrl != null);
+
+            return default(IList<ObjectInfo>);
+        }
+
+        public void ShareObject(string account, string container, string objectName, string shareTo, bool read, bool write)
+        {
+            Contract.Requires(!String.IsNullOrWhiteSpace(Token));
+            Contract.Requires(StorageUrl != null);
+            Contract.Requires(!String.IsNullOrWhiteSpace(container));
+            Contract.Requires(!String.IsNullOrWhiteSpace(objectName));
+            Contract.Requires(!String.IsNullOrWhiteSpace(account));
+            Contract.Requires(!String.IsNullOrWhiteSpace(shareTo));
+   
+        }
+
+
+        public IList<ObjectInfo> ListObjects(string account, string container, DateTime? since = null)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl != null);
@@ -91,7 +122,7 @@ namespace Pithos.Network
             return default(IList<ObjectInfo>);
         }
 
-        public IList<ObjectInfo> ListObjects(string container, string folder, DateTime? since = null)
+        public IList<ObjectInfo> ListObjects(string account, string container, string folder, DateTime? since = null)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl != null);
@@ -101,7 +132,7 @@ namespace Pithos.Network
             return default(IList<ObjectInfo>);
         }
 
-        public bool ContainerExists(string container)
+        public bool ContainerExists(string account, string container)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl!=null);
@@ -110,7 +141,7 @@ namespace Pithos.Network
             return default(bool);
         }
 
-        public ContainerInfo GetContainerInfo(string container)
+        public ContainerInfo GetContainerInfo(string account, string container)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl!=null);
@@ -119,21 +150,21 @@ namespace Pithos.Network
             return default(ContainerInfo);
         }
 
-        public void CreateContainer(string container)
+        public void CreateContainer(string account, string container)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl!=null);
             Contract.Requires(!String.IsNullOrWhiteSpace(container));
         }
 
-        public void DeleteContainer(string container)
+        public void DeleteContainer(string account, string container)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl!=null);
             Contract.Requires(!String.IsNullOrWhiteSpace(container));
         }
 
-        public Task GetObject(string container, string objectName, string fileName)
+        public Task GetObject(string account, string container, string objectName, string fileName)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl!=null);
@@ -143,7 +174,7 @@ namespace Pithos.Network
             return default(Task);
         }
 
-        public Task PutObject(string container, string objectName, string fileName, string hash = null)
+        public Task PutObject(string account, string container, string objectName, string fileName, string hash = null)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl!=null);
@@ -154,7 +185,7 @@ namespace Pithos.Network
             return default(Task);
         }
 
-        public void DeleteObject(string container, string objectName, string trashContainer)
+        public void DeleteObject(string account, string container, string objectName, string trashContainer)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl!=null);
@@ -163,7 +194,7 @@ namespace Pithos.Network
             Contract.Requires(!String.IsNullOrWhiteSpace(trashContainer));
         }
 
-        public void DeleteObject(string container, string objectName)
+        public void DeleteObject(string container, string objectName, string account = null)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl!=null);
@@ -171,7 +202,7 @@ namespace Pithos.Network
             Contract.Requires(!String.IsNullOrWhiteSpace(objectName));            
         }
 
-        public void MoveObject(string sourceContainer, string oldObjectName, string targetContainer,string newObjectName)
+        public void MoveObject(string account, string sourceContainer, string oldObjectName, string targetContainer, string newObjectName)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl!=null);
@@ -181,7 +212,7 @@ namespace Pithos.Network
             Contract.Requires(!String.IsNullOrWhiteSpace(newObjectName));
         }
 
-        public bool ObjectExists(string container,string objectName)
+        public bool ObjectExists(string account, string container, string objectName)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl!=null);
@@ -191,7 +222,7 @@ namespace Pithos.Network
             return default(bool);
         }
 
-        public ObjectInfo GetObjectInfo(string container,string objectName)
+        public ObjectInfo GetObjectInfo(string account, string container, string objectName)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl!=null);
@@ -201,7 +232,7 @@ namespace Pithos.Network
             return default(ObjectInfo);
         }
 
-        public void CreateFolder(string container, string folder)
+        public void CreateFolder(string account, string container, string folder)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl != null);
@@ -209,7 +240,7 @@ namespace Pithos.Network
             Contract.Requires(!String.IsNullOrWhiteSpace(folder));            
         }
 
-        public Task<TreeHash> GetHashMap(string container, string objectName)
+        public Task<TreeHash> GetHashMap(string account, string container, string objectName)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl != null);
@@ -219,7 +250,7 @@ namespace Pithos.Network
             return default(Task<TreeHash>);
         }
 
-        public Task<IList<string>> PutHashMap(string container, string objectName, TreeHash hash)
+        public Task<IList<string>> PutHashMap(string account, string container, string objectName, TreeHash hash)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl != null);
@@ -230,7 +261,7 @@ namespace Pithos.Network
             return default(Task<IList<string>>);
         }
 
-        public Task PostBlock(string container,byte[] block,int offset,int count)
+        public Task PostBlock(string account, string container, byte[] block, int offset, int count)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl != null);
@@ -244,7 +275,7 @@ namespace Pithos.Network
             return default(Task);
         }
 
-        public Task<byte[]> GetBlock(string container, Uri relativeUrl, long start, long? end)
+        public Task<byte[]> GetBlock(string account, string container, Uri relativeUrl, long start, long? end)
         {
             Contract.Requires(!String.IsNullOrWhiteSpace(Token));
             Contract.Requires(StorageUrl != null);
@@ -255,16 +286,6 @@ namespace Pithos.Network
 
             return default(Task<byte[]>);
         }
-    }
-
-    public class ContainerInfo
-    {
-        public string Name { get; set; }
-        public long Count { get; set; }
-        public long Bytes { get; set; }
-        public string BlockHash { get; set; }
-        public int BlockSize { get; set; }
 
-        public static ContainerInfo Empty=new ContainerInfo();
     }
 }
