From e8b96ada1193d1639670a80b31c7aa4499fa4096 Mon Sep 17 00:00:00 2001 From: Jim Ma Date: Mon, 16 Jan 2023 16:15:11 +0800 Subject: [PATCH] fix: dfstore typo (#2000) Signed-off-by: Jim Ma --- client/dfstore/dfstore.go | 16 ++++++++-------- client/dfstore/mocks/dfstore_mock.go | 4 ++-- cmd/dfstore/cmd/copy.go | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/client/dfstore/dfstore.go b/client/dfstore/dfstore.go index 00eaf937b..907c6c2ba 100644 --- a/client/dfstore/dfstore.go +++ b/client/dfstore/dfstore.go @@ -52,10 +52,10 @@ type Dfstore interface { GetObjectWithContext(ctx context.Context, input *GetObjectInput) (io.ReadCloser, error) // PutObjectRequestWithContext returns *http.Request of putting object. - PutObjectRequestWithContext(ctx context.Context, input *PutOjectInput) (*http.Request, error) + PutObjectRequestWithContext(ctx context.Context, input *PutObjectInput) (*http.Request, error) // PutObjectWithContext puts data of object. - PutObjectWithContext(ctx context.Context, input *PutOjectInput) error + PutObjectWithContext(ctx context.Context, input *PutObjectInput) error // DeleteObjectRequestWithContext returns *http.Request of deleting object. DeleteObjectRequestWithContext(ctx context.Context, input *DeleteObjectInput) (*http.Request, error) @@ -257,8 +257,8 @@ func (dfs *dfstore) GetObjectWithContext(ctx context.Context, input *GetObjectIn return resp.Body, nil } -// PutOjectInput is used to construct request of putting object. -type PutOjectInput struct { +// PutObjectInput is used to construct request of putting object. +type PutObjectInput struct { // BucketName is bucket name. BucketName string @@ -282,8 +282,8 @@ type PutOjectInput struct { Reader io.Reader } -// Validate validates PutOjectInput fields. -func (i *PutOjectInput) Validate() error { +// Validate validates PutObjectInput fields. +func (i *PutObjectInput) Validate() error { if i.BucketName == "" { return errors.New("invalid BucketName") @@ -305,7 +305,7 @@ func (i *PutOjectInput) Validate() error { } // PutObjectRequestWithContext returns *http.Request of putting object. -func (dfs *dfstore) PutObjectRequestWithContext(ctx context.Context, input *PutOjectInput) (*http.Request, error) { +func (dfs *dfstore) PutObjectRequestWithContext(ctx context.Context, input *PutObjectInput) (*http.Request, error) { if err := input.Validate(); err != nil { return nil, err } @@ -360,7 +360,7 @@ func (dfs *dfstore) PutObjectRequestWithContext(ctx context.Context, input *PutO } // PutObjectWithContext puts data of object. -func (dfs *dfstore) PutObjectWithContext(ctx context.Context, input *PutOjectInput) error { +func (dfs *dfstore) PutObjectWithContext(ctx context.Context, input *PutObjectInput) error { req, err := dfs.PutObjectRequestWithContext(ctx, input) if err != nil { return err diff --git a/client/dfstore/mocks/dfstore_mock.go b/client/dfstore/mocks/dfstore_mock.go index 75e7fec94..414efe7a8 100644 --- a/client/dfstore/mocks/dfstore_mock.go +++ b/client/dfstore/mocks/dfstore_mock.go @@ -158,7 +158,7 @@ func (mr *MockDfstoreMockRecorder) IsObjectExistWithContext(ctx, input interface } // PutObjectRequestWithContext mocks base method. -func (m *MockDfstore) PutObjectRequestWithContext(ctx context.Context, input *dfstore.PutOjectInput) (*http.Request, error) { +func (m *MockDfstore) PutObjectRequestWithContext(ctx context.Context, input *dfstore.PutObjectInput) (*http.Request, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "PutObjectRequestWithContext", ctx, input) ret0, _ := ret[0].(*http.Request) @@ -173,7 +173,7 @@ func (mr *MockDfstoreMockRecorder) PutObjectRequestWithContext(ctx, input interf } // PutObjectWithContext mocks base method. -func (m *MockDfstore) PutObjectWithContext(ctx context.Context, input *dfstore.PutOjectInput) error { +func (m *MockDfstore) PutObjectWithContext(ctx context.Context, input *dfstore.PutObjectInput) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "PutObjectWithContext", ctx, input) ret0, _ := ret[0].(error) diff --git a/cmd/dfstore/cmd/copy.go b/cmd/dfstore/cmd/copy.go index c3b1e23ab..fd5b45f52 100644 --- a/cmd/dfstore/cmd/copy.go +++ b/cmd/dfstore/cmd/copy.go @@ -199,7 +199,7 @@ func copyLocalFileToObjectStorage(ctx context.Context, cfg *config.DfstoreConfig ) tr := io.TeeReader(f, bar) - if err := dfstore.New(cfg.Endpoint).PutObjectWithContext(ctx, &dfstore.PutOjectInput{ + if err := dfstore.New(cfg.Endpoint).PutObjectWithContext(ctx, &dfstore.PutObjectInput{ BucketName: bucketName, ObjectKey: objectKey, Filter: cfg.Filter,