Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

services: remove Getter as they generated as part of proto #2856

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions services/provider/api/interfaces/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ type StorageClientStatus interface {
// no client is using it
GetPlatformVersion() string
GetOperatorVersion() string
GetClusterID() string
GetClusterName() string
GetClientName() string
GetStorageQuotaUtilizationRatio() float64
Comment on lines 8 to -12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you change the comment to

These two getters are redirects for generated protobuf rpcs' and only add new getters here if you want to use different names which is not encouraged as these two are here only for backward compatibility

you can find setters at services/provider/api/storageclient.go and generated getters at services/provider/api/provider.pb.go


SetPlatformVersion(string) StorageClientStatus
SetOperatorVersion(string) StorageClientStatus
Expand Down
3 changes: 2 additions & 1 deletion services/provider/server/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"sync"

ocsv1alpha1 "github.com/red-hat-storage/ocs-operator/api/v4/v1alpha1"
pb "github.com/red-hat-storage/ocs-operator/services/provider/api/v4"
ifaces "github.com/red-hat-storage/ocs-operator/services/provider/api/v4/interfaces"
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -207,7 +208,7 @@ func (c *ocsConsumerManager) Get(ctx context.Context, id string) (*ocsv1alpha1.S
return consumerObj, nil
}

func (c *ocsConsumerManager) UpdateConsumerStatus(ctx context.Context, id string, status ifaces.StorageClientStatus) error {
func (c *ocsConsumerManager) UpdateConsumerStatus(ctx context.Context, id string, status *pb.ReportStatusRequest) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this being changed? the whole point was to abstract ReportStatusRequest as it keeps on increasing and keep on satisfying StorageClientStatus interface.

consumerObj, err := c.Get(ctx, id)
if err != nil {
return err
Expand Down
4 changes: 3 additions & 1 deletion services/provider/server/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
opv1a1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
api "github.com/red-hat-storage/ocs-operator/api/v4/v1"
ocsv1alpha1 "github.com/red-hat-storage/ocs-operator/api/v4/v1alpha1"
pb "github.com/red-hat-storage/ocs-operator/services/provider/api/v4"
providerClient "github.com/red-hat-storage/ocs-operator/services/provider/api/v4/client"
rookCephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -217,7 +218,8 @@ func TestUpdateConsumerStatus(t *testing.T) {
fields := providerClient.NewStorageClientStatus().
SetPlatformVersion("1.0.0").
SetOperatorVersion("1.0.0")
err = consumerManager.UpdateConsumerStatus(ctx, "uid1", fields)
status := fields.(*pb.ReportStatusRequest)
err = consumerManager.UpdateConsumerStatus(ctx, "uid1", status)
assert.NoError(t, err)

c1, err := consumerManager.Get(ctx, "uid1")
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading