model.go 1.3 KB

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