~rogpeppe/juju-core/azure

« back to all changes in this revision

Viewing changes to agent/diskmanager.go

  • Committer: Roger Peppe
  • Date: 2011-12-15 18:54:31 UTC
  • mfrom: (19.5.4 go-juju-ec2-operations)
  • mto: This revision was merged to the branch mainline in revision 30.
  • Revision ID: roger.peppe@canonical.com-20111215185431-tjuxi6bmg1mswcwg
renameĀ environ->environs

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 agent
5
 
 
6
 
import (
7
 
        "io"
8
 
 
9
 
        "launchpad.net/juju-core/state"
10
 
        "launchpad.net/juju-core/version"
11
 
)
12
 
 
13
 
// DiskManager keeps track of a collections of Juju agent tools in a directory
14
 
// structure on disk.
15
 
type DiskManager struct {
16
 
        dataDir string
17
 
}
18
 
 
19
 
// NewDiskManager returns a DiskManager handling a given directory.
20
 
// *DiskManager conforms to the ToolsManager interface
21
 
func NewDiskManager(dataDir string) *DiskManager {
22
 
        return &DiskManager{dataDir: dataDir}
23
 
}
24
 
 
25
 
func (d *DiskManager) ReadTools(vers version.Binary) (*Tools, error) {
26
 
        stTools, err := ReadTools(d.dataDir, vers)
27
 
        return (*Tools)(stTools), err
28
 
}
29
 
 
30
 
func (d *DiskManager) UnpackTools(tools *Tools, r io.Reader) error {
31
 
        return UnpackTools(d.dataDir, (*state.Tools)(tools), r)
32
 
}
33
 
 
34
 
func (d *DiskManager) SharedToolsDir(vers version.Binary) string {
35
 
        return SharedToolsDir(d.dataDir, vers)
36
 
}