storage

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioFile added in v1.0.3

type AudioFile struct {

	// Media length in seconds
	Duration float64
	// Audio channels
	AudioChannels int
	// Audio sample rate
	AudioSampleRate int
	// contains filtered or unexported fields
}

AudioFile represents an audio file

func (*AudioFile) Type added in v1.0.3

func (i *AudioFile) Type() ItemType

type Content added in v1.0.3

type Content struct {
	// Content body
	Body io.ReadCloser
	// Body size
	BodySize int64
	// MIME type
	MimeType string
	// Content range
	Range *ContentRange
}

type ContentRange added in v1.1.0

type ContentRange struct {
	// Range start
	Start int64
	// Range end
	End int64
	// Total size
	Total int64
}

type Dir

type Dir struct {
	// contains filtered or unexported fields
}

Dir represents a folder.

func (*Dir) Type

func (i *Dir) Type() ItemType

type ImageFile added in v1.0.3

type ImageFile struct {
	// contains filtered or unexported fields
}

ImageFile represnts an image file

func (*ImageFile) Type added in v1.0.3

func (i *ImageFile) Type() ItemType

type Item

type Item interface {
	Type() ItemType
}

Item interface should be implemented by all Dir and File items.

type ItemType

type ItemType int
const (
	ItemTypeDir ItemType = iota
	ItemTypeImage
	ItemTypeAudio
	ItemTypeVideo
)

type StorageService

type StorageService interface {
	// Browse get items under specific parent folder
	Browse(parentId string) (items []Item)

	// Fetch fetches file content from storage.
	Fetch(path string, offset int64, length int64) (content *Content, err error)
}

StorageService defines a interface which should be impled by storage service. It will be used by ContentDirectory service to browse files.

type VideoFile

type VideoFile struct {
	AudioFile

	// Video resolution
	VideoResolution string
}

VideoFile represents a video file

func (*VideoFile) Type

func (i *VideoFile) Type() ItemType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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