Occasional mysterious errors renaming files using C# SDK

Last post 06-07-2008 4:27 PM by BarryR. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-07-2008 3:44 PM

    • baron
    • Top 25 Contributor
    • Joined on 06-07-2008
    • Posts 14

    Occasional mysterious errors renaming files using C# SDK

    Greetings. I am developing an application that uses Nirvanix as the back end to an already existing backup application.

    The sequence of event is:

     

    1. Create Nirvanix directory. Done using the root folder from Session.

    • IE Folder f = Sesssion.GetFolder("/",1,500, 0,false) .
    • f.CreateFolders(new string [] { foldername});
    This returns with no error (no exception)

    2. Write data into temporary name in directory (done using httpupload ).
    This is a custom method I implemented (cloned from existing SDK code),

    • string path = "/tmp/uploaddir";
    • string name = "junk.tmp";
    • string fullpath = "/tmp/uploaddr/junk.tmp"; 
    • Uploader uploader = m_session.GetFileUploader(dirpath);
    • uploader.PerformHTTPUploadFromStream(name, fullpath , stream) ;

    This also returns without error.

    Finally, it's time to rename the file to the proper name:

    • string newname = "therealname.txt";
    • IMFS myimfs = new IMFS();
    •  mymfs.RenameFile(m_sessiontoken, fullpath, newname);

    This works about 99% of the time on a slow connecton and about 90% of the time on a fast connection.

     The exception thrown is always "Invalid path", as if the remote directory does not exist.

     
    Am I doing something obviously wrong?

     

    Thanks,

    JP
     

     


     



     

  • 06-07-2008 4:27 PM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 612

    Re: Occasional mysterious errors renaming files using C# SDK

     I'm not sure what your uploader is doing internally but the SDK uses a thread to handle uploads.  There is a delegate that is called when the upload has been completed.  Be sure if you are using a thread that the upload has completed since this could be the source of your problem.  Optionally you could use the Upload Callback to let you know when our system has added the file.  If you base the rename off of the callback you can be assured the file has been successfully uploaded to our system.

    Regards,
        Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
Page 1 of 1 (2 items)