datasource

package
v0.0.0-...-4d6a32e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GeneratePreviewLocker = make(chan struct{}, 1)
View Source
var GenerationBroadcast = rx.New[struct{}](99)
View Source
var GenerationQueue = queue.NewAtomicQueue[FileKey]()

Functions

func GetDriver

func GetDriver(t Type) (driver.Driver, error)

func GetPreview

func GetPreview(repo *gorm.DB, datasource Datasource, file string) (FileKey, *Preview, error)

func Setup

func Setup(repo *gorm.DB, rout *gin.Engine, previewFolder string) error

Types

type Datasource

type Datasource struct {
	base.Model
	Name string `json:"name"`
	Type Type   `json:"type"`
	Cwd  string `json:"cwd"`
}

type FileKey

type FileKey string

func BuildPreviewKey

func BuildPreviewKey(datasource Datasource, file string) FileKey

type Preview

type Preview struct {
	base.Model
	DatasourceID uint    `json:"datasourceId"`
	Key          FileKey `json:"key" gorm:"uniqueIndex;type:varchar(255)"`
	Digest       string  `json:"digest"`
	Cover        string  `json:"cover"`
	FFProbeInfo  string  `json:"ffprobeInfo"`
}

func GeneratePreview

func GeneratePreview(source driver.Driver, datasource Datasource, sourceFile, dstFolder string, finder func(digest string) (*Preview, error)) (*Preview, error)

type PreviewableFile

type PreviewableFile struct {
	Key     FileKey     `json:"key"`
	Stat    driver.File `json:"stat"`
	Preview *Preview    `json:"preview"`
}

type Type

type Type string
const (
	DUFS  Type = "dufs"
	LOCAL Type = "local"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL