core

package
v0.0.0-...-ebf47cb Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: MIT Imports: 12 Imported by: 9

Documentation

Index

Constants

View Source
const (
	VERSION        = "1.0.0.1"
	BLOCK_SIZE int = 4 * 1024 * 1024
)
View Source
const (
	BlockSize = 1 << blockBits
)
View Source
const (
	MAX_APPEND_SIZE = 2 * 1024 * 1024 * 1024
)

Variables

This section is empty.

Functions

func BlockCount

func BlockCount(fsize int64) int64

BlockCount 用来计算文件的分块数量

func FOps

func FOps(auth *utility.Auth, config *Config, client *http.Client, query string) (response *http.Response, err error)

func InnerFOps

func InnerFOps(auth *utility.Auth, client *http.Client, url string, query string) (response *http.Response, err error)

Types

type AppendUpload

type AppendUpload struct {
	// contains filtered or unexported fields
}

func NewAppendUpload

func NewAppendUpload(auth *utility.Auth, config *Config, client *http.Client) (su *AppendUpload)

func (*AppendUpload) AppendData

func (this *AppendUpload) AppendData(data []byte, position int, put_policy string, key string, put_extra *PutExtra) (response *http.Response, err error)

func (*AppendUpload) AppendFile

func (this *AppendUpload) AppendFile(local_filename string, position int, put_policy string, key string, put_extra *PutExtra) (response *http.Response, err error)

type BucketManager

type BucketManager struct {
	// contains filtered or unexported fields
}

func NewBucketManager

func NewBucketManager(auth *utility.Auth, config *Config, client *http.Client) (bm *BucketManager)

func (*BucketManager) AvInfo

func (this *BucketManager) AvInfo(av_url string) (response *http.Response, err error)

获取影视频元数据(avinfo) https://wcs.chinanetcenter.com/document/API/ResourceManage/avinfo

func (*BucketManager) AvInfo2

func (this *BucketManager) AvInfo2(av_url string) (response *http.Response, err error)

获取音视频简单元数据(avinfo2) https://wcs.chinanetcenter.com/document/API/ResourceManage/avinfo2

func (*BucketManager) BucketStat

func (this *BucketManager) BucketStat(bucket_names string, startdate string, enddate string) (response *http.Response, err error)

获取空间存储量(bucket stat) https://wcs.chinanetcenter.com/document/API/ResourceManage/bucketstat

bucket_names 格式:<bucket_name1>|<bucket_name2>|……
startdate 是 统计开始时间,格式为yyyy-mm-dd
enddate 是 统计结束时间,格式为yyyy-mm-dd 注:查询的时间跨度最长为六个月

func (*BucketManager) Copy

func (this *BucketManager) Copy(src string, dst string) (response *http.Response, err error)

复制资源(copy) https://wcs.chinanetcenter.com/document/API/ResourceManage/copy

func (*BucketManager) Decompression

func (this *BucketManager) Decompression(bucket string, key string, format string, directory string, save_list string, notify_url string, force int, separate int) (response *http.Response, err error)

文件解压缩 https://wcs.chinanetcenter.com/document/API/ResourceManage/decompression

func (*BucketManager) Delete

func (this *BucketManager) Delete(bucket string, key string) (response *http.Response, err error)

删除文件(delete) https://wcs.chinanetcenter.com/document/API/ResourceManage/delete

func (*BucketManager) Exif

func (this *BucketManager) Exif(image_url string) (response *http.Response, err error)

获取图片 EXIF 信息 https://wcs.chinanetcenter.com/document/API/ResourceManage/exif

func (*BucketManager) ImageInfo

func (this *BucketManager) ImageInfo(image_url string) (response *http.Response, err error)

获取图片基本信息(imageInfo) https://wcs.chinanetcenter.com/document/API/ResourceManage/imageInfo

func (*BucketManager) List

func (this *BucketManager) List(bucket string, limit int, prefix string, mode int, marker string) (response *http.Response, err error)

列举资源(list) https://wcs.chinanetcenter.com/document/API/ResourceManage/list

func (*BucketManager) ListBucket

func (this *BucketManager) ListBucket() (response *http.Response, err error)

列举空间(list bucket) https://wcs.chinanetcenter.com/document/API/ResourceManage/listbucket

func (*BucketManager) Move

func (this *BucketManager) Move(src string, dst string) (response *http.Response, err error)

移动资源(move) https://wcs.chinanetcenter.com/document/API/ResourceManage/move

func (*BucketManager) PersistentStatus

func (this *BucketManager) PersistentStatus(persistent_id string) (response *http.Response, err error)

查询持久化处理状态(status) https://wcs.chinanetcenter.com/document/API/ResourceManage/PersistentStatus

func (*BucketManager) Prefetch

func (this *BucketManager) Prefetch(bucket_file_keys string) (response *http.Response, err error)

更新镜像资源 https://wcs.chinanetcenter.com/document/API/ResourceManage/prefetch

bucket_file_keys 格式:空间名+":"+文件名1|文件名2|文件名3…

func (*BucketManager) SetDeadline

func (this *BucketManager) SetDeadline(bucket string, key string, deadline int, relevance int) (response *http.Response, err error)

设置文件保存期限 https://wcs.chinanetcenter.com/document/API/ResourceManage/setdeadline

func (*BucketManager) Stat

func (this *BucketManager) Stat(bucket string, key string) (response *http.Response, err error)

获取文件信息(stat) https://wcs.chinanetcenter.com/document/API/ResourceManage/stat

type CommonResult

type CommonResult struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type Config

type Config struct {
	UseHttps   bool
	UploadHost string
	ManageHost string
}

func NewConfig

func NewConfig(useHttp bool, upload_host string, manage_host string) (config *Config)

func NewDefaultConfig

func NewDefaultConfig() (config *Config)

func (*Config) GetManageUrlPrefix

func (config *Config) GetManageUrlPrefix() (url_prefix string)

func (*Config) GetUploadUrlPrefix

func (config *Config) GetUploadUrlPrefix() (url_prefix string)

type CopyInfo

type CopyInfo struct {
	// contains filtered or unexported fields
}

type DeleteInfo

type DeleteInfo struct {
	// contains filtered or unexported fields
}

type DeleteM3u8Info

type DeleteM3u8Info struct {
	// contains filtered or unexported fields
}

type DeletePrefixInfo

type DeletePrefixInfo struct {
	// contains filtered or unexported fields
}

type FetchInfo

type FetchInfo struct {
	// contains filtered or unexported fields
}

type FileManager

type FileManager struct {
	// contains filtered or unexported fields
}

func NewFileManager

func NewFileManager(auth *utility.Auth, config *Config, client *http.Client) (fm *FileManager)

func (*FileManager) Copy

func (this *FileManager) Copy(resource string, bucket string, key string, prefix string, notify_url string, separate int) (response *http.Response, err error)

复制资源(fmgr/copy) https://wcs.chinanetcenter.com/document/API/Fmgr/copy

func (*FileManager) CopyMultiple

func (this *FileManager) CopyMultiple(copy_info []CopyInfo, notify_url string, separate int) (response *http.Response, err error)

func (*FileManager) Delete

func (this *FileManager) Delete(bucket string, key string, notify_url string, separate int) (response *http.Response, err error)

删除资源 https://wcs.chinanetcenter.com/document/API/Fmgr/delete Delete bucket:key

func (*FileManager) DeleteM3u8

func (this *FileManager) DeleteM3u8(bucket string, key string, deletets int, notify_url string, separate int) (response *http.Response, err error)

删除m3u8文件 https://wcs.chinanetcenter.com/document/API/Fmgr/deletem3u8

func (*FileManager) DeleteM3u8Multiple

func (this *FileManager) DeleteM3u8Multiple(delete_m3u8_info []DeleteM3u8Info, notify_url string, separate int) (response *http.Response, err error)

func (*FileManager) DeleteMultiple

func (this *FileManager) DeleteMultiple(delete_info []DeleteInfo, notify_url string, separate int) (response *http.Response, err error)

func (*FileManager) DeletePrefix

func (this *FileManager) DeletePrefix(bucket string, prefix string, output string, notify_url string, separate int) (response *http.Response, err error)

按前缀删除资源 https://wcs.chinanetcenter.com/document/API/Fmgr/deletePrefix

func (*FileManager) DeletePrefixMultiple

func (this *FileManager) DeletePrefixMultiple(delete_prefix_info []DeletePrefixInfo, notify_url string, separate int) (response *http.Response, err error)

func (*FileManager) Fetch

func (this *FileManager) Fetch(fetch_url string, bucket string, key string, prefix string, md5 string, decompression string,
	notify_url string, force int, separate int) (response *http.Response, err error)

抓取资源(fmgr/fetch) https://wcs.chinanetcenter.com/document/API/Fmgr/fetch Copy resource to bucket:key

func (*FileManager) FetchMultiple

func (this *FileManager) FetchMultiple(fetch_info []FetchInfo,
	notify_url string, force int, separate int) (response *http.Response, err error)

func (*FileManager) Move

func (this *FileManager) Move(resource string, bucket string, key string, prefix string, notify_url string, separate int) (response *http.Response, err error)

移动资源 https://wcs.chinanetcenter.com/document/API/Fmgr/move Move resource to bucket:key

func (*FileManager) MoveMultiple

func (this *FileManager) MoveMultiple(move_info []MoveInfo, notify_url string, separate int) (response *http.Response, err error)

func (*FileManager) SetDeadline

func (this *FileManager) SetDeadline(bucket string, prefix string, deadline int, notify_url string, separate int) (response *http.Response, err error)

批量修改文件保存期限 https://wcs.chinanetcenter.com/document/API/Fmgr/setdeadline

func (*FileManager) SetDeadlineMultiple

func (this *FileManager) SetDeadlineMultiple(set_deadline_info []SetDeadlineInfo, notify_url string, separate int) (response *http.Response, err error)

func (*FileManager) Status

func (this *FileManager) Status(persistent_id string) (response *http.Response, err error)

fmgr任务查询(fmgr/status) https://wcs.chinanetcenter.com/document/API/Fmgr/status

type ImageOp

type ImageOp struct {
	// contains filtered or unexported fields
}

func NewImageOp

func NewImageOp(auth *utility.Auth, config *Config, client *http.Client) (bm *ImageOp)

func (*ImageOp) ImageDetect

func (this *ImageOp) ImageDetect(image string, _type string, bucket string) (response *http.Response, err error)

图片鉴定 https://wcs.chinanetcenter.com/document/API/Image-op/imageDetect type: porn-鉴黄,terror-暴恐,political-政治人物识别

func (*ImageOp) ImagePersistentOp

func (this *ImageOp) ImagePersistentOp(bucket string, key string, fops string, notify_url string, force int, separate int) (response *http.Response, err error)

图片持久化处理 https://wcs.chinanetcenter.com/document/API/Image-op/imagePersistentOp

type MoveInfo

type MoveInfo struct {
	// contains filtered or unexported fields
}

type PutExtra

type PutExtra struct {
	Params   map[string]string // 上传可选参数字典,参数名次以 x: 开头
	MimeType string            // 指定文件的 MimeType
	Deadline int               // 文件保存期限。超过保存天数文件自动删除,单位:天。例如:1、2、3……注:0表示尽快删除,上传文件时建议不配置为0
}

func NewDefaultPutExtra

func NewDefaultPutExtra() (put_extra *PutExtra)

func NewPutExtra

func NewPutExtra(deadline int) (put_extra *PutExtra)

type SetDeadlineInfo

type SetDeadlineInfo struct {
	// contains filtered or unexported fields
}

type SimpleUpload

type SimpleUpload struct {
	// contains filtered or unexported fields
}

func NewSimpleUpload

func NewSimpleUpload(auth *utility.Auth, config *Config, client *http.Client) (su *SimpleUpload)

func (*SimpleUpload) UploadData

func (this *SimpleUpload) UploadData(data []byte, put_policy string, key string, put_extra *PutExtra) (response *http.Response, err error)

<summary> 上传数据 putPolicy 中的 JSON 字符串是严格模式,不允许最后一个元素后面有逗号 https://stackoverflow.com/questions/201782/can-you-use-a-trailing-comma-in-a-json-object 请确保 JSON 字符串的正确性和紧凑性,最好用 JSON 库生成,而不要自己用字符串拼接。 </summary> <param name="data">待上传的数据</param> <param name="put_policy">上传策略数据,JSON 字符串</param> <param name="key">可选,要保存的key</param> <param name="put_extra">可选,上传可选设置</param> <returns>上传数据后的返回结果</returns>

func (*SimpleUpload) UploadFile

func (this *SimpleUpload) UploadFile(local_filename string, put_policy string, key string, put_extra *PutExtra) (response *http.Response, err error)

type SliceUpload

type SliceUpload struct {
	// contains filtered or unexported fields
}

func NewSliceUpload

func NewSliceUpload(auth *utility.Auth, config *Config, client *http.Client) (su *SliceUpload)

func (*SliceUpload) Bput

func (this *SliceUpload) Bput(context string, offset int64, chunk []byte, upload_token string, key string) (response *http.Response, err error)

func (*SliceUpload) MakeBlock

func (this *SliceUpload) MakeBlock(block_size int64, block_order int64, chunk []byte, upload_token string, key string) (response *http.Response, err error)

func (*SliceUpload) MakeFile

func (this *SliceUpload) MakeFile(size int64, key string, contexts []string, upload_token string, put_extra *PutExtra) (response *http.Response, err error)

func (*SliceUpload) UploadFile

func (this *SliceUpload) UploadFile(local_filename string, put_policy string, key string, put_extra *PutExtra) (response *http.Response, err error)

type SliceUploadResult

type SliceUploadResult struct {
	Context  string `json:"ctx"`
	Checksum string `json:"checksum"`
	CRC32    uint   `json:"crc32"`
	Offset   uint64 `json:"offset"`
}

Jump to

Keyboard shortcuts

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