Skip to content

Commit

Permalink
pkg/server/gw: add missing retention functions to multi-tenant
Browse files Browse the repository at this point in the history
Change-Id: I8d7a67b9580013946dae6b0a1df7cecec8911b56
  • Loading branch information
halkyon committed Aug 27, 2024
1 parent 5acc78d commit 73aab0a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pkg/server/gw/multi_tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,32 @@ func (l *MultiTenancyLayer) GetObjectLockConfig(ctx context.Context, bucket stri
return objectLockConfig, l.log(ctx, err)
}

// GetObjectRetention is a multi-tenant wrapping of storj.io/gateway.(*gatewayLayer).GetObjectRetention.
func (l *MultiTenancyLayer) GetObjectRetention(ctx context.Context, bucket, object, version string) (_ *objectlock.ObjectRetention, err error) {
project, err := l.openProject(ctx, getAccessGrant(ctx))
if err != nil {
return nil, err
}

defer func() { err = errs.Combine(err, project.Close()) }()

retention, err := l.layer.GetObjectRetention(miniogw.WithUplinkProject(ctx, project), bucket, object, version)

return retention, l.log(ctx, err)
}

// SetObjectRetention is a multi-tenant wrapping of storj.io/gateway.(*gatewayLayer).SetObjectRetention.
func (l *MultiTenancyLayer) SetObjectRetention(ctx context.Context, bucket, object, version string, r *objectlock.ObjectRetention) (err error) {
project, err := l.openProject(ctx, getAccessGrant(ctx))
if err != nil {
return err
}

defer func() { err = errs.Combine(err, project.Close()) }()

return l.log(ctx, l.layer.SetObjectRetention(miniogw.WithUplinkProject(ctx, project), bucket, object, version, r))
}

// ListObjects is a multi-tenant wrapping of storj.io/gateway.(*gatewayLayer).ListObjects.
func (l *MultiTenancyLayer) ListObjects(ctx context.Context, bucket, prefix, marker, delimiter string, maxKeys int) (result minio.ListObjectsInfo, err error) {
project, err := l.openProject(ctx, getAccessGrant(ctx))
Expand Down

0 comments on commit 73aab0a

Please sign in to comment.