openstackrackspace-cloudrackspacecloudfilesopenstacknetsdk

OpenStack Rackspace Cloud Files .net SDK


I am trying to save an XML file to a non CDN Container from Sydney:

public void Save(XDocument document)
{
    using (MemoryStream ms = new MemoryStream())
    {
        document.Save(ms);
        ms.Position = 0;

        RackspaceCloudIdentity identity = new RackspaceCloudIdentity { Username = "username", APIKey = "xxxxxxxxxxx", CloudInstance = CloudInstance.Default };
        CloudFilesProvider provider = new CloudFilesProvider(identity);

        provider.CreateObject("XMLFiles", ms, "xmlFile1.xml", region: "syd");
    }
}

For a 1MB file, it takes about 50 seconds to upload (very long).

And, trying to download the file back, returns an empty result:

public void Read()
{
    RackspaceCloudIdentity identity = new RackspaceCloudIdentity { Username = "username", APIKey = "xxxxxxxxxxx", CloudInstance = CloudInstance.Default };
    CloudFilesProvider provider = new CloudFilesProvider(identity);

    using (MemoryStream ms = new MemoryStream())
    {
        provider.GetObject("XMLFiles", "xmlFile1.xml", ms, region: "syd");

        // ms.Length is 0
    }
}

I am doing something wrong?


Solution

  • Ugh. I introduced this bug in commit 799f37c (first released in v1.1.3.0). I'm looking into the best workaround right now.

    Edit: There is no workaround, but I filed issue #116 for the issue, and after the pull request for it is merged, we'll release version 1.1.3.1 of the library to correct the problem.