Closed ksvraja closed 4 years ago
we also need this.
Hi @ksvraja,
Thank you for your feedback.
withStoragePath(String)
method of the TusFileUploadService
class, you should be able to configure the path /uploads/folder1/folder2
. If the path needs to be different for each upload, then I would propose to create your own custom DiskStorageService
class and provide it via withUploadStorageService
method.UploadStorageService
, I want to make sure that it is compatible with different database technologies like MySQL, PostgreSQL, Oracle... This would then also require a database-based UploadLockingService
. So I want to keep it as simple as possible. Currently I'm thinking on a table structure like:
UploadLockingService
UploadInfo
objectUploadId createUploadId(String uploadId)
?What do you think about the database approach? If you agree, I can try to free up some time to build this into the library.
Hi Tom, In our current project, We have implemented this functionality as below.
public interface IndexStorage {
public UploadInfo create(UploadInfo info, String fileName);
public UploadInfo update(UploadInfo info) throws UploadNotFoundException;
public UploadInfo get(UploadInfo info) throws UploadNotFoundException;
public UploadInfo getByFilePath(String filePath) throws UploadNotFoundException;
public UploadInfo get(UploadId id) throws UploadNotFoundException;
public UploadInfo get(long id /* Primary key*/) throws UploadNotFoundException;
public int delete(UploadId id);
public String getFilePath(UploadInfo info) throws UploadNotFoundException;
public String newFilePath(UploadInfo info);
}
My thought on how this implementation could be -
Providing a standard implementation of database based access might bring the complexity of providing the datasource implementation (hibernate, jdbc template, etc) and dependent libraries. However, if you can provide an reference / example implementation that would be great, But it will not be a good idea to embed inside the TUS library.
Personally I prefer the TUS library with minimal dependency. This makes adopting/embedding into the projects easier.
I can contribute on this enhancement. Please let me now your thoughts.
Hi @ksvraja .
Any chance that you can share your implementation of custom DiskStorageService
?
@Hi @ksvraja , Can you share your implementation ?
I have shared the code reference here - https://github.com/ksvraja/tus_ext We have deeply integrated the db implementation within our framework. The code may not be ready to use, but can be used for reference.
Expected Behaviour
Hi Tom, thanks for the great work.. the library works great for our file transfer use case.
We are currently using springframework.. and we have the below requirements
Can you provide guidelines on how to implement the same. We can develop the same and share.