-
Notifications
You must be signed in to change notification settings - Fork 113
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
Spaces registry #2234
Spaces registry #2234
Conversation
temporary change to check CI
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
a7d370e
to
6380dc1
Compare
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This pull request introduces 3 alerts when merging 965bf36 into c35c530 - view on LGTM.com new alerts:
|
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This pull request introduces 4 alerts when merging 4704592 into bb40f54 - view on LGTM.com new alerts:
|
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This pull request introduces 1 alert when merging 70e7123 into bb40f54 - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging cbe1a2c into 147c0c2 - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging a023668 into 147c0c2 - view on LGTM.com new alerts:
|
…torageprovider_static_test.go Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
352694d
to
b48b2f3
Compare
This pull request introduces 2 alerts when merging b48b2f3 into 147c0c2 - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging b48b2f3 into 255730c - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
// resourcePath := statResponse.Info.Path | ||
|
||
// if strings.HasPrefix(ref.GetPath(), resourcePath) { | ||
// // The path corresponds to the resource to which the token has access. | ||
// // We allow access to it. | ||
// return true, nil | ||
// } | ||
|
||
// // If we arrived here that could mean that ref.GetPath is not prefixed with the storage mount path but resourcePath is | ||
// // because it was returned by the gateway which will prefix it. To fix that we remove the mount path from the resourcePath. | ||
// // resourcePath = "/users/<name>/some/path" | ||
// // After the split we have [" ", "users", "<name>/some/path"]. | ||
// trimmedPath := "/" + strings.SplitN(resourcePath, "/", 3)[2] | ||
// if strings.HasPrefix(ref.GetPath(), trimmedPath) { | ||
// // The path corresponds to the resource to which the token has access. | ||
// // We allow access to it. | ||
// return true, nil | ||
// } | ||
|
||
// return false, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd remove these lines instead of commenting them. It is clutter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #2383
|
||
statRes, err := s.stat(ctx, &storageprovider.StatRequest{ | ||
Ref: &storageprovider.Reference{Path: resName}, | ||
resChild := "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resChild
is unset. Was your intention to document the parameter here? https://github.com/butonic/reva/blob/b48b2f37569170dfff52ea2ed644859b2e84304d/internal/grpc/services/gateway/appprovider.go#L75
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. Removed in #2383
spaceID := "" | ||
mountPath := providerInfos[i].ProviderPath | ||
|
||
spacePaths := decodeSpacePaths(providerInfos[i].Opaque) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're doing the same time and again. I think we could benefit with an abstraction for this section. Perhaps a function should be enough. Also, how volatile is providerInfos, err := s.findProviders(ctx, req.Ref)
I would imagine looking for providers depending on a reference a costly unnecessary operation, since resources don't tend to change storages often (or at all...) so caching it would improve quite a bit. I'm unaware of any other caching efforts on this area as for now, but IIRC @kobergj enabled the cached and had it working. Is it because of this perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_ = statCache.SetTTL(time.Duration(c.StatCacheTTL) * time.Second) | ||
statCache.SkipTTLExtensionOnHit(true) | ||
|
||
// mountCache := ttlcache.NewCache() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could all lines related to the mountCache
be thrown away? it clutters a bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed together with caching in #2372
return spacePaths | ||
} | ||
if entry, ok := o.Map["space_paths"]; ok { | ||
_ = json.Unmarshal(entry.Value, &spacePaths) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this method is wrong, and assuming too much. CS3 OpaqueEntries do have decoders, assuming the map is encoded in json, and using the json decoder might break things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more decoders in #2383
SpaceType: spaceType, | ||
// Mtime is set either as node.tmtime or as fi.mtime below | ||
} | ||
|
||
user := ctxpkg.ContextMustGetUser(ctx) | ||
|
||
// filter out spaces user cannot access (currently based on stat permission) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clutter. remove these comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in #2383
@@ -185,21 +186,24 @@ func (fs *Decomposedfs) NewUpload(ctx context.Context, info tusd.FileInfo) (uplo | |||
log := appctx.GetLogger(ctx) | |||
log.Debug().Interface("info", info).Msg("Decomposedfs: NewUpload") | |||
|
|||
fn := info.MetaData["filename"] | |||
if fn == "" { | |||
// sanity checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spureous comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in #2383
return errtypes.AlreadyExists(n.ID) // path? | ||
} | ||
|
||
// Allow passing in the node id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spureous?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in #2383
return | ||
} | ||
|
||
// try to remove the node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary comment, line below is expressive enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in #2383
e := t.Delete(ctx, n) | ||
switch { | ||
case e != nil: | ||
appctx.GetLogger(ctx).Debug().Err(e).Msg("cannot move to trashcan") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename: trashcan -> trashbin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in #2383
We are prototyping a spaces registry that uses spaceids instead of storageids to route requests. This should clarify the concepts we are pursuing with #2023 and #2016
cc @dragotin @kobergj