juju: github.com/wallyworld/juju/resource/charmstore Index | Files

package charmstore

import "github.com/wallyworld/juju/resource/charmstore"


Package Files

cache.go operations.go

func GetResource Uses

func GetResource(args GetResourceArgs) (resource.Resource, io.ReadCloser, error)

GetResource returns a reader for the resource's data. That data is streamed from the charm store.

If a cache is set up then the resource is read from there. If the resource is not in the cache at all then errors.NotFound is returned. If only the resource's details are in the cache (but not the actual file) then the file is read from the charm store. In that case the cache is updated to contain the file too.

type EntityCache Uses

type EntityCache interface {
    // GetResource returns the resource data for the identified resource.
    GetResource(name string) (resource.Resource, error)

    // SetResource stores the resource in the local cache.
    SetResource(res charmresource.Resource, reader io.Reader) (resource.Resource, error)

    // OpenResource returns metadata about the resource, and a reader
    // for the resource.
    OpenResource(name string) (resource.Resource, io.ReadCloser, error)

EntityCache exposes the functionality needed to cache data from the charm store. The operations apply to a single application (or unit).

type GetResourceArgs Uses

type GetResourceArgs struct {
    // Client is the charm store client to use.
    Client StoreResourceGetter

    // EntityCache is the charm store cache to use. It is optional.
    Cache EntityCache

    // CharmID indicates the charm for which to get the resource.
    CharmID charmstore.CharmID

    // Name is the name of the resource.
    Name string

GetResourceArgs holds the arguments to GetResource().

type StoreResourceGetter Uses

type StoreResourceGetter interface {
    // GetResource returns a reader for the resource's data. That data
    // is streamed from the charm store. The charm's revision, if any,
    // is ignored. If the identified resource is not in the charm store
    // then errors.NotFound is returned.
    // But if you write any code that assumes a NotFound error returned
    // from this methid means that the resource was not found, you fail
    // basic logic.
    GetResource(charmstore.ResourceRequest) (charmstore.ResourceData, error)

StoreResourceGetter provides the functionality for getting a resource file from the charm store.

Package charmstore imports 5 packages (graph). Updated 2020-08-03. Refresh now. Tools for package owners.