stash/internal/manager/config/enums.go
WithoutPants 7cff71c35f
Add filesystem based blob storage (#3187)
* Refactor transaction hooks. Add preCommit
* Add BlobStore
* Use blobStore for tag images
* Use blobStore for studio images
* Use blobStore for performer images
* Use blobStore for scene covers
* Don't generate screenshots in legacy directory
* Run post-hooks outside original transaction
* Use blobStore for movie images
* Remove unnecessary DestroyImage methods
* Add missing filter for scene cover
* Add covers to generate options
* Add generate cover option to UI
* Add screenshot migration
* Delete thumb files as part of screenshot migration
2023-03-17 10:52:49 +11:00

50 lines
917 B
Go

package config
import (
"fmt"
"io"
"strconv"
)
type BlobsStorageType string
const (
// Database
BlobStorageTypeDatabase BlobsStorageType = "DATABASE"
// Filesystem
BlobStorageTypeFilesystem BlobsStorageType = "FILESYSTEM"
)
var AllBlobStorageType = []BlobsStorageType{
BlobStorageTypeDatabase,
BlobStorageTypeFilesystem,
}
func (e BlobsStorageType) IsValid() bool {
switch e {
case BlobStorageTypeDatabase, BlobStorageTypeFilesystem:
return true
}
return false
}
func (e BlobsStorageType) String() string {
return string(e)
}
func (e *BlobsStorageType) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = BlobsStorageType(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid BlobStorageType", str)
}
return nil
}
func (e BlobsStorageType) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}