-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add support for checking a sentinel file for the cache #1157
Conversation
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.
Can you add testing to check the cache sentinel location as well? Something similar to what's in origin_test.go?
@@ -492,7 +492,8 @@ from S3 service URL. In this configuration, objects can be accessed at /federati | |||
return originExports, nil | |||
} | |||
|
|||
func CheckSentinelLocation(exports []OriginExport) (ok bool, err error) { | |||
// Check the sentinel files from Origin.Exports | |||
func CheckOriginSentinelLocations(exports []OriginExport) (ok bool, err error) { |
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.
func CheckOriginSentinelLocations(exports []OriginExport) (ok bool, err error) { | |
func CheckOriginSentinelLocation(exports []OriginExport) (ok bool, err error) { |
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.
The s
was intentional as we are checking multiple locations for different prefixes
launchers/cache_serve.go
Outdated
@@ -51,6 +54,21 @@ func CacheServe(ctx context.Context, engine *gin.Engine, egrp *errgroup.Group, m | |||
return nil, err | |||
} | |||
|
|||
// Check for the sentinel file | |||
if param.Cache_SentinelLocation.IsSet() { | |||
sentinelPath := param.Cache_SentinelLocation.GetString() |
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.
This seems redundant. Can the server_utils function be made more general to check both the cache and origin sentinel locations?
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.
The first draft (not published) was to take advantage of the server_utils
function and make them share the same core logic, but I figured the real "core" logic is just a os.Stat
call. Given that the error messages have different format for cache and origin, and that origin and cache reads from different parameters, I figured I'd be ok to have a separate function to handle them
Closes #1056