core

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Export

func Export(cid string) (path string)

func Import

func Import(cid, metaPath string)

func NewExporter

func NewExporter() *exporter

func NewImporter

func NewImporter() *importer

func SetUserInfoConfig

func SetUserInfoConfig() bool

Types

type ExportTask

type ExportTask struct {
	Dir  *dir.Dir
	File *NetFile
}

type ImportTask

type ImportTask struct {
	File *NetFile
}

type NetDir

type NetDir struct {
	Count int            `json:"count"`
	Path  []*NetDirTrace `json:"path"`
	Data  []*NetFile     `json:"data"`
}

115的网络目录

func ScanDirWithOffset

func ScanDirWithOffset(cid string, offset int) (*NetDir, error)

type NetDirTrace

type NetDirTrace struct {
	Name string `json:"name"`
}

type NetFile

type NetFile struct {
	// 有fid就是文件
	Fid string `json:"fid"`
	// 有cid但没有Fid,就是文件夹
	Cid string `json:"cid"`
	// 文件大小
	Size int    `json:"s"`
	Name string `json:"n"`
	Sha  string `json:"sha"`
	Pc   string `json:"pc"`
}

115的文件对象,这个对象指向的可能是文件,也可能是文件夹

func CreateNetFile

func CreateNetFile(fileInfo string) *NetFile

格式不对,创建NetFile不一定成功

func (*NetFile) Export

func (file *NetFile) Export() string

开启一定量的worker,通过channel接收任务,channel有一定的缓冲区 worker在接收到任务后执行任务,当遇到需要人机验证的时候,改变全局 变量,然后进入循环等待模式,期间一直检测,直到人机验证完成; Note: 只要用到Lock的地方,都要考虑超时问题 将当前网络文件的内容导出到目录中

func (*NetFile) Import

func (file *NetFile) Import() bool

导入时,要指定文件所属的Cid(文件夹),文件夹不存在就需要创建; 创建文件夹的方法是,指定这个文件夹的父文件夹,填入文件夹的名字 之后创建,返回Cid,在做这个任务的时候,Cid需要是创建好的文件夹; 创建文件夹的工作在调用这个函数的地方提前准备好,这里不涉及创建文 件夹

Jump to

Keyboard shortcuts

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