Documentation ¶
Index ¶
- Variables
- func FetchAndCheckSnapAssertions(snapPath string, info *snap.Info, f asserts.Fetcher, db asserts.RODatabase) (*asserts.SnapDeclaration, error)
- func MockTrusted(mockTrusted []asserts.Assertion) (restore func())
- func Prepare(opts *Options) error
- type DownloadOptions
- type Options
- type Store
- type ToolingStore
- func (tsto *ToolingStore) AssertionFetcher(db *asserts.Database, save func(asserts.Assertion) error) asserts.Fetcher
- func (tsto *ToolingStore) DownloadSnap(name string, opts DownloadOptions) (targetFn string, info *snap.Info, redirectChannel string, err error)
- func (tsto *ToolingStore) Find(at *asserts.AssertionType, headers map[string]string) (asserts.Assertion, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func FetchAndCheckSnapAssertions ¶
func FetchAndCheckSnapAssertions(snapPath string, info *snap.Info, f asserts.Fetcher, db asserts.RODatabase) (*asserts.SnapDeclaration, error)
FetchAndCheckSnapAssertions fetches and cross checks the snap assertions matching the given snap file using the provided asserts.Fetcher and assertion database.
func MockTrusted ¶
Types ¶
type DownloadOptions ¶
type DownloadOptions struct { TargetDir string // if TargetPathFunc is not nil it will be invoked // to compute the target path for the download and TargetDir is // ignored TargetPathFunc func(*snap.Info) (string, error) Revision snap.Revision Channel string CohortKey string Basename string LeavePartialOnError bool }
DownloadOptions carries options for downloading snaps plus assertions.
func (*DownloadOptions) String ¶
func (opts *DownloadOptions) String() string
type Options ¶
type Options struct { ModelFile string Classic bool Channel string // TODO: use OptionsSnap directly here? Snaps []string SnapChannels map[string]string // WideCohortKey can be used to supply a cohort covering all // the snaps in the image, there is no generally suppported API // to create such a cohort key. WideCohortKey string PrepareDir string // Architecture to use if none is specified by the model, // useful only for classic mode. If set must match the model otherwise. Architecture string }
type Store ¶
type Store interface { SnapAction(context.Context, []*store.CurrentSnap, []*store.SnapAction, store.AssertionQuery, *auth.UserState, *store.RefreshOptions) ([]store.SnapActionResult, []store.AssertionResult, error) Download(ctx context.Context, name, targetFn string, downloadInfo *snap.DownloadInfo, pbar progress.Meter, user *auth.UserState, dlOpts *store.DownloadOptions) error Assertion(assertType *asserts.AssertionType, primaryKey []string, user *auth.UserState) (asserts.Assertion, error) }
A Store can find metadata on snaps, download snaps and fetch assertions.
type ToolingStore ¶
type ToolingStore struct {
// contains filtered or unexported fields
}
ToolingStore wraps access to the store for tools.
func NewToolingStore ¶
func NewToolingStore() (*ToolingStore, error)
func NewToolingStoreFromModel ¶
func NewToolingStoreFromModel(model *asserts.Model, fallbackArchitecture string) (*ToolingStore, error)
func (*ToolingStore) AssertionFetcher ¶
func (tsto *ToolingStore) AssertionFetcher(db *asserts.Database, save func(asserts.Assertion) error) asserts.Fetcher
AssertionFetcher creates an asserts.Fetcher for assertions against the given store using dlOpts for authorization, the fetcher will add assertions in the given database and after that also call save for each of them.
func (*ToolingStore) DownloadSnap ¶
func (tsto *ToolingStore) DownloadSnap(name string, opts DownloadOptions) (targetFn string, info *snap.Info, redirectChannel string, err error)
DownloadSnap downloads the snap with the given name and optionally revision using the provided store and options. It returns the final full path of the snap and a snap.Info for it and optionally a channel the snap got redirected to.
func (*ToolingStore) Find ¶
func (tsto *ToolingStore) Find(at *asserts.AssertionType, headers map[string]string) (asserts.Assertion, error)
Find provides the snapsserts.Finder interface for snapasserts.DerviceSideInfo