Skip to content
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

Tus#67 persistent url store #68

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dr-chase-g3ka1
Copy link

This is the pull request for issue #67. There is a TusURLPersistentStore which can continue uploads after restarting the computer. After successful upload finished, the URL will get deleted. Tested on Windows, and worked.

Usage:
TusURLPersistentStore persistentStore = new TusURLPersistentStore();
client.enableResuming(persistentStore);
....



unmarshall();
marshall();
Copy link
Member

Choose a reason for hiding this comment

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

Could you explain why this marshal/unmarshall step is necessary here?

Copy link
Author

Choose a reason for hiding this comment

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

I think I wrote it because unmarshall()/marshall() takes care of initialization too. It's probably a shortcutty way to do it.


public class TusURLPersistentStore implements TusURLStore {

private static volatile TusUploadFileSet filesWithFingerprints;
Copy link
Member

Choose a reason for hiding this comment

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

Why is this property static? Does this mean that the user can only effectively use one TusURLPersistentStore?

Copy link
Author

Choose a reason for hiding this comment

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

Honestly I don't remember why is it static. However I didn't recognize any use case for more than one TusUploadFileSet.

public TusURLPersistentStore(String pathOfPersistentXmlFiles) {
super();
this.pathOfPersistentXmlFiles = pathOfPersistentXmlFiles;
unmarshall();
Copy link
Member

Choose a reason for hiding this comment

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

Why is here no marshall() compared to the other constructor?

Copy link
Author

Choose a reason for hiding this comment

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

I assumed a custom path for a store is already initialized. Therefore no marshall(). Non existing file on custom path will generate RuntimeException.

return null;
}

public TusUploadFile getTusUploadFile(String fingerprint) {
Copy link
Member

Choose a reason for hiding this comment

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

I see that you are implementing additional methods for storing and retrieving additional information about the uploads, such as the filename. We can implement such a more capable URL store for tus-js-client as well. I think we should do the same for tus-java-client in its next major release: #78

@Acconut Acconut mentioned this pull request Jan 17, 2023
5 tasks
@Acconut Acconut mentioned this pull request Feb 11, 2023
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