Skip to content

Commit

Permalink
Hound fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Jun 22, 2021
1 parent 1adaf24 commit ae3905f
Showing 1 changed file with 25 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import (
)

//go:generate mockery -name GatewayClient

// GatewayClient describe the interface of a gateway client
type GatewayClient interface {
Stat(ctx context.Context, in *provider.StatRequest, opts ...grpc.CallOption) (*provider.StatResponse, error)
Move(ctx context.Context, in *provider.MoveRequest, opts ...grpc.CallOption) (*provider.MoveResponse, error)
Expand Down Expand Up @@ -86,6 +88,7 @@ func (s *service) Register(ss *grpc.Server) {
provider.RegisterProviderAPIServer(ss, s)
}

// NewDefault returns a new instance of the SharesStorageProvider service with default dependencies
func NewDefault(m map[string]interface{}, _ *grpc.Server) (rgrpc.Service, error) {
c := &config{}
if err := mapstructure.Decode(m, c); err != nil {
Expand All @@ -110,6 +113,7 @@ func NewDefault(m map[string]interface{}, _ *grpc.Server) (rgrpc.Service, error)
return New(c.MountPath, gateway, sm)
}

// New returns a new instance of the SharesStorageProvider service
func New(mountpath string, gateway GatewayClient, sm share.Manager) (rgrpc.Service, error) {
s := &service{
mountPath: mountpath,
Expand Down Expand Up @@ -141,11 +145,10 @@ func (s *service) InitiateFileDownload(ctx context.Context, req *provider.Initia
return &provider.InitiateFileDownloadResponse{
Status: statRes.Status,
}, err
} else {
return &provider.InitiateFileDownloadResponse{
Status: status.NewInternal(ctx, err, "sharestorageprovider: error stating the requested share"),
}, nil
}
return &provider.InitiateFileDownloadResponse{
Status: status.NewInternal(ctx, err, "sharestorageprovider: error stating the requested share"),
}, nil
}
gwres, err := s.gateway.InitiateFileDownload(ctx, &provider.InitiateFileDownloadRequest{
Ref: &provider.Reference{
Expand Down Expand Up @@ -206,11 +209,10 @@ func (s *service) InitiateFileUpload(ctx context.Context, req *provider.Initiate
return &provider.InitiateFileUploadResponse{
Status: statRes.Status,
}, err
} else {
return &provider.InitiateFileUploadResponse{
Status: status.NewInternal(ctx, err, "sharestorageprovider: error stating the requested share"),
}, nil
}
return &provider.InitiateFileUploadResponse{
Status: status.NewInternal(ctx, err, "sharestorageprovider: error stating the requested share"),
}, nil
}
gwres, err := s.gateway.InitiateFileUpload(ctx, &provider.InitiateFileUploadRequest{
Ref: &provider.Reference{
Expand Down Expand Up @@ -307,11 +309,10 @@ func (s *service) CreateContainer(ctx context.Context, req *provider.CreateConta
return &provider.CreateContainerResponse{
Status: statRes.Status,
}, err
} else {
return &provider.CreateContainerResponse{
Status: status.NewInternal(ctx, err, "sharestorageprovider: error stating the requested share"),
}, nil
}
return &provider.CreateContainerResponse{
Status: status.NewInternal(ctx, err, "sharestorageprovider: error stating the requested share"),
}, nil
}

gwres, err := s.gateway.CreateContainer(ctx, &provider.CreateContainerRequest{
Expand Down Expand Up @@ -354,11 +355,10 @@ func (s *service) Delete(ctx context.Context, req *provider.DeleteRequest) (*pro
return &provider.DeleteResponse{
Status: statRes.Status,
}, err
} else {
return &provider.DeleteResponse{
Status: status.NewInternal(ctx, err, "sharestorageprovider: error stating the requested share"),
}, nil
}
return &provider.DeleteResponse{
Status: status.NewInternal(ctx, err, "sharestorageprovider: error stating the requested share"),
}, nil
}

gwres, err := s.gateway.Delete(ctx, &provider.DeleteRequest{
Expand Down Expand Up @@ -409,11 +409,10 @@ func (s *service) Move(ctx context.Context, req *provider.MoveRequest) (*provide
return &provider.MoveResponse{
Status: statRes.Status,
}, err
} else {
return &provider.MoveResponse{
Status: status.NewInternal(ctx, err, "sharestorageprovider: error stating the requested share"),
}, nil
}
return &provider.MoveResponse{
Status: status.NewInternal(ctx, err, "sharestorageprovider: error stating the requested share"),
}, nil
}

gwres, err := s.gateway.Move(ctx, &provider.MoveRequest{
Expand Down Expand Up @@ -590,11 +589,10 @@ func (s *service) ListFileVersions(ctx context.Context, req *provider.ListFileVe
return &provider.ListFileVersionsResponse{
Status: statRes.Status,
}, err
} else {
return &provider.ListFileVersionsResponse{
Status: status.NewInternal(ctx, err, "sharestorageprovider: error stating the requested share"),
}, nil
}
return &provider.ListFileVersionsResponse{
Status: status.NewInternal(ctx, err, "sharestorageprovider: error stating the requested share"),
}, nil
}

gwres, err := s.gateway.ListFileVersions(ctx, &provider.ListFileVersionsRequest{
Expand Down Expand Up @@ -632,11 +630,10 @@ func (s *service) RestoreFileVersion(ctx context.Context, req *provider.RestoreF
return &provider.RestoreFileVersionResponse{
Status: statRes.Status,
}, err
} else {
return &provider.RestoreFileVersionResponse{
Status: status.NewInternal(ctx, err, "sharestorageprovider: error stating the requested share"),
}, nil
}
return &provider.RestoreFileVersionResponse{
Status: status.NewInternal(ctx, err, "sharestorageprovider: error stating the requested share"),
}, nil
}

gwres, err := s.gateway.RestoreFileVersion(ctx, &provider.RestoreFileVersionRequest{
Expand Down

0 comments on commit ae3905f

Please sign in to comment.