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


Golang Charm.Meta方法代碼示例

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


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

示例1: assertCustomCharm

func assertCustomCharm(c *C, ch *state.Charm, series string, meta *charm.Meta, config *charm.Config, revision int) {
	// Check Charm interface method results.
	c.Assert(ch.Meta(), DeepEquals, meta)
	c.Assert(ch.Config(), DeepEquals, config)
	c.Assert(ch.Revision(), DeepEquals, revision)

	// Test URL matches charm and expected series.
	url := ch.URL()
	c.Assert(url.Series, Equals, series)
	c.Assert(url.Revision, Equals, ch.Revision())

	// Ignore the BundleURL and BundleSHA256 methods, they're irrelevant.
}
開發者ID:johnvilsack,項目名稱:golang-stuff,代碼行數:13,代碼來源:charm_test.go

示例2: AddService

// AddService creates a new service with the given name to run the given
// charm.  If svcName is empty, the charm name will be used.
func (conn *Conn) AddService(name string, ch *state.Charm) (*state.Service, error) {
	if name == "" {
		name = ch.URL().Name // TODO ch.Meta().Name ?
	}
	svc, err := conn.State.AddService(name, ch)
	if err != nil {
		return nil, err
	}
	meta := ch.Meta()
	for rname, rel := range meta.Peers {
		ep := state.Endpoint{
			name,
			rel.Interface,
			rname,
			state.RolePeer,
			rel.Scope,
		}
		if _, err := conn.State.AddRelation(ep); err != nil {
			return nil, fmt.Errorf("cannot add peer relation %q to service %q: %v", rname, name, err)
		}
	}
	return svc, nil
}
開發者ID:prabhakhar,項目名稱:juju-core,代碼行數:25,代碼來源:conn.go

示例3: assertStandardCharm

func assertStandardCharm(c *C, ch *state.Charm, series string) {
	chd := testing.Charms.Dir(ch.Meta().Name)
	assertCustomCharm(c, ch, series, chd.Meta(), chd.Config(), chd.Revision())
}
開發者ID:johnvilsack,項目名稱:golang-stuff,代碼行數:4,代碼來源:charm_test.go

示例4: assertCharm

func assertCharm(c *C, bun *corecharm.Bundle, sch *state.Charm) {
	c.Assert(bun.Revision(), Equals, sch.Revision())
	c.Assert(bun.Meta(), DeepEquals, sch.Meta())
	c.Assert(bun.Config(), DeepEquals, sch.Config())
}
開發者ID:johnvilsack,項目名稱:golang-stuff,代碼行數:5,代碼來源:charm_test.go


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