1
// Copyright 2012, 2013 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
9
"launchpad.net/juju-core/charm"
12
// charmDoc represents the internal state of a charm in MongoDB.
13
type charmDoc struct {
14
URL *charm.URL `bson:"_id"`
21
// Charm represents the state of a charm in the environment.
27
func newCharm(st *State, cdoc *charmDoc) (*Charm, error) {
28
return &Charm{st: st, doc: *cdoc}, nil
31
func (c *Charm) String() string {
32
return c.doc.URL.String()
35
// URL returns the URL that identifies the charm.
36
func (c *Charm) URL() *charm.URL {
41
// Revision returns the monotonically increasing charm
43
func (c *Charm) Revision() int {
44
return c.doc.URL.Revision
47
// Meta returns the metadata of the charm.
48
func (c *Charm) Meta() *charm.Meta {
52
// Config returns the configuration of the charm.
53
func (c *Charm) Config() *charm.Config {
57
// BundleURL returns the url to the charm bundle in
58
// the provider storage.
59
func (c *Charm) BundleURL() *url.URL {
60
return c.doc.BundleURL
63
// BundleSha256 returns the SHA256 digest of the charm bundle bytes.
64
func (c *Charm) BundleSha256() string {
65
return c.doc.BundleSha256