modsdir

package
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2021 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package modsdir is an internal package containing the model types used to represent the manifest of modules in a local modules cache directory.

Index

Constants

View Source
const ManifestSnapshotFilename = "modules.json"

Variables

This section is empty.

Functions

This section is empty.

Types

type Manifest

type Manifest map[string]Record

Manifest is a map used to keep track of the filesystem locations and other metadata about installed modules.

The configuration loader refers to this, while the module installer updates it to reflect any changes to the installed modules.

func ReadManifestSnapshot

func ReadManifestSnapshot(r io.Reader) (Manifest, error)

func ReadManifestSnapshotForDir

func ReadManifestSnapshotForDir(dir string) (Manifest, error)

func (Manifest) ModuleKey

func (m Manifest) ModuleKey(path addrs.Module) string

func (Manifest) WriteSnapshot

func (m Manifest) WriteSnapshot(w io.Writer) error

func (Manifest) WriteSnapshotToDir

func (m Manifest) WriteSnapshotToDir(dir string) error

type Record

type Record struct {
	// Key is a unique identifier for this particular module, based on its
	// position within the static module tree.
	Key string `json:"Key"`

	// SourceAddr is the source address given for this module in configuration.
	// This is used only to detect if the source was changed in configuration
	// since the module was last installed, which means that the installer
	// must re-install it.
	SourceAddr string `json:"Source"`

	// Version is the exact version of the module, which results from parsing
	// VersionStr. nil for un-versioned modules.
	Version *version.Version `json:"-"`

	// VersionStr is the version specifier string. This is used only for
	// serialization in snapshots and should not be accessed or updated
	// by any other codepaths; use "Version" instead.
	VersionStr string `json:"Version,omitempty"`

	// Dir is the path to the local directory where the module is installed.
	Dir string `json:"Dir"`
}

Record represents some metadata about an installed module, as part of a ModuleManifest.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL