Skip to content

feat: add new backend to support DOIs - Rclone 1.65.2#2

Closed
leafty wants to merge 66 commits into
release-1.65.2from
leafty/exp-doi-zenodo-1-65
Closed

feat: add new backend to support DOIs - Rclone 1.65.2#2
leafty wants to merge 66 commits into
release-1.65.2from
leafty/exp-doi-zenodo-1-65

Conversation

@leafty
Copy link
Copy Markdown
Member

@leafty leafty commented Mar 21, 2025

Same as #1, but rebased onto 1.65.2

@leafty leafty force-pushed the leafty/exp-doi-zenodo-1-65 branch from f178a53 to 1bb8a99 Compare March 21, 2025 17:22
@leafty leafty force-pushed the leafty/exp-doi-zenodo-1-65 branch from 1bb8a99 to 63af447 Compare March 21, 2025 17:24
@leafty leafty changed the title feat: add new backend to support DOIs feat: add new backend to support DOIs - Rclone 1.65.2 Apr 4, 2025
@leafty leafty force-pushed the leafty/exp-doi-zenodo-1-65 branch from aeee2e8 to d93097f Compare April 4, 2025 13:45
Copy link
Copy Markdown
Member

@olevski olevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a few questions / suggestions. Feel free to ignore since this will be reviewed again by the rclone maintainers. So I did not want to make suggestions that potentially the maintainers would ask you to undo.

Comment thread backend/doi/api/dataversetypes.go Outdated
// DataverseDatasetVersion is the representation of a dataset version
type DataverseDatasetVersion struct {
LastUpdateTime string `json:"lastUpdateTime"`
Files []DataverseFile `json:"files"`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: I think you are missing some of this on this and other list or optional fields.

Suggested change
Files []DataverseFile `json:"files"`
Files []DataverseFile `json:"files,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same goes for the invenio stuff types. But it probably does not really matter because I think you only use these to deserialize json stuff into the structs and you never really serialize these structs to json. Right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I don't use the classes for sending requests
  2. I don't know if this is even how the API works. omitempty should be there only if this is also valid API-wise.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

Comment thread backend/doi/doi.go Outdated
return metadata.Metadata.Title, nil

}
return "<unknown title>", nil
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: shouldn't you return an error if you cannot find the title?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. It is still pretty obvious from <unknown title> that something wrong happened.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I guess the rclone authors can decide how to address this. If I saw a function and it returned an error and something and if the error is nil then I would expect that that "something" should be normal. In this situation that is not the case.

Comment thread backend/doi/doi.go Outdated
Comment on lines +481 to +484
for _, opt := range opts.Options {
k, v := opt.Header()
fs.Logf(o, "header '%s' = '%s'", k, v)
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is there a risk of leaking sensitive information from printing this out?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the logging statements should be removed soon.

Comment thread backend/doi/invenio.go
// List the files contained in the DOI
func (f *Fs) listInvevioDoiFiles(ctx context.Context) (entries []*Object, err error) {
// Use the cache if populated
cachedEntries, found := f.cache.GetMaybe("files")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Do we need to worry about accessing stuff that is too stale from the cache? Do we have some way to invalidate the cache? Or is this unnecessary and once we have something in the cache we can be certain that it does not need to be updated.

Copy link
Copy Markdown
Member Author

@leafty leafty Apr 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or is this unnecessary and once we have something in the cache we can be certain that it does not need to be updated.

Correct, the file list from a published dataset should not change. It may change if a new version is published or if file hosting is updated.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if we can just put some simple TTL on the cache it may be a good idea. Because it is not like the dataset can NEVER change. But again we can just wait on the review from the rclone authors here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's 5 minutes since the entry was last used. So, technically the entry may never expire if it is always in use.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise, it will be fine in most reasonable cases.

Comment thread backend/doi/link_header.go Outdated
Comment thread backend/doi/link_header_internal_test.go
@leafty leafty force-pushed the leafty/exp-doi-zenodo-1-65 branch from fdd182d to f476e0f Compare April 15, 2025 13:13
@leafty leafty force-pushed the leafty/exp-doi-zenodo-1-65 branch from c858c78 to a1647a7 Compare April 16, 2025 05:56
@leafty leafty closed this Aug 11, 2025
@leafty leafty deleted the leafty/exp-doi-zenodo-1-65 branch August 11, 2025 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants