storage

package
v0.0.0-...-01f5b33 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultFileBlockSize = 4 * 1024 * 1024

DefaultFileBlockSize is used for the default parameter to split a file to several blocks todo: May Declare in elsewhere

Variables

This section is empty.

Functions

This section is empty.

Types

type FileInfo

type FileInfo struct {
	Name string
	Size int64
	Hash []byte

	BlockSize int64
	BlockHash [][]byte
}

FileInfo describe a file by the SHA512 checksum for itself and SHA512-256 of every block of it

func StatFile

func StatFile(filepath string, blockSize int64) (fi *FileInfo, err error)

StatFile return the FileInfo for a file in the disk

type LocalFileInfo

type LocalFileInfo struct {
	FileInfo
	Path       string
	LastModify time.Time
}

LocalFileInfo extends FileInfo with the filepath and modify time

func StatLocalFile

func StatLocalFile(filepath string, blockSize int64) (lf *LocalFileInfo, err error)

StatLocalFile return the LocalFileInfo for a file in the disk

type SeedInfo

type SeedInfo struct {
	Title     string     //展示给用户的Title
	Files     []FileInfo //包含的文件列表
	WellKnown []string   //已知提供下载的节点地址
	ExtraInfo []string   //附加展示给用户的信息
}

SeedInfo contains a list of Files and WellKnown Peers

Jump to

Keyboard shortcuts

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