Documentation ¶
Index ¶
- Constants
- func MultipartUploadInternalError() *objectstore.CompleteMultipartUploadError
- type ObjectstoreStub
- func (o *ObjectstoreStub) DeletesCnt() int
- func (o *ObjectstoreStub) GetHeader(path, key string) string
- func (o *ObjectstoreStub) GetObjectMD5(path string) string
- func (o *ObjectstoreStub) InitiateMultipartUpload(path string) error
- func (o *ObjectstoreStub) IsMultipartUpload(path string) bool
- func (o *ObjectstoreStub) PutsCnt() int
- func (o *ObjectstoreStub) ServeHTTP(w http.ResponseWriter, r *http.Request)
Constants ¶
const ( // ObjectContent an example textual content ObjectContent = "TEST OBJECT CONTENT" // ObjectSize is the ObjectContent size ObjectSize = int64(len(ObjectContent)) // Objectpath is an example remote object path (including bucket name) ObjectPath = "/bucket/object" // ObjectMD5 is ObjectContent MD5 hash ObjectMD5 = "42d000eea026ee0760677e506189cb33" // ObjectSHA1 is ObjectContent SHA1 hash ObjectSHA1 = "173cfd58c6b60cb910f68a26cbb77e3fc5017a6d" // ObjectSHA256 is ObjectContent SHA256 hash ObjectSHA256 = "b0257e9e657ef19b15eed4fbba975bd5238d651977564035ef91cb45693647aa" // ObjectSHA512 is ObjectContent SHA512 hash ObjectSHA512 = "" /* 128-byte string literal not displayed */ )
Some usefull const for testing purpose
Variables ¶
This section is empty.
Functions ¶
func MultipartUploadInternalError ¶
func MultipartUploadInternalError() *objectstore.CompleteMultipartUploadError
Types ¶
type ObjectstoreStub ¶
type ObjectstoreStub struct {
// contains filtered or unexported fields
}
ObjectstoreStub is a testing implementation of ObjectStore. Instead of storing objects it will just save md5sum.
func StartObjectStore ¶
func StartObjectStore() (*ObjectstoreStub, *httptest.Server)
StartObjectStore will start an ObjectStore stub
func StartObjectStoreWithCustomMD5 ¶
func StartObjectStoreWithCustomMD5(md5Hashes map[string]string) (*ObjectstoreStub, *httptest.Server)
StartObjectStoreWithCustomMD5 will start an ObjectStore stub: md5Hashes contains overwrites for md5sum that should be return on PutObject
func (*ObjectstoreStub) DeletesCnt ¶
func (o *ObjectstoreStub) DeletesCnt() int
DeletesCnt counts DeleteObject invocation of a valid object
func (*ObjectstoreStub) GetHeader ¶
func (o *ObjectstoreStub) GetHeader(path, key string) string
GetHeader returns a given HTTP header of the object uploaded to the path
func (*ObjectstoreStub) GetObjectMD5 ¶
func (o *ObjectstoreStub) GetObjectMD5(path string) string
GetObjectMD5 return the calculated MD5 of the object uploaded to path it will return an empty string if no object has been uploaded on such path
func (*ObjectstoreStub) InitiateMultipartUpload ¶
func (o *ObjectstoreStub) InitiateMultipartUpload(path string) error
InitiateMultipartUpload prepare the ObjectstoreStob to receive a MultipartUpload on path It will return an error if a MultipartUpload is already in progress on that path InitiateMultipartUpload is only used during test setup. Workhorse's production code does not know how to initiate a multipart upload.
Real S3 multipart uploads are more complicated than what we do here, but this is enough to verify that workhorse's production code behaves as intended.
func (*ObjectstoreStub) IsMultipartUpload ¶
func (o *ObjectstoreStub) IsMultipartUpload(path string) bool
IsMultipartUpload check if the given path has a MultipartUpload in progress
func (*ObjectstoreStub) PutsCnt ¶
func (o *ObjectstoreStub) PutsCnt() int
PutsCnt counts PutObject invocations
func (*ObjectstoreStub) ServeHTTP ¶
func (o *ObjectstoreStub) ServeHTTP(w http.ResponseWriter, r *http.Request)