storage

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package storage contains the storage mechanism of segments and parts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory interface {
	// NewFile allocates a file
	NewFile(fileName string) (File, error)
}

Factory allows to allocate the storage behind init files, segments and parts.

func NewFactoryDisk

func NewFactoryDisk(dirPath string) Factory

NewFactoryDisk allocates a disk-backed factory.

func NewFactoryRAM

func NewFactoryRAM() Factory

NewFactoryRAM allocates a RAM-backed factory.

type File

type File interface {
	// Finalize finalizes the file, making it read-only.
	// It must always be called to avoid a memory leak.
	Finalize()

	// Remove removes the file from disk.
	Remove()

	// NewPart allocates a file part.
	NewPart() Part

	// Reader returns a ReadCloser to read the file.
	// Close() must always be called to avoid a memory leak.
	Reader() (io.ReadCloser, error)

	// Size returns the size of the file.
	Size() uint64
}

File is the underlying storage of a file.

type Part

type Part interface {
	// Writer returns a Writer to write the part.
	Writer() io.WriteSeeker

	// Reader returns a ReadCloser to read the part.
	// Close() must always be called to avoid a memory leak.
	Reader() (io.ReadCloser, error)
}

Part is the underlying storage of a HLS part.

Jump to

Keyboard shortcuts

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