Closed przemekc closed 5 years ago
Hi @przemekc,
Thank you for the contribution! Could you explain to me in which way you customized your UploadIdFactory
?
Depending on the use cases, we might need to adjust more code in order to support more different implementations of a ID factories.
Hi
Thank you for the contribution! Could you explain to me in which way you customized your
UploadIdFactory
?
I need to provide other way to create UUID. In my use case I need to get timestamp from UUID but when I use UUID.randomUUID timestamp() method throw Exception (Not a time-based UUID). So I overide method createId in UploadIdfactor and I'm using Generators.timeBasedGenerator().generate() from com.fastxml.uuid.
That's all I need for now. But without that change there is no way to achive my use case.
I think extract interface for UploadIdFactory is a quite good solution.
I took some time to experiment with refactoring the code to also support other upload ID formats that are not UUID-based. The result of this can be found in PR #18.
The main changes are:
UploadIdFactory
became an abstract classTusFileUploadService
received an additional method withUploadIdFactory
where you can provide your own implementation: linkUUIDUploadIdFactory
: linkTimeBasedUploadIdFactory
: link@przemekc, would this also cover your requirements?
The thing I like about this approach is that people can choose other ID formats than UUID.
Note that in that PR UploadInfo
only holds a UploadId
instance and no longer a UUID. And that UploadId
just contains a (URL safe) String.
@przemekc, would this also cover your requirements?
The thing I like about this approach is that people can choose other ID formats than UUID.
Yes, It look nice and yes it meets my requirements. Thanks a lot.
Beacuse #18 has been merged this isn't usefull anymore
Hi @przemekc,
I still wanted to thank you again for all your input. I've released the support for custom UploadIdFactory
instances of #18 to version 1.0.0-2.0
in Maven Central.
Have a nice weekend!
I added this to provide custom UploadIdFactory because there is no other way to provide custom instance.