~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/charmstore/info.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2016 Canonical Ltd.
 
2
// Licensed under the AGPLv3, see LICENCE file for details.
 
3
 
 
4
package charmstore
 
5
 
 
6
import (
 
7
        "time"
 
8
 
 
9
        "gopkg.in/juju/charm.v6-unstable"
 
10
        charmresource "gopkg.in/juju/charm.v6-unstable/resource"
 
11
)
 
12
 
 
13
// CharmInfo holds the information about a charm from the charm store.
 
14
// The info relates to the charm at a particular revision at the time
 
15
// the charm store handled the request. The resource revisions
 
16
// associated with the charm at that revision may change at any time.
 
17
// Note, however, that the set of resource names remains fixed for any
 
18
// given charm revision.
 
19
type CharmInfo struct {
 
20
        // OriginalURL is charm URL, including its revision, for which we
 
21
        // queried the charm store.
 
22
        OriginalURL *charm.URL
 
23
 
 
24
        // Timestamp indicates when the info came from the charm store.
 
25
        Timestamp time.Time
 
26
 
 
27
        // LatestRevision identifies the most recent revision of the charm
 
28
        // that is available in the charm store.
 
29
        LatestRevision int
 
30
 
 
31
        // LatestResources is the list of resource info for each of the
 
32
        // charm's resources. This list is accurate as of the time that the
 
33
        // charm store handled the request for the charm info.
 
34
        LatestResources []charmresource.Resource
 
35
}
 
36
 
 
37
// LatestURL returns the charm URL for the latest revision of the charm.
 
38
func (info CharmInfo) LatestURL() *charm.URL {
 
39
        return info.OriginalURL.WithRevision(info.LatestRevision)
 
40
}
 
41
 
 
42
// CharmInfoResult holds the result of a charm store request for info
 
43
// about a charm.
 
44
type CharmInfoResult struct {
 
45
        CharmInfo
 
46
 
 
47
        // Error indicates a problem retrieving or processing the info
 
48
        // for this charm.
 
49
        Error error
 
50
}