-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
feat(server) user-defined storage structure #1098
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Good stuff! Mainly high level from me right now, about interfaces and such.
I think the IImmichStorage
implementations should take all their config (eg s3 credentials, path templates, etc) in their constructor. That way in the future we can easily have multiple instances of the storage implementations for things like separate thumbnail storage, storage migrations, etc.
To align with that, we probably want separate functions on the StorageService
for originals vs. thumbnails, etc. Or maybe the functions can take a Type
enum for the type of file:
enum Type {
OriginalPhoto,
OriginalVideo,
Thumbnail,
TranscodedVideo,
Etc
}
@@ -0,0 +1,4 @@ | |||
export interface IImmichStorage { |
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.
This will probably need a few more functions, like deleting, checking whether a file exists, and maybe getting metadata (eg size).
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.
And all the functions in this interface should take some object with asset metadata that they can use to find the file in their backend.
Some potential fields:
assetId
userId
assetType
originalFileName
createdAt
checksum
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.
It doesn't look like we're using this interface in this PR, can we remove it and related artifacts?
In order to test the Storage service are you going to have to mock every single storage backend? That doesn't seem right. |
@jrasm91 What would be the best way to encapsulate this? I am laying out the ground work here so we can dissect the structure |
If we're just refactoring with the legacy storage approach for now, I think we can potentially leave all the config stuff for later? |
@bo0tzz Yes, I am not planning to integrate the full storage provider configuration in this PR. I might abstract some of the legacy's calls away but that will be it. |
This looks absolutely awesome, thanks a lot! Is it possible to have the user directory named with a "human readable" user name instead of user id? |
Maybe, but there are some security implications with that part of the path, as well as uniqueness checks. So we didn't try changing it in this PR. |
This PR implements a way to let the user define a storage structure for the original files uploaded to the Immich server under a template builder option on the web.
Builder interface
Resulting in storage location with auto handling duplicated filename