示例#1
0
func (self *UpRPut) Init(conf, env, path string) (err error) {

	if err = config.LoadEx(self, conf); err != nil {
		err = errors.Info(err, "UpResuPut init failed")
		return
	}
	if err = config.LoadEx(&self.Env, env); err != nil {
		err = errors.Info(err, "UpEnv init failed")
		return
	}
	self.DataFile = filepath.Join(path, self.DataFile)
	dt := digest.NewTransport(self.Env.AccessKey, self.Env.SecretKey, nil)
	host := self.Env.Hosts["up"]
	ip := self.Env.Ips["up"]

	self.Rscli, err = rs.New(self.Env.Hosts, self.Env.Ips, dt)
	if err != nil {
		err = errors.Info(err, "Rscli init failed")
		return
	}
	self.Up2cli, err = up2.New(host, ip, self.BlockBits, self.ChunkSize, self.PutRetryTimes, dt)
	if err != nil {
		err = errors.Info(err, "Up2cli init failed")
		return
	}
	return
}
示例#2
0
文件: api_test.go 项目: shtlee/qa
func Init() (err error) {

	dt := digest.NewTransport(AccessKey, SecretKey, nil)
	Up2cli, err = up2.New(hosts["up"], ips["up"], BlockBits, RPutChunkSize, RPutRetryTimes, dt)
	if err != nil {
		return
	}
	Rscli, err = rs.New(hosts, ips, dt)
	if err != nil {
		return
	}
	return
}