* Use GetObject instead of HeadObject to locate incomplete part
This avoids confusion around the errors that are returned by HeadObject, especially when the request has limited permissions for the bucket.
* Remove unused HeadObject function
* Add DeleteObject to S3API interface
* Use DeleteObject to remove .part objects
* Update tests
Previously, some data would be discarded if the user pauseed the upload.
Pausing causes the connection to be interrupted which makes Go's
net/http return an io.ErrUnexpectedEOF.
Before https://github.com/tus/tusd/pull/219 from @acj this would
not be noticed since data is discarded anyway. However, after this
PR, every byte can now be saved on S3 even if we don't have enough
data for a multipart upload part.
* Handle "NotFound" error code from HeadObject
This accommodates third party implementations of the S3 interface, such as Minio, that may return a different error string.
* Check NotFound error string in test
This also fixes an incorrect return value.
* Add HeadObject function to S3API
* Regenerate S3API mock
* Include incomplete part size in the offset
* Add CRUD functions for managing incomplete parts
* Account for incomplete parts in S3Store's Terminate
* Account for incomplete parts in S3Store's WriteChunk
* Factor out writeInfo function
* Declare support for deferred length in S3Store
* Add test for S3Store's DeclareLength
* Adapt S3Store tests to new implementation
* Add PutObjectInputMatcher test helper
* Add test for prepending incomplete parts
* Add GetInfo test for incomplete parts
* Update S3Store docs
* Consistently handle NoSuchKey errors from S3
* Handle both 403 and 404 responses from HeadObject
If the IAM role doesn't have permission to list the contents of the bucket, then HEAD requests will return 403 for nonexistent objects.
This makes it easier to reason about tusd's run environment. It also
significantly lowers the docker image size from 280MB for the current 0.11.0
image to only 26MB. Also not having the entire build environment in the
shipped images makes it quite attractive to use this image as a base
for other images. Those could contain some custom hooks for example.
* Add ObjectPrefix field to S3Store
* Integrate S3ObjectPrefix with Flags
* Account for S3ObjectPrefix flag in CreateComposer
* Account for ObjectPrefix in S3Store operations
* Add test for configuring an S3Store with ObjectPrefix
* First pass at etcd3 locker
* Add etcd packages to vendor ignore attribute
* Properly exclude etcd3locker from earlier versions of golang
* Etcd test to only run on go1.9 and go1.10
* Do not export internal etcd3locker methods
* context.TODO -> context.Background
* Return errors instead of logging
* Enforce a 1.5s timeout on acquiring a lease from etcd
* Allow etcd3 concurreny.NewSession manage KeepAlive connection
- Introduce LockerOptions to allow a custom session TTL (default: 60s); etcd3Locker can be initialized with NewWithLockerOptions if one wants granular control over TTL and prefix used for etcd3 keys
- Keep NewWithPrefix backwards compatible by calling NewWithLockerOptions
* Add comment on locker_test.go regarding testing the session KeepAlive
* Re-export main type
* Try to address missing github.com/gogo/protobuf/gogoproto package
* Update etcd package import to use go.etcd.io/etcd/clientv3
* Use forked go-etcd-harness for testing
* Add more extensive package overview / docs
* go fmt
* Fix test script
* Add downloaded etcd binary to path