-
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
Director based cache health tests #960
Director based cache health tests #960
Conversation
cache/cache.go
Outdated
return nil | ||
} | ||
for idx, item := range dirItems { | ||
if idx <= len(dirItems)-1-2 { // For all but the latest two files (test file and its .cinfo file) |
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.
Interesting, do we have some underlying guarantee that this slice is ordered? Or how do we know we're leaving the "right" two files? Also, the logic here might be a more clear at first glance if you do if idx < len(dirItems)-2
to get rid of the extra -1
.
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.
ReadDir
sorts the dirEntry in order. The filenames are in format of cache-test-<date>.txt
where date is a comparable string, so here I'm looking for the last two files, which have the largest date as its filename (or the latest files). I'll add a comment here to explain 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.
LGTM!
Closes #545
This PR has two major changes. One is to add unauthenticated director-based health tests for caches. Second is to have a large overhaul of project structure to 1. minimize chances for cyclic import. 2. Establish a convention on internal dependencies and naming practice.
The first task happens over the most of the commits. The second task happens in
3c17dd8
,dd13fc3
,8192935
,952229b
,a8dce19
,4f444ba
, where 4f444ba should contain most of the changes to the whole project while others are small changes to a specific directory.The task two implemented proposed ideas in Pelican Folder Structure v7.7.0, including:
cache_ui
-->cache
,origin_ui
-->origin
common
-->server_structs
director.go
-->director_ui.go
,redirect.go
-->director
in director packageserver_ui
-->launcher_utils
cache
dependency ondirector
by movingNamespaceV1/V2
conversion functions fromdirector
toserver_structs
(old namecommon
)XRootDServer
structs fromserver_utils
toserver_structs
common
toserver_utils