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


Golang Status.String方法代碼示例

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


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

示例1: EventNotify

func EventNotify(status utils.Status) error {
	mi := make(map[string]string)

	js := make(pairs.JsonPairs, 0)
	m := make(map[string][]string, 2)
	m["status"] = []string{status.String()}
	m["description"] = []string{status.Description(meta.MC.Name)}
	js.NukeAndSet(m) //just nuke the matching output key:

	mi[constants.ASSEMBLY_ID] = meta.MC.CartonId
	mi[constants.ACCOUNT_ID] = meta.MC.AccountId
	mi[constants.EVENT_TYPE] = status.Event_type()

	newEvent := events.NewMulti(
		[]*events.Event{
			&events.Event{
				AccountsId:  "",
				EventAction: alerts.STATUS,
				EventType:   constants.EventUser,
				EventData:   alerts.EventData{M: mi, D: js.ToString()},
				Timestamp:   time.Now().Local(),
			},
		})
	return newEvent.Write()
}
開發者ID:rajthilakmca,項目名稱:gulp,代碼行數:25,代碼來源:provision.go

示例2: ChangeState

func (m *Machine) ChangeState(status utils.Status) error {
	log.Debugf("  change state of machine (%s, %s)", m.Name, status.String())

	pons := nsqp.New()
	if err := pons.Connect(meta.MC.NSQd[0]); err != nil {
		return err
	}

	bytes, err := json.Marshal(
		carton.Requests{
			CatId:     m.CartonsId,
			Action:    status.String(),
			Category:  carton.STATE,
			CreatedAt: time.Now().Local().Format(time.RFC822),
		})

	if err != nil {
		return err
	}

	log.Debugf("  pub to topic (%s, %s)", TOPIC, bytes)
	if err = pons.Publish(TOPIC, bytes); err != nil {
		return err
	}

	defer pons.Stop()
	return nil
}
開發者ID:rajthilakmca,項目名稱:gulp,代碼行數:28,代碼來源:machine.go

示例3: SetStatus

func (c *Component) SetStatus(status utils.Status) error {
	LastStatusUpdate := time.Now().Local().Format(time.RFC822)
	m := make(map[string][]string, 2)
	m["lastsuccessstatusupdate"] = []string{LastStatusUpdate}
	m["status"] = []string{status.String()}
	c.Inputs.NukeAndSet(m) //just nuke the matching output key:

	update_fields := make(map[string]interface{})
	update_fields["Inputs"] = c.Inputs.ToString()
	update_fields["Status"] = status.String()
	ops := ldb.Options{
		TableName:   COMPBUCKET,
		Pks:         []string{"Id"},
		Ccms:        []string{},
		Hosts:       meta.MC.Scylla,
		Keyspace:    meta.MC.ScyllaKeyspace,
		PksClauses:  map[string]interface{}{"Id": c.Id},
		CcmsClauses: make(map[string]interface{}),
	}
	if err := ldb.Updatedb(ops, update_fields); err != nil {
		return err
	}
	_ = eventNotify(status)
	return nil
}
開發者ID:rajthilakmca,項目名稱:gulp,代碼行數:25,代碼來源:component.go

示例4: SetStatus

func (m *Machine) SetStatus(status utils.Status) error {
	log.Debugf("  set status[%s] of machine (%s, %s)", m.Id, m.Name, status.String())

	if asm, err := carton.NewAmbly(m.CartonId); err != nil {
		return err
	} else if err = asm.SetStatus(status); err != nil {

		return err
	}

	if m.Level == provision.BoxSome {
		log.Debugf("  set status[%s] of machine (%s, %s)", m.Id, m.Name, status.String())

		if comp, err := carton.NewComponent(m.Id); err != nil {
			return err
		} else if err = comp.SetStatus(status); err != nil {
			return err
		}
	}
	return nil
}
開發者ID:rajthilakmca,項目名稱:gulp,代碼行數:21,代碼來源:machine.go

示例5: SetStatus

func (a *Ambly) SetStatus(status utils.Status) error {
	js := a.getInputs()
	LastStatusUpdate := time.Now().Local().Format(time.RFC822)
	m := make(map[string][]string, 2)
	m["lastsuccessstatusupdate"] = []string{LastStatusUpdate}
	m["status"] = []string{status.String()}
	js.NukeAndSet(m) //just nuke the matching output key:
	a.Status = status.String()

	update_fields := make(map[string]interface{})
	update_fields["inputs"] = js.ToString()
	update_fields["status"] = status.String()
	ops := ldb.Options{
		TableName:   ASSEMBLYBUCKET,
		Pks:         []string{"id"},
		Ccms:        []string{"org_id"},
		Hosts:       meta.MC.Scylla,
		Keyspace:    meta.MC.ScyllaKeyspace,
		Username:    meta.MC.ScyllaPassword,
		Password:    meta.MC.ScyllaPassword,
		PksClauses:  map[string]interface{}{"id": a.Id},
		CcmsClauses: map[string]interface{}{"org_id": a.OrgId},
	}
	if err := ldb.Updatedb(ops, update_fields); err != nil {
		return err
	}

	_ = eventNotify(status)
	return nil
}
開發者ID:vijaykanthm28,項目名稱:gulp,代碼行數:30,代碼來源:assembly.go

示例6: TestStatusString

func (ProvisionSuite) TestStatusString(c *check.C) {
	var s utils.Status = "pending"
	c.Assert(s.String(), check.Equals, "pending")
}
開發者ID:vijaykanthm28,項目名稱:gulp,代碼行數:4,代碼來源:provision_test.go


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