~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/gopkg.in/juju/charmstore.v5-unstable/internal/mongodoc/doc.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
        "gopkg.in/errgo.v1"
10
10
        "gopkg.in/juju/charm.v6-unstable"
 
11
        "gopkg.in/juju/charmrepo.v2-unstable/csclient/params"
11
12
        "gopkg.in/mgo.v2/bson"
12
13
)
13
14
 
46
47
        // containing the value in Series.
47
48
        SupportedSeries []string
48
49
 
 
50
        // PreV5BlobHash holds the hash checksum of the
 
51
        // blob that will be served from the v4 and legacy
 
52
        // APIs. This will be the same as BlobHash for single-series charms.
 
53
        PreV5BlobHash string
 
54
 
 
55
        // PreV5BlobSize holds the size of the
 
56
        // blob that will be served from the v4 and legacy
 
57
        // APIs. This will be the same as Size for single-series charms.
 
58
        PreV5BlobSize int64
 
59
 
 
60
        // PreV5BlobHash256 holds the SHA256 hash checksum
 
61
        // of the blob that will be served from the v4 and legacy
 
62
        // APIs. This will be the same as Hash256 for single-series charms.
 
63
        PreV5BlobHash256 string
 
64
 
49
65
        // BlobHash holds the hash checksum of the blob, in hexadecimal format,
50
66
        // as created by blobstore.NewHash.
51
67
        BlobHash string
53
69
        // BlobHash256 holds the SHA256 hash checksum of the blob,
54
70
        // in hexadecimal format. This is only used by the legacy
55
71
        // API, and is calculated lazily the first time it is required.
 
72
        // Note that this is calculated from the pre-V5 blob.
56
73
        BlobHash256 string
57
74
 
58
75
        // Size holds the size of the archive blob.
60
77
        Size int64
61
78
 
62
79
        // BlobName holds the name that the archive blob is given in the blob store.
 
80
        // For multi-series charms, there is also a second blob which
 
81
        // stores a "zip-suffix" that overrides metadata.yaml.
 
82
        // This is named BlobName + ".pre-v5-suffix".
63
83
        BlobName string
64
84
 
65
85
        UploadTime time.Time
115
135
        // If the entity is not promulgated this should be set to -1.
116
136
        PromulgatedRevision int `bson:"promulgated-revision"`
117
137
 
118
 
        // Development holds whether the entity is in development or published.
119
 
        // A development entity can only be referred to using URLs including the
 
138
        // TODO we could potentially use map[params.Channel] bool
 
139
        // instead of having a separate field for each channel.
 
140
 
 
141
        // Development holds whether the entity has been published in the
120
142
        // "development" channel.
121
143
        Development bool
 
144
 
 
145
        // Stable holds whether the entity has been published in the
 
146
        // "stable" channel.
 
147
        Stable bool
122
148
}
123
149
 
124
150
// PreferredURL returns the preferred way to refer to this entity. If
133
159
        } else {
134
160
                u = *e.URL
135
161
        }
136
 
        if e.Development {
137
 
                u.Channel = charm.DevelopmentChannel
138
 
        }
139
162
        return &u
140
163
}
141
164
 
154
177
        // Name holds the name of the entity (for instance "wordpress").
155
178
        Name string
156
179
 
157
 
        // Public specifies whether the charm or bundle
158
 
        // is available to all users. If this is true, the ACLs will
159
 
        // be ignored when reading a charm.
160
 
        Public bool
161
 
 
162
 
        // ACLs holds permission information relevant to the base entity.
163
 
        // The permissions apply to all revisions.
164
 
        ACLs ACL
165
 
 
166
 
        // DevelopmentACLs is similar to ACLs but applies to all development
167
 
        // revisions.
168
 
        DevelopmentACLs ACL
169
 
 
170
180
        // Promulgated specifies whether the charm or bundle should be
171
181
        // promulgated.
172
182
        Promulgated IntBool
175
185
        // the base entity. Thhose data apply to all revisions.
176
186
        // The byte slices hold JSON-encoded data.
177
187
        CommonInfo map[string][]byte `bson:",omitempty" json:",omitempty"`
 
188
 
 
189
        // ChannelACLs holds a map from an entity channel to the ACLs
 
190
        // that apply to entities that use this base entity that are associated
 
191
        // with the given channel.
 
192
        ChannelACLs map[params.Channel]ACL
 
193
 
 
194
        // ChannelEntities holds a set of channels, each containing a set
 
195
        // of series holding the currently published entity revision for
 
196
        // that channel and series.
 
197
        ChannelEntities map[params.Channel]map[string]*charm.URL
178
198
}
179
199
 
180
200
// ACL holds lists of users and groups that are
298
318
        }
299
319
        return nil
300
320
}
 
321
 
 
322
// BaseURL returns the "base" version of url. If
 
323
// url represents an entity, then the returned URL
 
324
// will represent its base entity.
 
325
func BaseURL(url *charm.URL) *charm.URL {
 
326
        newURL := *url
 
327
        newURL.Revision = -1
 
328
        newURL.Series = ""
 
329
        return &newURL
 
330
}
 
331
 
 
332
func copyURL(u *charm.URL) *charm.URL {
 
333
        u1 := *u
 
334
        return &u1
 
335
}