~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/api/charmrevisionupdater/updater.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 2013 Canonical Ltd.
 
2
// Licensed under the AGPLv3, see LICENCE file for details.
 
3
 
 
4
package charmrevisionupdater
 
5
 
 
6
import (
 
7
        "github.com/juju/juju/api/base"
 
8
        "github.com/juju/juju/apiserver/params"
 
9
)
 
10
 
 
11
// State provides access to a worker's view of the state.
 
12
type State struct {
 
13
        facade base.FacadeCaller
 
14
}
 
15
 
 
16
// NewState returns a version of the state that provides functionality required by the worker.
 
17
func NewState(caller base.APICaller) *State {
 
18
        return &State{base.NewFacadeCaller(caller, "CharmRevisionUpdater")}
 
19
}
 
20
 
 
21
// UpdateLatestRevisions retrieves charm revision info from a repository
 
22
// and updates the revision info in state.
 
23
func (st *State) UpdateLatestRevisions() error {
 
24
        result := new(params.ErrorResult)
 
25
        err := st.facade.FacadeCall("UpdateLatestRevisions", nil, result)
 
26
        if err != nil {
 
27
                return err
 
28
        }
 
29
        if result.Error != nil {
 
30
                return result.Error
 
31
        }
 
32
        return nil
 
33
}