juju: github.com/juju/juju/environs/sync Index | Files

package sync

import "github.com/juju/juju/environs/sync"

Index

Package Files

sync.go

func SyncTools Uses

func SyncTools(syncContext *SyncContext) error

SyncTools copies the Juju tools tarball from the official bucket or a specified source directory into the user's environment.

type BuildAgentTarballFunc Uses

type BuildAgentTarballFunc func(build bool, forceVersion *version.Number, stream string) (*BuiltAgent, error)

BuildAgentTarballFunc is a function which can build an agent tarball.

var BuildAgentTarball BuildAgentTarballFunc = buildAgentTarball

Override for testing.

type BuiltAgent Uses

type BuiltAgent struct {
    Version     version.Binary
    Official    bool
    Dir         string
    StorageName string
    Sha256Hash  string
    Size        int64
}

BuiltAgent contains metadata for a tools tarball resulting from a call to BundleTools.

type StorageToolsFinder Uses

type StorageToolsFinder struct {
    Storage storage.StorageReader
}

StorageToolsFinder is an implementation of ToolsFinder that searches for tools in the specified storage.

func (StorageToolsFinder) FindTools Uses

func (f StorageToolsFinder) FindTools(major int, stream string) (coretools.List, error)

type StorageToolsUploader Uses

type StorageToolsUploader struct {
    Storage       storage.Storage
    WriteMetadata bool
    WriteMirrors  envtools.ShouldWriteMirrors
}

StorageToolsUplader is an implementation of ToolsUploader that writes tools to the provided storage and then writes merged metadata, optionally with mirrors.

func (StorageToolsUploader) UploadTools Uses

func (u StorageToolsUploader) UploadTools(toolsDir, stream string, tools *coretools.Tools, data []byte) error

type SyncContext Uses

type SyncContext struct {
    // TargetToolsFinder is a ToolsFinder provided to find existing
    // tools in the target destination.
    TargetToolsFinder ToolsFinder

    // TargetToolsUploader is a ToolsUploader provided to upload
    // tools to the target destination.
    TargetToolsUploader ToolsUploader

    // AllVersions controls the copy of all versions, not only the latest.
    AllVersions bool

    // Copy tools with major version, if MajorVersion > 0.
    MajorVersion int

    // Copy tools with minor version, if MinorVersion > 0.
    MinorVersion int

    // DryRun controls that nothing is copied. Instead it's logged
    // what would be coppied.
    DryRun bool

    // Stream specifies the simplestreams stream to use (defaults to "Released").
    Stream string

    // Source, if non-empty, specifies a directory in the local file system
    // to use as a source.
    Source string
}

SyncContext describes the context for tool synchronization.

type ToolsFinder Uses

type ToolsFinder interface {
    // FindTools returns a list of tools with the specified major version in the specified stream.
    FindTools(major int, stream string) (coretools.List, error)
}

ToolsFinder provides an interface for finding tools of a specified version.

type ToolsUploader Uses

type ToolsUploader interface {
    // UploadTools uploads the tools with the specified version and tarball contents.
    UploadTools(toolsDir, stream string, tools *coretools.Tools, data []byte) error
}

ToolsUploader provides an interface for uploading tools and associated metadata.

type UploadFunc Uses

type UploadFunc func(stor storage.Storage, stream string, forceVersion *version.Number, series ...string) (*coretools.Tools, error)

UploadFunc is the type of Upload, which may be reassigned to control the behaviour of tools uploading.

var Upload UploadFunc = upload

Exported for testing.

Package sync imports 17 packages (graph) and is imported by 194 packages. Updated 2018-06-11. Refresh now. Tools for package owners.