當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Do.Destination方法代碼示例

本文整理匯總了Golang中github.com/eris-ltd/eris-cli/definitions.Do.Destination方法的典型用法代碼示例。如果您正苦於以下問題:Golang Do.Destination方法的具體用法?Golang Do.Destination怎麽用?Golang Do.Destination使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/eris-ltd/eris-cli/definitions.Do的用法示例。


在下文中一共展示了Do.Destination方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: ImportKey

func ImportKey(do *definitions.Do) error {

	do.Name = "keys"
	do.Operations.ContainerNumber = 1
	if err := srv.EnsureRunning(do); err != nil {
		return err
	}

	do.Operations.Interactive = false
	dir := path.Join(ErisContainerRoot, "keys", "data", do.Address)
	do.Operations.Args = []string{"mkdir", dir} //need to mkdir for import
	if err := srv.ExecService(do); err != nil {
		return err
	}
	//src on host

	if do.Source == "" {
		do.Source = filepath.Join(KeysPath, "data", do.Address, do.Address)
	}
	//dest in container
	do.Destination = dir

	if err := data.ImportData(do); err != nil {
		return err
	}
	return nil
}
開發者ID:mxjxn,項目名稱:eris-cli,代碼行數:27,代碼來源:writers.go

示例2: checkErisContainerRoot

// check path for ErisContainerRoot
// XXX this is opiniated & we may want to change in future
// for more flexibility with filesystem of data conts
func checkErisContainerRoot(do *definitions.Do, typ string) error {

	r, err := regexp.Compile(ErisContainerRoot)
	if err != nil {
		return err
	}

	switch typ {
	case "import":
		if r.MatchString(do.Destination) != true { //if not there join it
			do.Destination = path.Join(ErisContainerRoot, do.Destination)
			return nil
		} else { // matches: do nothing
			return nil
		}
	case "export":
		if r.MatchString(do.Source) != true {
			do.Source = path.Join(ErisContainerRoot, do.Source)
			return nil
		} else {
			return nil
		}
	}
	return nil
}
開發者ID:mxjxn,項目名稱:eris-cli,代碼行數:28,代碼來源:operate.go

示例3: ExportKey

func ExportKey(do *definitions.Do) error {

	do.Name = "keys"
	do.Operations.ContainerNumber = 1
	if err := srv.EnsureRunning(do); err != nil {
		return err
	}
	//destination on host
	if do.Destination == "" {
		do.Destination = filepath.Join(KeysPath, "data")
	}
	//src in container
	do.Source = path.Join(ErisContainerRoot, "keys", "data", do.Address)
	if err := data.ExportData(do); err != nil {
		return err
	}
	return nil
}
開發者ID:mxjxn,項目名稱:eris-cli,代碼行數:18,代碼來源:writers.go


注:本文中的github.com/eris-ltd/eris-cli/definitions.Do.Destination方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。