New SQLite version
[pithos-ms-client] / trunk / Pithos.Core / Agents / BlockUpdater.cs
index 3eff1c6..7e8221b 100644 (file)
@@ -55,6 +55,23 @@ namespace Pithos.Core.Agents
 {
     class BlockUpdater
     {
+        //TODO: Must clean orphaned blocks from the Cache folder.
+        //
+        //The Cache folder may have orphaned blocks. Blocks may be left in the Cache folder because:
+        //1. A download was in progress when the application terminated. These blocks are needed to proceed 
+        //  with partial download
+        //2. The application terminated abnormally before the blocks were cleared after a download
+        //3. The server file was deleted before the download completed.
+        //
+        //In #1, we need to keep the blocks. We need to detect the other cases and delete orphans
+        //
+        //Mitigations:
+        // - Delete blocks with no corresponding state
+        // - Check and delete possible orphans when a Deletion is detected
+        // - Add Advanced command "Clear Cache"
+        //
+        //Need a better way to differentiate between cases #2, #3 and #1
+
         private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 
         public string FilePath { get; private set; }