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
22// Close close http reponse body
23func (r *Response) Close() error {
24	return r.Body.Close()
25}
26
27// PutObjectRequest is the request of DoPutObject
28type PutObjectRequest struct {
29	ObjectKey string
30	Reader    io.Reader
31}
32
33// GetObjectRequest is the request of DoGetObject
34type GetObjectRequest struct {
35	ObjectKey string
36}
37
38// GetObjectResult is the result of DoGetObject
39type GetObjectResult struct {
40	Response  *Response
41	ClientCRC hash.Hash64
42	ServerCRC uint64
43}
44
45// AppendObjectRequest is the requtest of DoAppendObject
46type AppendObjectRequest struct {
47	ObjectKey string
48	Reader    io.Reader
49	Position  int64
50}
51
52// AppendObjectResult is the result of DoAppendObject
53type AppendObjectResult struct {
54	NextPosition int64
55	CRC          uint64
56}
57
58// UploadPartRequest is the request of DoUploadPart
59type UploadPartRequest struct {
60	InitResult *InitiateMultipartUploadResult
61	Reader     io.Reader
62	PartSize   int64
63	PartNumber int
64}
65
66// UploadPartResult is the result of DoUploadPart
67type UploadPartResult struct {
68	Part UploadPart
69}
70