go-dropbox icon indicating copy to clipboard operation
go-dropbox copied to clipboard

Implemented upload session APIs (multi-part uploads)

Open jpillora opened this issue 8 years ago • 7 comments

Changes

  • implemented upload session APIs (multi-part uploads)
  • ~~implemented auto-handled upload session method UploadSession()~~ (see go-dropy)
  • renamed internal download() to content() ("Content-upload endpoints" and "Content-download endpoints")
  • added internal decodeContent() helper
  • fixed PermanentlyDelete endpoint path (not sure if it was incorrect on purpose?)

Notes

  1. Methods should probably use value parameters, as pointer parameters allow property changes after the call has been made. Also, it's good practise to use values where possible. However, I thought it was more important to follow the current method layout.
  2. As an alternate API to reduce the size of files.go, the raw upload session methods (start/append/finish) could be moved to files_upload_session.go and then would become Files.UploadSession.Start(), .Append(), .Finish() - though we'd have to rename UploadSession() to something else.
  3. As an additional feature, we could add a PerformRetries bool so if any chunk failed, it would be retransmitted. This would require a ChunkSize buffer though to hold data in case of failure and maybe the Dropbox API doesn't fail that often so it might not be worth it...

jpillora avatar Jul 16 '16 12:07 jpillora

# cd .; git clone https://github.com/davecgh/go-spew /home/runner/workspace/src/github.com/davecgh/go-spew
Cloning into '/home/runner/workspace/src/github.com/davecgh/go-spew'...
error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.

Strange failure, maybe manually retry?

jpillora avatar Jul 16 '16 12:07 jpillora

Ah yes, just remembered https://github.com/tj/go-dropbox/issues/2. So maybe the higher-level UploadSession() should go in go-dropy?

jpillora avatar Jul 16 '16 17:07 jpillora

niceee, yea as much as possible I think the fancier stuff should be in go-dropy

tj avatar Jul 17 '16 17:07 tj

Striped out high-level UploadSession() method, moved to go-dropy, see jpillora/go-dropy@5eee26d - Will PR it over there once this lands.

jpillora avatar Jul 18 '16 00:07 jpillora

Adding new test with manually managed session upload...

jpillora avatar Jul 18 '16 01:07 jpillora

Semaphore seems to be a bit buggy, https://semaphoreci.com/tj/go-dropbox/branches/pull-request-18/builds/4 also failed strangely

jpillora avatar Jul 18 '16 02:07 jpillora

I'll sync with upstream again once #17 tests are fixed

jpillora avatar Jul 22 '16 04:07 jpillora