Documentation
¶
Index ¶
- Constants
- Variables
- type ArchiveSegmentInfo
- type ArchiveStorage
- type ArchiveUnit
- type FileSystemProvider
- func (storage *FileSystemProvider) GetFilePath(ctx context.Context, directory, segmentName string) (string, error)
- func (storage *FileSystemProvider) ListFiles(ctx context.Context, directory string, streamPrefix string, ...) ([]ArchiveSegmentInfo, error)
- func (storage *FileSystemProvider) MakeBucket(bucket string) error
- func (storage *FileSystemProvider) Type() StorageType
- func (storage *FileSystemProvider) UploadFile(ctx context.Context, object ArchiveUnit) (string, error)
- type MinioProvider
- func (m *MinioProvider) GetFilePath(ctx context.Context, bucket, segmentName string) (string, error)
- func (m *MinioProvider) ListFiles(ctx context.Context, bucket string, streamPrefix string, ...) ([]ArchiveSegmentInfo, error)
- func (m *MinioProvider) MakeBucket(bucket string) error
- func (m *MinioProvider) Type() StorageType
- func (m *MinioProvider) UploadFile(ctx context.Context, object ArchiveUnit) (string, error)
- type StorageType
Constants ¶
const ( STORAGE_UNDEFINED_TYPE = iota STORAGE_FILESYSTEM STORAGE_MINIO )
Variables ¶
var ErrNotImplementedYet = fmt.Errorf("not implemented yet")
Functions ¶
This section is empty.
Types ¶
type ArchiveSegmentInfo ¶ added in v0.8.0
type ArchiveSegmentInfo struct {
SegmentName string
StartTime time.Time
FilePath string
Size int64
}
ArchiveSegmentInfo contains metadata about an archive segment
type ArchiveStorage ¶
type ArchiveStorage interface {
Type() StorageType
MakeBucket(string) error
UploadFile(context.Context, ArchiveUnit) (string, error)
// ListFiles returns segments in the given time range for a stream
ListFiles(ctx context.Context, directory string, streamPrefix string, startTime, endTime time.Time) ([]ArchiveSegmentInfo, error)
// GetFilePath returns the full path to serve a segment
GetFilePath(ctx context.Context, directory, segmentName string) (string, error)
}
func NewFileSystemProvider ¶
func NewFileSystemProvider(path string) (ArchiveStorage, error)
func NewMinioProvider ¶
func NewMinioProvider(client *minio.Client, bucket, path string) (ArchiveStorage, error)
type ArchiveUnit ¶
type FileSystemProvider ¶
type FileSystemProvider struct {
Path string
}
func (*FileSystemProvider) GetFilePath ¶ added in v0.8.0
func (storage *FileSystemProvider) GetFilePath(ctx context.Context, directory, segmentName string) (string, error)
GetFilePath returns the full path to a segment file
func (*FileSystemProvider) ListFiles ¶ added in v0.8.0
func (storage *FileSystemProvider) ListFiles(ctx context.Context, directory string, streamPrefix string, startTime, endTime time.Time) ([]ArchiveSegmentInfo, error)
ListFiles lists archive segments in the directory matching the stream prefix and time range Segment filenames are expected in format: {streamID}_{unixTimestamp}.mp4 It finds the segment containing startTime (largest timestamp <= startTime) and includes all segments from there up to endTime.
func (*FileSystemProvider) MakeBucket ¶
func (storage *FileSystemProvider) MakeBucket(bucket string) error
func (*FileSystemProvider) Type ¶
func (storage *FileSystemProvider) Type() StorageType
func (*FileSystemProvider) UploadFile ¶
func (storage *FileSystemProvider) UploadFile(ctx context.Context, object ArchiveUnit) (string, error)
type MinioProvider ¶
type MinioProvider struct {
DefaultBucket string
Path string
// contains filtered or unexported fields
}
func (*MinioProvider) GetFilePath ¶ added in v0.8.0
func (m *MinioProvider) GetFilePath(ctx context.Context, bucket, segmentName string) (string, error)
GetFilePath returns a presigned URL for the segment (valid for 1 hour)
func (*MinioProvider) ListFiles ¶ added in v0.8.0
func (m *MinioProvider) ListFiles(ctx context.Context, bucket string, streamPrefix string, startTime, endTime time.Time) ([]ArchiveSegmentInfo, error)
ListFiles lists archive segments in MinIO matching the stream prefix and time range
func (*MinioProvider) MakeBucket ¶
func (m *MinioProvider) MakeBucket(bucket string) error
func (*MinioProvider) Type ¶
func (m *MinioProvider) Type() StorageType
func (*MinioProvider) UploadFile ¶
func (m *MinioProvider) UploadFile(ctx context.Context, object ArchiveUnit) (string, error)
UploadFile loads file to MinIO. Do not provide FileName field in ArchiveUnit object if you want to use Payload bytes; otherwise file will be loaded from filesystem by FileName field
type StorageType ¶
type StorageType uint16
func NewStorageTypeFrom ¶
func NewStorageTypeFrom(str string) StorageType
func (StorageType) String ¶
func (iotaIdx StorageType) String() string
String returns string representation of the storage type