Permalink
Browse files

made blob compression an option rather than a debug symbol

  • Loading branch information...
1 parent 80f644e commit d7d4352e7ad11249f5b9582e7d97717640f41453 @richorama richorama committed Nov 25, 2013
Showing with 6 additions and 26 deletions.
  1. +6 −26 AzureDirectory/AzureDirectory.cs
@@ -15,23 +15,7 @@ public class AzureDirectory : Directory
private CloudBlobContainer _blobContainer;
private Directory _cacheDirectory;
- public AzureDirectory(CloudStorageAccount storageAccount) :
- this(storageAccount, null, null)
- {
- }
-
- /// <summary>
- /// Create AzureDirectory
- /// </summary>
- /// <param name="storageAccount">staorage account to use</param>
- /// <param name="catalog">name of catalog (folder in blob storage)</param>
- /// <remarks>Default local cache is to use file system in user/appdata/AzureDirectory/Catalog</remarks>
- public AzureDirectory(
- CloudStorageAccount storageAccount,
- string catalog)
- : this(storageAccount, catalog, null)
- {
- }
+
/// <summary>
/// Create an AzureDirectory
@@ -41,8 +25,9 @@ public class AzureDirectory : Directory
/// <param name="cacheDirectory">local Directory object to use for local cache</param>
public AzureDirectory(
CloudStorageAccount storageAccount,
- string catalog,
- Directory cacheDirectory)
+ string catalog = null,
+ Directory cacheDirectory = null,
+ bool compressBlobs = false)
{
if (storageAccount == null)
throw new ArgumentNullException("storageAccount");
@@ -54,6 +39,7 @@ public class AzureDirectory : Directory
_blobClient = storageAccount.CreateCloudBlobClient();
_initCacheDirectory(cacheDirectory);
+ this.CompressBlobs = compressBlobs;
}
public CloudBlobContainer BlobContainer
@@ -64,13 +50,12 @@ public CloudBlobContainer BlobContainer
}
}
-#if COMPRESSBLOBS
public bool CompressBlobs
{
get;
set;
}
-#endif
+
public void ClearCache()
{
foreach (string file in _cacheDirectory.ListAll())
@@ -93,9 +78,6 @@ public Directory CacheDirectory
private void _initCacheDirectory(Directory cacheDirectory)
{
-#if COMPRESSBLOBS
- CompressBlobs = true;
-#endif
if (cacheDirectory != null)
{
// save it off
@@ -263,7 +245,6 @@ protected override void Dispose(bool disposing)
_blobClient = null;
}
-#if COMPRESSBLOBS
public virtual bool ShouldCompressFile(string path)
{
if (!CompressBlobs)
@@ -288,7 +269,6 @@ public virtual bool ShouldCompressFile(string path)
return false;
};
}
-#endif
public StreamInput OpenCachedInputAsStream(string name)
{
return new StreamInput(CacheDirectory.OpenInput(name));

0 comments on commit d7d4352

Please sign in to comment.