Skip to content

Commit

Permalink
remove unused gateway config "commit_share_to_storage_ref" (cs3org#3017)
Browse files Browse the repository at this point in the history
* remove unused gateway config "commit_share_to_storage_ref"

* Update changelog/unreleased/fix-remove-unused-commit-share-to-storage-ref.md

Co-authored-by: Phil Davis <phil@jankaritech.com>

Co-authored-by: Phil Davis <phil@jankaritech.com>
  • Loading branch information
2 people authored and kobergj committed Jul 11, 2022
1 parent f2783f2 commit 87c2f83
Show file tree
Hide file tree
Showing 17 changed files with 9 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: removed unused gateway config "commit_share_to_storage_ref"

We've removed the unused gateway configuration option "commit_share_to_storage_ref".

https://github.com/cs3org/reva/pull/3017
1 change: 0 additions & 1 deletion examples/ocmd/ocmd-server-1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ ocmproviderauthorizersvc = "localhost:19000"
datagateway = "http://localhost:19001/data"
transfer_expires = 6 # give it a moment
commit_share_to_storage_grant = true
commit_share_to_storage_ref = true

[grpc.services.authregistry]
driver = "static"
Expand Down
1 change: 0 additions & 1 deletion examples/ocmd/ocmd-server-2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ ocmproviderauthorizersvc = "localhost:17000"
datagateway = "http://localhost:17001/data"
transfer_expires = 6 # give it a moment
commit_share_to_storage_grant = true
commit_share_to_storage_ref = true

[grpc.services.authregistry]
driver = "static"
Expand Down
1 change: 0 additions & 1 deletion examples/oidc-mapping-tpc/server-1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ gatewaysvc = "localhost:19000"
# services to enable
[grpc.services.gateway]
commit_share_to_storage_grant = true
commit_share_to_storage_ref = true

[grpc.services.authprovider]
[grpc.services.authprovider.auth_managers.json]
Expand Down
1 change: 0 additions & 1 deletion examples/oidc-mapping-tpc/server-2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ gatewaysvc = "localhost:17000"
# services to enable
[grpc.services.gateway]
commit_share_to_storage_grant = true
commit_share_to_storage_ref = true

[grpc.services.authprovider]
[grpc.services.authprovider.auth_managers.json]
Expand Down
1 change: 0 additions & 1 deletion examples/storage-references/gateway.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# services to enable
[grpc.services.gateway]
commit_share_to_storage_grant = true
commit_share_to_storage_ref = true

[grpc.services.storageregistry]
[grpc.services.storageregistry.drivers.static]
Expand Down
1 change: 0 additions & 1 deletion examples/two-server-setup/gateway-1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ address = "0.0.0.0:19000"
# services to enable
[grpc.services.gateway]
commit_share_to_storage_grant = true
commit_share_to_storage_ref = true

[grpc.services.storageregistry]
[grpc.services.storageregistry.drivers.static]
Expand Down
1 change: 0 additions & 1 deletion examples/two-server-setup/gateway-2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ ocmshareprovidersvc = "localhost:29000"
ocminvitemanagersvc = "localhost:29000"
ocmproviderauthorizersvc = "localhost:29000"
commit_share_to_storage_grant = true
commit_share_to_storage_ref = true

[grpc.services.storageregistry]
[grpc.services.storageregistry.drivers.static]
Expand Down
1 change: 0 additions & 1 deletion internal/grpc/services/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ type config struct {
DataGatewayEndpoint string `mapstructure:"datagateway"`
PermissionsEndpoint string `mapstructure:"permissionssvc"`
CommitShareToStorageGrant bool `mapstructure:"commit_share_to_storage_grant"`
CommitShareToStorageRef bool `mapstructure:"commit_share_to_storage_ref"`
DisableHomeCreationOnLogin bool `mapstructure:"disable_home_creation_on_login"`
TransferSharedSecret string `mapstructure:"transfer_shared_secret"`
TransferExpires int64 `mapstructure:"transfer_expires"`
Expand Down
14 changes: 1 addition & 13 deletions internal/grpc/services/gateway/ocmshareprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ func (s *svc) CreateOCMShare(ctx context.Context, req *ocm.CreateOCMShareRequest
return nil, errors.Wrap(err, "gateway: error calling CreateShare")
}

// if we don't need to commit we return earlier
if !s.c.CommitShareToStorageGrant && !s.c.CommitShareToStorageRef {
return res, nil
}

// TODO(labkode): if both commits are enabled they could be done concurrently.
if s.c.CommitShareToStorageGrant {
addGrantStatus, err := s.addGrant(ctx, req.ResourceId, req.Grant.Grantee, req.Grant.Permissions.Permissions, nil)
if err != nil {
Expand Down Expand Up @@ -108,12 +102,6 @@ func (s *svc) RemoveOCMShare(ctx context.Context, req *ocm.RemoveOCMShareRequest
return nil, errors.Wrap(err, "gateway: error calling RemoveShare")
}

// if we don't need to commit we return earlier
if !s.c.CommitShareToStorageGrant && !s.c.CommitShareToStorageRef {
return res, nil
}

// TODO(labkode): if both commits are enabled they could be done concurrently.
if s.c.CommitShareToStorageGrant {
removeGrantStatus, err := s.removeGrant(ctx, share.ResourceId, share.Grantee, share.Permissions.Permissions)
if err != nil {
Expand Down Expand Up @@ -221,7 +209,7 @@ func (s *svc) UpdateReceivedOCMShare(ctx context.Context, req *ocm.UpdateReceive
}

// if we don't need to create/delete references then we return early.
if !s.c.CommitShareToStorageGrant && !s.c.CommitShareToStorageRef {
if !s.c.CommitShareToStorageGrant {
return res, nil
}

Expand Down
20 changes: 1 addition & 19 deletions internal/grpc/services/gateway/usershareprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,6 @@ func (s *svc) UpdateShare(ctx context.Context, req *collaboration.UpdateShareReq
return nil, errors.Wrap(err, "gateway: error calling UpdateShare")
}

// if we don't need to commit we return earlier
if !s.c.CommitShareToStorageGrant && !s.c.CommitShareToStorageRef {
return res, nil
}

// TODO(labkode): if both commits are enabled they could be done concurrently.

if s.c.CommitShareToStorageGrant {
updateGrantStatus, err := s.updateGrant(ctx, res.GetShare().GetResourceId(),
res.GetShare().GetGrantee(),
Expand Down Expand Up @@ -559,12 +552,7 @@ func (s *svc) addShare(ctx context.Context, req *collaboration.CreateShareReques
if res.Status.Code != rpc.Code_CODE_OK {
return res, nil
}
// if we don't need to commit we return earlier
if !s.c.CommitShareToStorageGrant && !s.c.CommitShareToStorageRef {
return res, nil
}

// TODO(labkode): if both commits are enabled they could be done concurrently.
if s.c.CommitShareToStorageGrant {
// If the share is a denial we call denyGrant instead.
var status *rpc.Status
Expand Down Expand Up @@ -652,7 +640,7 @@ func (s *svc) removeShare(ctx context.Context, req *collaboration.RemoveShareReq
// if we need to commit the share, we need the resource it points to.
var share *collaboration.Share
// FIXME: I will cause a panic as share will be nil when I'm false
if s.c.CommitShareToStorageGrant || s.c.CommitShareToStorageRef {
if s.c.CommitShareToStorageGrant {
getShareReq := &collaboration.GetShareRequest{
Ref: req.Ref,
}
Expand Down Expand Up @@ -681,12 +669,6 @@ func (s *svc) removeShare(ctx context.Context, req *collaboration.RemoveShareReq
s.removeReference(ctx, share.ResourceId)
}

// if we don't need to commit we return earlier
if !s.c.CommitShareToStorageGrant && !s.c.CommitShareToStorageRef {
return res, nil
}

// TODO(labkode): if both commits are enabled they could be done concurrently.
if s.c.CommitShareToStorageGrant {
removeGrantStatus, err := s.removeGrant(ctx, share.ResourceId, share.Grantee, share.Permissions.Permissions)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion tests/oc-integration-tests/drone/gateway-virtual.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ ocminvitemanagersvc = "localhost:14000"
ocmproviderauthorizersvc = "localhost:14000"
# other
commit_share_to_storage_grant = true
commit_share_to_storage_ref = true
share_folder = "Shares"
datagateway = "http://localhost:19001/data"
transfer_shared_secret = "replace-me-with-a-transfer-secret" # for direct uploads
Expand Down
1 change: 0 additions & 1 deletion tests/oc-integration-tests/drone/gateway.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ ocmproviderauthorizersvc = "localhost:14000"
permissionssvc = "localhost:10000"
# other
commit_share_to_storage_grant = true
commit_share_to_storage_ref = true
share_folder = "Shares"
datagateway = "http://localhost:19001/data"
transfer_shared_secret = "replace-me-with-a-transfer-secret" # for direct uploads
Expand Down
1 change: 0 additions & 1 deletion tests/oc-integration-tests/local-mesh/gateway.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ ocminvitemanagersvc = "localhost:34000"
ocmproviderauthorizersvc = "localhost:34000"
# other
commit_share_to_storage_grant = true
commit_share_to_storage_ref = true
share_folder = "Shares"
datagateway = "http://localhost:39001/data"
transfer_shared_secret = "replace-me-with-a-transfer-secret" # for direct uploads
Expand Down
5 changes: 2 additions & 3 deletions tests/oc-integration-tests/local/combined.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jwt_secret = "Pive-Fumkiu4"
#groupprovidersvc = "localhost:18000"
# other
commit_share_to_storage_grant = true
commit_share_to_storage_ref = true
#share_folder = "Shares"
transfer_expires = 6 # give it a moment
#disable_home_creation_on_login = true
Expand Down Expand Up @@ -75,7 +74,7 @@ users = "users.demo.json"
[grpc.services.sharesstorageprovider]
usershareprovidersvc = "0.0.0.0:19000"

# FIXME start as a separate service ... collides with the storageprovider:
# FIXME start as a separate service ... collides with the storageprovider:
# Server.RegisterService found duplicate service registration for "cs3.storage.provider.v1beta1.ProviderAPI"
#[grpc.services.sharesstorageprovider]

Expand Down Expand Up @@ -186,4 +185,4 @@ temp_folder = "/var/tmp/reva/tmp"
root = "/var/tmp/reva/data"
enable_home = false
treetime_accounting = true
treesize_accounting = true
treesize_accounting = true
1 change: 0 additions & 1 deletion tests/oc-integration-tests/local/gateway-virtual.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ ocminvitemanagersvc = "localhost:14000"
ocmproviderauthorizersvc = "localhost:14000"
# other
commit_share_to_storage_grant = true
commit_share_to_storage_ref = true
share_folder = "Shares"
datagateway = "http://localhost:19001/data"
transfer_shared_secret = "replace-me-with-a-transfer-secret" # for direct uploads
Expand Down
1 change: 0 additions & 1 deletion tests/oc-integration-tests/local/gateway.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ ocmproviderauthorizersvc = "localhost:14000"
permissionssvc = "localhost:10000"
# other
commit_share_to_storage_grant = true
commit_share_to_storage_ref = true
share_folder = "Shares"
datagateway = "http://localhost:19001/data"
transfer_shared_secret = "replace-me-with-a-transfer-secret" # for direct uploads
Expand Down

0 comments on commit 87c2f83

Please sign in to comment.