destination

package
v7.25.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Destination

type Destination interface {
	PartWriter
	io.Closer

	// 切片
	Split(totalSize, partSize uint64, options *SplitOptions) ([]Part, error)

	// 数据目标 ID
	DestinationID() (string, error)

	// 获取文件,如果数据源不是文件,则返回 nil
	GetFile() *os.File
}

数据目标

func NewFileDestination

func NewFileDestination(filePath string) (Destination, error)

将文件封装为数据目标

func NewWriteAtCloserDestination

func NewWriteAtCloserDestination(wr WriteAtCloser, destinationID string) Destination

将 io.WriterAt + io.WriteSeeker + io.Closer 封装为数据目标

func NewWriteCloserDestination

func NewWriteCloserDestination(wr io.WriteCloser, destinationID string) Destination

将 io.WriteCloser 封装为数据目标

type Part

type Part interface {
	PartWriter

	// 分片大小
	Size() uint64

	// 分片偏移量
	Offset() uint64

	// 分片偏移量
	HaveDownloaded() uint64
}

分片

type PartWriter

type PartWriter interface {
	// 从 `io.Reader` 复制数据写入
	CopyFrom(io.Reader, func(uint64)) (uint64, error)
}

分片写入接口

type SplitOptions

type SplitOptions struct {
	// 只读可恢复记录仪介质
	Medium resumablerecorder.ReadableResumableRecorderMedium
}

切片选项

type WriteAtCloser

type WriteAtCloser interface {
	io.WriterAt
	io.WriteSeeker
	io.Closer
}

Jump to

Keyboard shortcuts

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