• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang uuid.NewRandom函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/pborman/uuid.NewRandom函数的典型用法代码示例。如果您正苦于以下问题:Golang NewRandom函数的具体用法?Golang NewRandom怎么用?Golang NewRandom使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NewRandom函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: getSessionSecrets

func getSessionSecrets(filename string) ([]string, error) {
	// Build secrets list
	secrets := []string{}

	if len(filename) != 0 {
		sessionSecrets, err := latest.ReadSessionSecrets(filename)
		if err != nil {
			return nil, fmt.Errorf("error reading sessionSecretsFile %s: %v", filename, err)
		}

		if len(sessionSecrets.Secrets) == 0 {
			return nil, fmt.Errorf("sessionSecretsFile %s contained no secrets", filename)
		}

		for _, s := range sessionSecrets.Secrets {
			secrets = append(secrets, s.Authentication)
			secrets = append(secrets, s.Encryption)
		}
	} else {
		// Generate random signing and encryption secrets if none are specified in config
		secrets = append(secrets, fmt.Sprintf("%x", md5.Sum([]byte(uuid.NewRandom().String()))))
		secrets = append(secrets, fmt.Sprintf("%x", md5.Sum([]byte(uuid.NewRandom().String()))))
	}

	return secrets, nil
}
开发者ID:pweil-,项目名称:origin,代码行数:26,代码来源:auth_config.go


示例2: TestValidateXattrSupport

func TestValidateXattrSupport(t *testing.T) {
	defer heketitests.Patch(&Setxattr, tests.MockSetxattr).Restore()
	defer heketitests.Patch(&Getxattr, tests.MockGetxattr).Restore()
	defer heketitests.Patch(&Removexattr, tests.MockRemovexattr).Restore()
	tests.Assert(t, ValidateXattrSupport("/tmp/b1", "localhost", uuid.NewRandom(), true) == nil)

	// Some negative tests
	var xattr_err error
	baderror := errors.New("Bad")
	xattr_err = baderror

	// Now check what happens when setxattr fails
	defer heketitests.Patch(&Setxattr, func(path string, attr string, data []byte, flags int) (err error) {
		return xattr_err
	}).Restore()
	tests.Assert(t, ValidateXattrSupport("/tmp/b1", "localhost", uuid.NewRandom(), true) == baderror)

	// Now check what happens when getxattr fails
	defer heketitests.Patch(&Getxattr, func(path string, attr string, dest []byte) (sz int, err error) {
		return 0, xattr_err
	}).Restore()
	tests.Assert(t, ValidateXattrSupport("/tmp/b1", "localhost", uuid.NewRandom(), true) == baderror)

	// Now check what happens when removexattr fails
	defer heketitests.Patch(&Removexattr, func(path string, attr string) (err error) {
		return xattr_err
	}).Restore()
	tests.Assert(t, ValidateXattrSupport("/tmp/b1", "localhost", uuid.NewRandom(), true) == baderror)

}
开发者ID:anekkunt,项目名称:glusterd2,代码行数:30,代码来源:utils_test.go


示例3: GenerateAccessToken

// GenerateAccessToken generates base64-encoded UUID access and refresh tokens
func (a *AccessTokenGenDefault) GenerateAccessToken(c context.Context, data *AccessData, generaterefresh bool) (accesstoken string, refreshtoken string, err error) {
	token := uuid.NewRandom()
	accesstoken = removePadding(base64.URLEncoding.EncodeToString([]byte(token)))

	if generaterefresh {
		rtoken := uuid.NewRandom()
		refreshtoken = removePadding(base64.URLEncoding.EncodeToString([]byte(rtoken)))
	}
	return
}
开发者ID:credli,项目名称:osin,代码行数:11,代码来源:tokengen.go


示例4: SendWhileRunning

func (s *btrfsMigrationSourceDriver) SendWhileRunning(conn *websocket.Conn, op *operation) error {
	if s.container.IsSnapshot() {
		tmpPath := containerPath(fmt.Sprintf("%s/.migration-send-%s", s.container.Name(), uuid.NewRandom().String()), true)
		err := os.MkdirAll(tmpPath, 0700)
		if err != nil {
			return err
		}

		btrfsPath := fmt.Sprintf("%s/.root", tmpPath)
		if err := s.btrfs.subvolSnapshot(s.container.Path(), btrfsPath, true); err != nil {
			return err
		}

		defer s.btrfs.subvolDelete(btrfsPath)

		wrapper := StorageProgressReader(op, "fs_progress", s.container.Name())
		return s.send(conn, btrfsPath, "", wrapper)
	}

	for i, snap := range s.snapshots {
		prev := ""
		if i > 0 {
			prev = s.snapshots[i-1].Path()
		}

		wrapper := StorageProgressReader(op, "fs_progress", snap.Name())
		if err := s.send(conn, snap.Path(), prev, wrapper); err != nil {
			return err
		}
	}

	/* We can't send running fses, so let's snapshot the fs and send
	 * the snapshot.
	 */
	tmpPath := containerPath(fmt.Sprintf("%s/.migration-send-%s", s.container.Name(), uuid.NewRandom().String()), true)
	err := os.MkdirAll(tmpPath, 0700)
	if err != nil {
		return err
	}

	s.runningSnapName = fmt.Sprintf("%s/.root", tmpPath)
	if err := s.btrfs.subvolSnapshot(s.container.Path(), s.runningSnapName, true); err != nil {
		return err
	}

	btrfsParent := ""
	if len(s.btrfsSnapshotNames) > 0 {
		btrfsParent = s.btrfsSnapshotNames[len(s.btrfsSnapshotNames)-1]
	}

	wrapper := StorageProgressReader(op, "fs_progress", s.container.Name())
	return s.send(conn, s.runningSnapName, btrfsParent, wrapper)
}
开发者ID:akshaykarle,项目名称:lxd,代码行数:53,代码来源:storage_btrfs.go


示例5: WithAudit

// WithAudit decorates a http.Handler with audit logging information for all the
// requests coming to the server. Each audit log contains two entries:
// 1. the request line containing:
//    - unique id allowing to match the response line (see 2)
//    - source ip of the request
//    - HTTP method being invoked
//    - original user invoking the operation
//    - impersonated user for the operation
//    - namespace of the request or <none>
//    - uri is the full URI as requested
// 2. the response line containing:
//    - the unique id from 1
//    - response code
func WithAudit(handler http.Handler, attributeGetter apiserver.RequestAttributeGetter, out io.Writer) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
		attribs := attributeGetter.GetAttribs(req)
		asuser := req.Header.Get(authenticationapi.ImpersonateUserHeader)
		if len(asuser) == 0 {
			asuser = "<self>"
		}
		asgroups := "<lookup>"
		requestedGroups := req.Header[authenticationapi.ImpersonateGroupHeader]
		if len(requestedGroups) > 0 {
			quotedGroups := make([]string, len(requestedGroups))
			for i, group := range requestedGroups {
				quotedGroups[i] = fmt.Sprintf("%q", group)
			}
			asgroups = strings.Join(quotedGroups, ", ")
		}
		namespace := attribs.GetNamespace()
		if len(namespace) == 0 {
			namespace = "<none>"
		}
		id := uuid.NewRandom().String()

		line := fmt.Sprintf("%s AUDIT: id=%q ip=%q method=%q user=%q as=%q asgroups=%q namespace=%q uri=%q\n",
			time.Now().Format(time.RFC3339Nano), id, utilnet.GetClientIP(req), req.Method, attribs.GetUser().GetName(), asuser, asgroups, namespace, req.URL)
		if _, err := fmt.Fprint(out, line); err != nil {
			glog.Errorf("Unable to write audit log: %s, the error is: %v", line, err)
		}
		respWriter := decorateResponseWriter(w, out, id)
		handler.ServeHTTP(respWriter, req)
	})
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:44,代码来源:audit.go


示例6: WithAudit

// WithAudit decorates a http.Handler with audit logging information for all the
// requests coming to the server. If out is nil, no decoration takes place.
// Each audit log contains two entries:
// 1. the request line containing:
//    - unique id allowing to match the response line (see 2)
//    - source ip of the request
//    - HTTP method being invoked
//    - original user invoking the operation
//    - impersonated user for the operation
//    - namespace of the request or <none>
//    - uri is the full URI as requested
// 2. the response line containing:
//    - the unique id from 1
//    - response code
func WithAudit(handler http.Handler, attributeGetter RequestAttributeGetter, out io.Writer) http.Handler {
	if out == nil {
		return handler
	}
	return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
		attribs, err := attributeGetter.GetAttribs(req)
		if err != nil {
			internalError(w, req, err)
			return
		}
		asuser := req.Header.Get("Impersonate-User")
		if len(asuser) == 0 {
			asuser = "<self>"
		}
		namespace := attribs.GetNamespace()
		if len(namespace) == 0 {
			namespace = "<none>"
		}
		id := uuid.NewRandom().String()

		line := fmt.Sprintf("%s AUDIT: id=%q ip=%q method=%q user=%q as=%q namespace=%q uri=%q\n",
			time.Now().Format(time.RFC3339Nano), id, utilnet.GetClientIP(req), req.Method, attribs.GetUser().GetName(), asuser, namespace, req.URL)
		if _, err := fmt.Fprint(out, line); err != nil {
			glog.Errorf("Unable to write audit log: %s, the error is: %v", line, err)
		}
		respWriter := decorateResponseWriter(w, out, id)
		handler.ServeHTTP(respWriter, req)
	})
}
开发者ID:bryk,项目名称:kubernetes,代码行数:43,代码来源:audit.go


示例7: TestGuessAuthToken

func (s *OptionsSuite) TestGuessAuthToken() {
	tmpFile, err := ioutil.TempFile("", "test-auth-token")
	s.Nil(err)

	token := uuid.NewRandom().String()
	_, err = tmpFile.Write([]byte(token))
	s.Nil(err)

	tokenStore := tmpFile.Name()
	defer os.Remove(tokenStore)
	defer tmpFile.Close()

	args := []string{
		"wercker",
		"--auth-token-store", tokenStore,
		"test",
	}

	test := func(c *cli.Context) {
		opts, err := core.NewGlobalOptions(util.NewCLISettings(c), emptyEnv())
		s.Nil(err)
		s.Equal(token, opts.AuthToken)
	}

	run(s, globalFlags, emptyFlags, test, args)
}
开发者ID:rlugojr,项目名称:wercker,代码行数:26,代码来源:options_test.go


示例8: CreateRetentionPolicy

func (db *DB) CreateRetentionPolicy(expiry uint) (uuid.UUID, error) {
	id := uuid.NewRandom()
	return id, db.Exec(
		`INSERT INTO retention (uuid, expiry) VALUES (?, ?)`,
		id.String(), expiry,
	)
}
开发者ID:starkandwayne,项目名称:shield,代码行数:7,代码来源:retention.go


示例9: runProcessor

func (p *ProcessorPool) runProcessor(queue JobQueue) error {
	processorUUID := uuid.NewRandom()
	ctx := context.FromProcessor(p.Context, processorUUID.String())

	jobsChan, err := queue.Jobs(ctx)
	if err != nil {
		context.LoggerFromContext(p.Context).WithField("err", err).Error("couldn't create jobs channel")
		return err
	}

	proc, err := NewProcessor(ctx, p.Hostname, jobsChan, p.Provider, p.Generator, p.Canceller, p.HardTimeout, p.LogTimeout)
	if err != nil {
		context.LoggerFromContext(p.Context).WithField("err", err).Error("couldn't create processor")
		return err
	}

	proc.SkipShutdownOnLogTimeout = p.SkipShutdownOnLogTimeout

	p.processorsLock.Lock()
	p.processors = append(p.processors, proc)
	p.processorsLock.Unlock()

	proc.Run()
	return nil
}
开发者ID:henrikhodne-abandoned,项目名称:worker,代码行数:25,代码来源:processor_pool.go


示例10: NewDeployOptions

// NewDeployOptions constructor
func NewDeployOptions(c util.Settings, e *util.Environment) (*PipelineOptions, error) {
	pipelineOpts, err := NewPipelineOptions(c, e)
	if err != nil {
		return nil, err
	}
	// default to last build output if none defined
	target, _ := c.String("target")
	if target == "" {
		found, err := util.Exists("./.wercker/latest/output")
		if err == nil && found {
			util.RootLogger().Println("No target specified, using recent build output.")
			pipelineOpts.ProjectPath, _ = filepath.Abs("./.wercker/latest/output")
		}
	}

	// if the deploy target path does not have a wercker.yml, use the current one
	werckerYml, _ := c.String("wercker-yml")
	if werckerYml == "" {
		found, _ := util.Exists(filepath.Join(pipelineOpts.ProjectPath, "wercker.yml"))
		if !found {
			pipelineOpts.WerckerYml = "./wercker.yml"
		}
	}

	if pipelineOpts.RunID == "" {
		pipelineOpts.RunID = uuid.NewRandom().String()
	}
	return pipelineOpts, nil
}
开发者ID:wercker,项目名称:wercker,代码行数:30,代码来源:options.go


示例11: committer

func (f *StreamAggregatorFilter) committer(fr FilterRunner, h PluginHelper, wg *sync.WaitGroup) {
	initBatch := make([]byte, 0, 10000)
	f.backChan <- initBatch
	var (
		tag      string
		outBatch []byte
	)
	tag = f.StreamAggregatorTag

	for outBatch = range f.batchChan {
		pack, e := h.PipelinePack(f.msgLoopCount)
		if e != nil {
			fr.LogError(e)
			break
		}

		tagField, _ := message.NewField("StreamAggregatorTag", tag, "")
		pack.Message.AddField(tagField)
		pack.Message.SetUuid(uuid.NewRandom())
		if f.OutputType == "json" {
			jsonStr := strings.TrimRight(string(outBatch), ",")
			pack.Message.SetPayload("[" + jsonStr + "]")
		} else {
			pack.Message.SetPayload(string(outBatch))
		}
		fr.Inject(pack)

		outBatch = outBatch[:0]
		f.backChan <- outBatch
	}
	wg.Done()
}
开发者ID:huhongbo,项目名称:heka-stream-aggregator,代码行数:32,代码来源:stream_aggregator_filter.go


示例12: eventsSocket

func eventsSocket(r *http.Request, w http.ResponseWriter) error {
	listener := eventListener{}

	typeStr := r.FormValue("type")
	if typeStr == "" {
		typeStr = "logging,operation"
	}

	c, err := shared.WebsocketUpgrader.Upgrade(w, r, nil)
	if err != nil {
		return err
	}

	listener.active = make(chan bool, 1)
	listener.connection = c
	listener.id = uuid.NewRandom().String()
	listener.messageTypes = strings.Split(typeStr, ",")

	eventsLock.Lock()
	eventListeners[listener.id] = &listener
	eventsLock.Unlock()

	shared.Debugf("New events listener: %s", listener.id)

	<-listener.active

	return nil
}
开发者ID:mickydelfavero,项目名称:lxd,代码行数:28,代码来源:events.go


示例13: getRandVolume

func getRandVolume() *Volinfo {
	v := NewVolinfoFunc()

	v.ID = uuid.NewRandom()
	v.Name = fmt.Sprintf("volume-%d", atomic.AddUint64(&volCount, 1))
	v.Type = DistReplicate
	brickCount := uint64(rand.Intn(256) + 1)
	for i := uint64(1); i <= brickCount; i++ {
		//v.Bricks = append(v.Bricks, fmt.Sprintf("host:/brick-%d", i))
		v.Bricks[i].Hostname = "Host"
		v.Bricks[i].Path = fmt.Sprintf("/brick-%d", i)
		v.Bricks[i].ID = v.ID
	}
	v.DistCount = uint64(rand.Intn(256) + 1)
	v.ReplicaCount = uint16(rand.Intn(10))
	v.StripeCount = uint16(rand.Intn(10))
	v.DisperseCount = uint16(rand.Intn(10))
	v.RedundancyCount = uint16(rand.Intn(10))

	v.Status = VolCreated

	v.Checksum = uint64(rand.Uint32())
	v.Version = 1

	return v
}
开发者ID:anekkunt,项目名称:glusterd2,代码行数:26,代码来源:utils_misc.go


示例14: buildPodManifest

func (img *Image) buildPodManifest(exec []string) *schema.PodManifest {
	bpm := schema.BlankPodManifest()

	// Figure out working path that doesn't exist in the image's rootfs
	workDir := ".jetpack.build."
	for {
		if _, err := os.Stat(img.getRootfs().Path(workDir)); err != nil {
			if os.IsNotExist(err) {
				break
			}
			panic(err)
		}
		workDir = fmt.Sprintf(".jetpack.build.%v", uuid.NewRandom())
	}

	bprta := img.RuntimeApp()
	bprta.Name.Set("jetpack/build")
	bprta.App = &types.App{
		Exec:             exec,
		WorkingDirectory: "/" + workDir,
		User:             "0",
		Group:            "0",
	}
	bpm.Apps = append(bpm.Apps, bprta)

	// This is needed by freebsd-update at least, should be okay to
	// allow this in builders.
	bpm.Annotations.Set("jetpack/jail.conf/allow.chflags", "true")
	bpm.Annotations.Set("jetpack/jail.conf/securelevel", "0")

	return bpm
}
开发者ID:saper,项目名称:jetpack,代码行数:32,代码来源:build.go


示例15: newNotice

func newNotice(config *Configuration, err Error, extra ...interface{}) *Notice {
	notice := Notice{
		APIKey:       config.APIKey,
		Error:        err,
		Token:        uuid.NewRandom().String(),
		ErrorMessage: err.Message,
		ErrorClass:   err.Class,
		Env:          config.Env,
		Hostname:     config.Hostname,
		Backtrace:    composeStack(err.Stack, config.Root),
		ProjectRoot:  config.Root,
		Context:      Context{},
	}

	for _, thing := range extra {
		switch t := thing.(type) {
		case Context:
			notice.setContext(t)
		case Params:
			notice.Params = t
		case CGIData:
			notice.CGIData = t
		case url.URL:
			notice.URL = t.String()
		}
	}

	return &notice
}
开发者ID:jorjeb,项目名称:smart_app,代码行数:29,代码来源:notice.go


示例16: AddComment

func AddComment(w rest.ResponseWriter, req *rest.Request) {
	requesterID := GetRequesterID(req)
	var comment types.Comment
	err := req.DecodeJsonPayload(&comment)
	if err != nil {
		log.Println(err)
		rest.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	comment.Time = time.Now().UTC()
	comment.PostID = req.PathParam("pid")
	comment.CreatorID = requesterID
	comment.ID = base64.RawURLEncoding.EncodeToString(uuid.NewRandom())
	err = comment.Validate()
	if err != nil {
		log.Println(err)
		rest.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	err = transactions.AddComment(requesterID, &comment)
	if err != nil {
		log.Println(err)
		rest.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	insertedComment, err := transactions.GetComment(requesterID, comment.ID)
	if err != nil {
		log.Println(err)
		rest.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.WriteJson(insertedComment)
	w.WriteHeader(http.StatusOK)
}
开发者ID:joshheinrichs,项目名称:geosource,代码行数:34,代码来源:comments.go


示例17: committer

func (f *ZlibFilter) committer(fr FilterRunner, h PluginHelper, wg *sync.WaitGroup) {
	initBatch := make([]byte, 0, 10000)
	f.backChan <- initBatch
	var (
		tag string
		//ok bool
		outBatch []byte
	)
	tag = f.ZlibTag

	for outBatch = range f.batchChan {
		pack, e := h.PipelinePack(f.msgLoopCount)
		if e != nil {
			fr.LogError(e)
			break
		}
		var b bytes.Buffer
		w := zlib.NewWriter(&b)
		w.Write(outBatch)
		w.Close()

		tagField, _ := message.NewField("ZlibTag", tag, "")
		pack.Message.AddField(tagField)
		pack.Message.SetUuid(uuid.NewRandom())
		pack.Message.SetPayload(b.String())
		fr.Inject(pack)

		outBatch = outBatch[:0]
		f.backChan <- outBatch
	}
	wg.Done()
}
开发者ID:huhongbo,项目名称:heka-zlib,代码行数:32,代码来源:zlib_filter.go


示例18: NewNode

// Create and return a new Node. channels for sending and receiving messages are setup.
// And two goroutines are spawned Send and Receive to handle incoming and outgoing messages.
func NewNode(conn net.Conn) *Node {
	n := new(Node)
	n.Client = NewClient(conn)
	n.ID = uuid.NewRandom()
	n.Name = n.ID.String()
	n.State = UNKNOWN
	n.fsm = fsm.NewFSM(
		n.State.S(),
		fsm.Events{
			{Name: "offline", Src: StateList(ONLINE, READY, ASSIGNING, WORKING), Dst: OFFLINE.S()},
			{Name: "online", Src: StateList(UNKNOWN, READY, OFFLINE), Dst: ONLINE.S()},
			{Name: "ready", Src: StateList(ONLINE, WORKING, ASSIGNING), Dst: READY.S()},
			{Name: "assign", Src: StateList(READY), Dst: ASSIGNING.S()},
			{Name: "work", Src: StateList(ASSIGNING), Dst: WORKING.S()},
			{Name: "service", Src: StateList(UNKNOWN, ONLINE, OFFLINE), Dst: SERVICE.S()},
		},
		fsm.Callbacks{
			"after_event":    func(e *fsm.Event) { n.afterEvent(e) },
			"before_offline": func(e *fsm.Event) { n.beforeOffline(e) },
			OFFLINE.S():      func(e *fsm.Event) { n.offlineNode(e) },
		},
	)

	n.Send = make(chan *proto_msg.KamajiMessage)
	n.Receive = make(chan *proto_msg.KamajiMessage)
	n.done = make(chan bool)
	n.waitGroup = &sync.WaitGroup{}
	if n.Conn != nil {
		go n.messageTransmitter()
		go n.messageReciever()
	}
	return n
}
开发者ID:smaragden,项目名称:kamaji,代码行数:35,代码来源:node.go


示例19: NewCommand

// Create a new Command instance and return it.
func NewCommand(name string, task *Task) *Command {
	c := new(Command)
	c.ID = uuid.NewRandom()
	c.Name = name
	c.State = UNKNOWN
	c.Completion = 0.0
	c.created = time.Now()
	c.priority = 0
	c.Task = task
	if task != nil {
		task.Commands = append(task.Commands, c)
	}
	c.FSM = fsm.NewFSM(
		c.State.S(),
		fsm.Events{
			{Name: "ready", Src: StateList(UNKNOWN, STOPPED, ASSIGNING), Dst: READY.S()},
			{Name: "assign", Src: StateList(READY), Dst: ASSIGNING.S()},
			{Name: "start", Src: StateList(UNKNOWN, READY, ASSIGNING, STOPPED), Dst: WORKING.S()},
			{Name: "restart", Src: StateList(DONE), Dst: WORKING.S()},
			{Name: "finish", Src: StateList(WORKING), Dst: DONE.S()},
			{Name: "stop", Src: StateList(WORKING), Dst: STOPPED.S()},
		},
		fsm.Callbacks{
			"after_event": func(e *fsm.Event) { c.afterEvent(e) },
			DONE.S():      func(e *fsm.Event) { c.finishCommand(e) },
		},
	)
	return c
}
开发者ID:smaragden,项目名称:kamaji,代码行数:30,代码来源:command.go


示例20: SendWhileRunning

func (s *zfsMigrationSourceDriver) SendWhileRunning(conn *websocket.Conn) error {
	if s.container.IsSnapshot() {
		fields := strings.SplitN(s.container.Name(), shared.SnapshotDelimiter, 2)
		snapshotName := fmt.Sprintf("snapshot-%s", fields[1])
		return s.send(conn, snapshotName, "")
	}

	lastSnap := ""

	for i, snap := range s.zfsSnapshotNames {

		prev := ""
		if i > 0 {
			prev = s.zfsSnapshotNames[i-1]
		}

		lastSnap = snap

		if err := s.send(conn, snap, prev); err != nil {
			return err
		}
	}

	s.runningSnapName = fmt.Sprintf("migration-send-%s", uuid.NewRandom().String())
	if err := s.zfs.zfsSnapshotCreate(fmt.Sprintf("containers/%s", s.container.Name()), s.runningSnapName); err != nil {
		return err
	}

	if err := s.send(conn, s.runningSnapName, lastSnap); err != nil {
		return err
	}

	return nil
}
开发者ID:jameinel,项目名称:lxd,代码行数:34,代码来源:storage_zfs.go



注:本文中的github.com/pborman/uuid.NewRandom函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang uuid.NewUUID函数代码示例发布时间:2022-05-28
下一篇:
Golang uuid.New函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap