1package oss 2 3import ( 4 "hash" 5 "io" 6 "net/http" 7) 8 9// Response defines HTTP response from OSS 10type Response struct { 11 StatusCode int 12 Headers http.Header 13 Body io.ReadCloser 14 ClientCRC uint64 15 ServerCRC uint64 16} 17 18func (r *Response) Read(p []byte) (n int, err error) { 19 return r.Body.Read(p) 20} 21 22func (r *Response) Close() error { 23 return r.Body.Close() 24} 25 26// PutObjectRequest is the request of DoPutObject 27type PutObjectRequest struct { 28 ObjectKey string 29 Reader io.Reader 30} 31 32// GetObjectRequest is the request of DoGetObject 33type GetObjectRequest struct { 34 ObjectKey string 35} 36 37// GetObjectResult is the result of DoGetObject 38type GetObjectResult struct { 39 Response *Response 40 ClientCRC hash.Hash64 41 ServerCRC uint64 42} 43 44// AppendObjectRequest is the requtest of DoAppendObject 45type AppendObjectRequest struct { 46 ObjectKey string 47 Reader io.Reader 48 Position int64 49} 50 51// AppendObjectResult is the result of DoAppendObject 52type AppendObjectResult struct { 53 NextPosition int64 54 CRC uint64 55} 56 57// UploadPartRequest is the request of DoUploadPart 58type UploadPartRequest struct { 59 InitResult *InitiateMultipartUploadResult 60 Reader io.Reader 61 PartSize int64 62 PartNumber int 63} 64 65// UploadPartResult is the result of DoUploadPart 66type UploadPartResult struct { 67 Part UploadPart 68} 69