qshell

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2016 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BLOCK_BITS = 22 // Indicate that the blocksize is 4M
	BLOCK_SIZE = 1 << BLOCK_BITS
)
View Source
const (
	MIN_DOWNLOAD_THREAD_COUNT = 1
	MAX_DOWNLOAD_THREAD_COUNT = 100
)
View Source
const (
	DEFAULT_PUT_THRESHOLD   int64 = 10 * 1024 * 1024 //10MB
	MIN_UPLOAD_THREAD_COUNT int64 = 1
	MAX_UPLOAD_THREAD_COUNT int64 = 2000
)
View Source
const (
	RETRY_MAX_TIMES = 5
	RETRY_INTERVAL  = time.Second * 1
	HTTP_TIMEOUT    = time.Second * 10
)
View Source
const (
	ZoneNB  = "nb"
	ZoneBC  = "bc"
	ZoneHN  = "hn"
	ZoneAWS = "aws"
	ZoneNA0 = "na0"
)

Variables

View Source
var (
	DEFAULT_API_HOST = ZoneNBConfig.ApiHost
)
View Source
var ZoneAWSConfig = ZoneConfig{
	UpHost:    "http://up.gdipper.com",
	RsHost:    "http://rs.gdipper.com",
	RsfHost:   "http://rsf.gdipper.com",
	IovipHost: "http://io.gdipper.com",
	ApiHost:   "http://api.gdipper.com",
}
View Source
var ZoneBCConfig = ZoneConfig{
	UpHost:    "http://up-z1.qiniu.com",
	RsHost:    "http://rs.qiniu.com",
	RsfHost:   "http://rsf-z1.qbox.me",
	IovipHost: "http://iovip-z1.qbox.me",
	ApiHost:   "http://api-z1.qiniu.com",
}
View Source
var ZoneHNConfig = ZoneConfig{
	UpHost:    "http://up-z2.qiniu.com",
	RsHost:    "http://rs.qiniu.com",
	RsfHost:   "http://rsf-z2.qbox.me",
	IovipHost: "http://iovip-z2.qbox.me",
	ApiHost:   "http://api-z2.qiniu.com",
}
View Source
var ZoneNA0Config = ZoneConfig{
	UpHost:    "http://upload-na0.qiniu.com",
	RsHost:    "http://rs-na0.qbox.me",
	RsfHost:   "http://rsf-na0.qbox.me",
	IovipHost: "http://iovip-na0.qbox.me",
	ApiHost:   "http://api-na0.qiniu.com",
}
View Source
var ZoneNBConfig = ZoneConfig{
	UpHost:    "http://up.qiniu.com",
	RsHost:    "http://rs.qiniu.com",
	RsfHost:   "http://rsf.qbox.me",
	IovipHost: "http://iovip.qbox.me",
	ApiHost:   "http://api.qiniu.com",
}

Functions

func BlockCount added in v1.3.7

func BlockCount(fsize int64) int

func CalSha1 added in v1.3.7

func CalSha1(b []byte, r io.Reader) ([]byte, error)

func CheckQrsync

func CheckQrsync(dirCacheResultFile string, listBucketResultFile string, ignoreLocalDir bool, prefix string)

func GetBuckets added in v1.4.6

func GetBuckets(mac *digest.Mac) (buckets []string, err error)

func GetCdnRegionalIps added in v1.7.5

func GetCdnRegionalIps(client *rs.Client, cname, isp, province string) (ips []string, err error)

func GetDomainsOfBucket added in v1.4.6

func GetDomainsOfBucket(mac *digest.Mac, bucket string) (domains []string, err error)

func GetEtag added in v1.3.7

func GetEtag(filename string) (etag string, err error)

func IsValidZone added in v1.6.0

func IsValidZone(zone string) (valid bool)

func M3u8FileList added in v1.4.1

func M3u8FileList(mac *digest.Mac, bucket string, m3u8Key string) (slicesToDelete []rs.EntryPath, err error)

func M3u8ReplaceDomain added in v1.7.8

func M3u8ReplaceDomain(mac *digest.Mac, bucket string, m3u8Key string, newDomain string) (err error)

replace and upload

func Md5Hex added in v1.6.2

func Md5Hex(from string) string

func Prefetch

func Prefetch(mac *digest.Mac, bucket, key string) (err error)

func PrivateUrl added in v1.3.7

func PrivateUrl(mac *digest.Mac, publicUrl string, deadline int64) string

func QiniuDownload added in v1.3.2

func QiniuDownload(threadCount int, downloadConfigFile string)

func QiniuUpload

func QiniuUpload(threadCount int, uploadConfig *UploadConfig)

func Saveas added in v1.3.9

func Saveas(mac *digest.Mac, publicUrl string, saveBucket string, saveKey string) (string, error)

func SetZone added in v1.6.0

func SetZone(zone string)

func Sync added in v1.6.0

func Sync(mac *digest.Mac, srcResUrl, bucket, key, upHostIp string) (hash string, err error)

func Unzip added in v1.3.7

func Unzip(zipFilePath string, unzipPath string) (err error)

Types

type Account

type Account struct {
	AccessKey string `json:"access_key"`
	SecretKey string `json:"secret_key"`
	Zone      string `json:"zone,omitempty"`
}

func (*Account) Get

func (this *Account) Get() (err error)

func (*Account) Set

func (this *Account) Set(accessKey string, secretKey string, zone string) (err error)

func (*Account) String

func (this *Account) String() string

func (*Account) ToJson

func (this *Account) ToJson() (jsonStr string, err error)

type AliListBucket

type AliListBucket struct {
	DataCenter      string
	AccessKeyId     string
	AccessKeySecret string
	Bucket          string
	Prefix          string
}

func (*AliListBucket) ListBucket

func (this *AliListBucket) ListBucket(listResultFile string) (err error)

type BatchItemRet added in v1.3.9

type BatchItemRet struct {
	Code int              `json:"code"`
	Data BatchItemRetData `json:"data"`
}

func BatchChgm added in v1.3.9

func BatchChgm(client rs.Client, entries []ChgmEntryPath) (ret []BatchItemRet, err error)

func BatchCopy added in v1.4.0

func BatchCopy(client rs.Client, entries []CopyEntryPath) (ret []BatchItemRet, err error)

func BatchDelete added in v1.3.9

func BatchDelete(client rs.Client, entries []rs.EntryPath) (ret []BatchItemRet, err error)

func BatchMove added in v1.3.9

func BatchMove(client rs.Client, entries []MoveEntryPath) (ret []BatchItemRet, err error)

func BatchRename added in v1.3.9

func BatchRename(client rs.Client, entries []RenameEntryPath) (ret []BatchItemRet, err error)

func BatchStat added in v1.4.4

func BatchStat(client rs.Client, entries []rs.EntryPath) (ret []BatchItemRet, err error)

type BatchItemRetData added in v1.3.9

type BatchItemRetData struct {
	Fsize    int    `json:"fsize,omitempty"`
	Hash     string `json:"hash,omitempty"`
	MimeType string `json:"mimeType,omitempty"`
	PutTime  int64  `json:"putTime,omitempty"`
	Error    string `json:"error,omitempty"`
}

type BatchPrefetchRequest added in v1.8.5

type BatchPrefetchRequest struct {
	Urls []string `json:"urls"`
}

type BatchPrefetchResponse added in v1.8.5

type BatchPrefetchResponse struct {
	Code        int      `json:"code"`
	Error       string   `json:"error"`
	RequestId   string   `json:"requestId"`
	InvalidUrls []string `json:"invalidUrls"`
	QuotaDay    int      `json:"quotaDay"`
	SurplusDay  int      `json:"surplusDay"`
}

func BatchPrefetch added in v1.8.5

func BatchPrefetch(client *rs.Client, urls []string) (batchPrefetchResponse BatchPrefetchResponse, err error)

type BatchRefreshRequest added in v1.7.9

type BatchRefreshRequest struct {
	Urls []string `json:"urls"`
}

type BatchRefreshResponse added in v1.8.5

type BatchRefreshResponse struct {
	Code          int      `json:"code"`
	Error         string   `json:"error"`
	RequestId     string   `json:"requestId"`
	InvalidUrls   []string `json:"invalidUrls"`
	InvalidDirs   []string `json:"invalidDirs"`
	UrlQuotaDay   int      `json:"urlQuotaDay"`
	UrlSurplusDay int      `json:"urlSurplusDay"`
	DirQuotaDay   int      `json:"dirQuotaDay"`
	DirSurplusDay int      `json:"dirSurplusDay"`
}

func BatchRefresh added in v1.5.2

func BatchRefresh(client *rs.Client, urls []string) (batchRefreshResp BatchRefreshResponse, err error)

type BucketDomain added in v1.4.1

type BucketDomain []string

type CdnIpInfo added in v1.7.5

type CdnIpInfo struct {
	LineCname []string `json:"LineCname"`
	CdnInfo   string   `json:"cdninfo"`
	IpAddress string   `json:"ipaddress"`
}

func GetCdnSupplierOfIp added in v1.7.5

func GetCdnSupplierOfIp(client *rs.Client, ip string) (cdnInfo CdnIpInfo, err error)

type ChgmEntryPath added in v1.3.9

type ChgmEntryPath struct {
	Bucket   string
	Key      string
	MimeType string
}

type CopyEntryPath added in v1.4.0

type CopyEntryPath struct {
	SrcBucket  string
	DestBucket string
	SrcKey     string
	DestKey    string
}

type DirCache

type DirCache struct {
}

func (*DirCache) Cache

func (this *DirCache) Cache(cacheRootPath string, cacheResultFile string) (fileCount int)

type DownloadConfig added in v1.3.2

type DownloadConfig struct {
	DestDir   string `json:"dest_dir"`
	Bucket    string `json:"bucket"`
	Domain    string `json:"domain"`
	AccessKey string `json:"access_key"`
	SecretKey string `json:"secret_key"`
	IsPrivate bool   `json:"is_private"`
	Prefix    string `json:"prefix,omitempty"`
	Suffix    string `json:"suffix,omitempty"`
	Referer   string `json:"referer,omitemtpy"`
	Zone      string `json:"zone,omitempty"`
}

type FetchResult added in v1.3.9

type FetchResult struct {
	Key  string `json:"key"`
	Hash string `json:"hash"`
}

func Fetch

func Fetch(mac *digest.Mac, remoteResUrl, bucket, key string) (fetchResult FetchResult, err error)

type FopResult

type FopResult struct {
	Cmd   string   `json:"cmd"`
	Code  int      `json:"code"`
	Desc  string   `json:"desc"`
	Error string   `json:"error,omitempty"`
	Hash  string   `json:"hash,omitempty"`
	Key   string   `json:"key,omitempty"`
	Keys  []string `json:"keys,omitempty"`
}

type FopRet

type FopRet struct {
	Id          string `json:"id"`
	Code        int    `json:"code"`
	Desc        string `json:"desc"`
	InputBucket string `json:"inputBucket,omitempty"`
	InputKey    string `json:"inputKey,omitempty"`
	Pipeline    string `json:"pipeline,omitempty"`
	Reqid       string `json:"reqid,omitempty"`
	Items       []FopResult
}

func (*FopRet) String

func (this *FopRet) String() string

type ListBucket

type ListBucket struct {
	Account
}

func (*ListBucket) List

func (this *ListBucket) List(bucket string, prefix string, listResultFile string) (retErr error)

type MoveEntryPath added in v1.3.9

type MoveEntryPath struct {
	SrcBucket  string
	DestBucket string
	SrcKey     string
	DestKey    string
}

type RSFop

type RSFop struct {
	Account
}

func (*RSFop) Prefop

func (this *RSFop) Prefop(persistentId string, fopRet *FopRet) (err error)

type RenameEntryPath added in v1.3.9

type RenameEntryPath struct {
	Bucket string
	OldKey string
	NewKey string
}

type SyncProgress added in v1.6.0

type SyncProgress struct {
	BlkCtxs   []rio.BlkputRet `json:"blk_ctxs"`
	Offset    int64           `json:"offset"`
	TotalSize int64           `json:"total_size"`
}

type UploadConfig

type UploadConfig struct {
	//basic config
	SrcDir    string `json:"src_dir"`
	AccessKey string `json:"access_key"`
	SecretKey string `json:"secret_key"`
	Bucket    string `json:"bucket"`

	//optional config
	FileList         string `json:"file_list,omitempty"`
	PutThreshold     int64  `json:"put_threshold,omitempty"`
	KeyPrefix        string `json:"key_prefix,omitempty"`
	IgnoreDir        bool   `json:"ignore_dir,omitempty"`
	Overwrite        bool   `json:"overwrite,omitempty"`
	CheckExists      bool   `json:"check_exists,omitempty"`
	CheckHash        bool   `json:"check_hash,omitempty"`
	CheckSize        bool   `json:"check_size,omitempty"`
	SkipFilePrefixes string `json:"skip_file_prefixes,omitempty"`
	SkipPathPrefixes string `json:"skip_path_prefixes,omitempty"`
	SkipFixedStrings string `json:"skip_fixed_strings,omitempty"`
	SkipSuffixes     string `json:"skip_suffixes,omitempty"`
	RescanLocal      bool   `json:"rescan_local,omitempty"`

	//advanced config
	Zone   string `json:"zone,omitempty"`
	UpHost string `json:"up_host,omitempty"`

	BindUpIp string `json:"bind_up_ip,omitempty"`
	BindRsIp string `json:"bind_rs_ip,omitempty"`

	//local network interface card config
	BindNicIp string `json:"bind_nic_ip,omitempty"`
	LogLevel  string `json:"log_level,omitempty"`
	LogFile   string `json:"log_file,omitempty"`
}

type UploadInfo added in v1.7.2

type UploadInfo struct {
	TotalFileCount int `json:"total_file_count"`
}

type ZoneConfig added in v1.6.0

type ZoneConfig struct {
	UpHost    string
	RsHost    string
	RsfHost   string
	IovipHost string
	ApiHost   string
}

Jump to

Keyboard shortcuts

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