segmento/pkg/handler/handler.go

27 lines
740 B
Go
Raw Permalink Normal View History

package handler
type AssetType int
const (
Segment AssetType = 0
MediaPlaylist
MasterPlaylist
)
type Asset struct {
2020-07-13 12:24:28 +00:00
Path string
Key string // should this be passed with the asset? or decided upon by the handler?
Type AssetType
ContentType string
}
type Handler interface {
AssetAdded(a Asset) error
2020-07-13 12:24:28 +00:00
// TODO it is probably better to remove this because it will be difficult to ensure
// that all old assets are always cleaned up (it would be easy for this callback to be missed,
// for example). Better for implementations to be responsible for cleaning up old files, either
// using an implementation-specific method (e.g. S3 expiring objects) or just a periodic check.
AssetRemoved(a Asset) error
}