Documentation
¶
Index ¶
- type GameInstance
- type LocalPackage
- type LocalPackagePlugin
- type Package
- type PackageMetadata
- func (pm PackageMetadata) Dependencies() map[string]*semver.Constraints
- func (pm PackageMetadata) Description() string
- func (pm PackageMetadata) FullReferent() string
- func (pm PackageMetadata) HumanName() string
- func (pm PackageMetadata) Name() string
- func (pm PackageMetadata) Type() PackageType
- func (pm PackageMetadata) Verify() error
- func (pm PackageMetadata) Version() *semver.Version
- type PackageTX
- type PackageTXContext
- func (ctx PackageTXContext) AllPackageIDs() []string
- func (ctx PackageTXContext) PackageAfter(tx PackageTX, pkg string) Package
- func (ctx PackageTXContext) Perform(gi *GameInstance, tx PackageTX, ...) error
- func (ctx PackageTXContext) Solve(tx PackageTX) ([]PackageTX, error)
- func (ctx PackageTXContext) Verify(tx PackageTX) []PackageTXProblem
- type PackageTXOperation
- type PackageTXProblem
- type PackageTXSet
- type PackageType
- type RemotePackage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GameInstance ¶
type GameInstance struct { // Read-write: Local plugins LocalPlugins []LocalPackagePlugin // contains filtered or unexported fields }
GameInstance represents an active instance.
func NewGameInstance ¶
func NewGameInstance(base string) *GameInstance
NewGameInstance creates a new GameInstance with the given base directory. This has no LocalPlugins, so isn't fully usable by default.
func (GameInstance) Base ¶
func (gi GameInstance) Base() string
Base returns the base directory of the GameInstance.
func (*GameInstance) Packages ¶
func (gi *GameInstance) Packages() map[string]LocalPackage
Packages returns a map of the LocalPackages that are installed, where the keys are the .Metadata().Name values for those packages.
type LocalPackage ¶
type LocalPackage interface { Package // Attempts to remove the package. This does not check dependencies. This may affect other packages. Remove() error }
LocalPackage represents a package installed in a GameInstance. It is invalidated when the GameInstance is modified.
type LocalPackagePlugin ¶
type LocalPackagePlugin interface {
Packages() []LocalPackage
}
LocalPackagePlugin represents a plugin to the system that adds a scanner for local packages. It is assumed that the *GameInstance is supplied upon construction. The system is built this way because local packages are
type Package ¶
type Package interface { // Returns the metadata for this package. Metadata() PackageMetadata }
Package represents a package, local or remote.
type PackageMetadata ¶
type PackageMetadata map[string]interface{}
PackageMetadata represents the metadata for a package. For further details, please see the inputLocationsFormat.md file.
func (PackageMetadata) Dependencies ¶
func (pm PackageMetadata) Dependencies() map[string]*semver.Constraints
Dependencies gets the dependencies of the package.
func (PackageMetadata) Description ¶
func (pm PackageMetadata) Description() string
Description gets the description of the package.
func (PackageMetadata) FullReferent ¶
func (pm PackageMetadata) FullReferent() string
FullReferent combines the ID and human name.
func (PackageMetadata) HumanName ¶
func (pm PackageMetadata) HumanName() string
HumanName gets the 'human name' of the package.
func (PackageMetadata) Name ¶
func (pm PackageMetadata) Name() string
Name gets the name of the package.
func (PackageMetadata) Type ¶
func (pm PackageMetadata) Type() PackageType
Type gets the type of the package.
func (PackageMetadata) Verify ¶
func (pm PackageMetadata) Verify() error
Verify verifies that the PackageMetadata is valid and won't panic.
func (PackageMetadata) Version ¶
func (pm PackageMetadata) Version() *semver.Version
Version gets the version of the package.
type PackageTX ¶
type PackageTX map[string]PackageTXOperation
A PackageTX is a proposed set of operations to perform on a GameInstance. It should be treated immutably, using clone-and-edit where required.
type PackageTXContext ¶
type PackageTXContext struct { LocalPackages map[string]LocalPackage // Leave non-nil but blank if offline. RemotePackages map[string]RemotePackage }
A PackageTXContext is a view of the current local and remote packages from before a package transaction.
func (PackageTXContext) AllPackageIDs ¶
func (ctx PackageTXContext) AllPackageIDs() []string
func (PackageTXContext) PackageAfter ¶
func (ctx PackageTXContext) PackageAfter(tx PackageTX, pkg string) Package
func (PackageTXContext) Perform ¶
func (ctx PackageTXContext) Perform(gi *GameInstance, tx PackageTX, stats func(pkg string, pre bool, rm bool, add bool)) error
Perform actually performs a PackageTX (invalidating the PackageTXContext LocalPackages as a result) in dependency order.
func (PackageTXContext) Solve ¶
func (ctx PackageTXContext) Solve(tx PackageTX) ([]PackageTX, error)
Solve returns a set of solved versions of the package transactions.
func (PackageTXContext) Verify ¶
func (ctx PackageTXContext) Verify(tx PackageTX) []PackageTXProblem
Verify checks if the Package Transaction is invalid, and if so, why.
type PackageTXOperation ¶
type PackageTXOperation int
A PackageTXOperation describes something to perform on a package.
const ( // PackageTransactionOperationInstall updates the package to the latest version. PackageTXOperationInstall PackageTXOperation = iota // PackageTransactionOperationRemove removes the package from the system. PackageTXOperationRemove )
type PackageTXProblem ¶
type PackageTXProblem struct { Text string // Solutions. Each solution is a PackageTX to be appended to the original. Solutions []PackageTX }
PackageTXProblem represents a problem with the PackageTX and a number of potential solutions.
type PackageTXSet ¶
type PackageTXSet []PackageTX
PackageTXSet represents a set of PackageTXes. Refer to it via *PackageTXSet.
func (*PackageTXSet) Contains ¶
func (set *PackageTXSet) Contains(ptx PackageTX) bool
Contains returns true if the PackageTX is contained in this set.
func (*PackageTXSet) Less ¶
func (set *PackageTXSet) Less(a int, b int) bool
Less implements sort.Interface.Less
func (*PackageTXSet) Put ¶
func (set *PackageTXSet) Put(ptx PackageTX) bool
Put puts a PackageTX into the set. Returns false if it was already there.
func (*PackageTXSet) Swap ¶
func (set *PackageTXSet) Swap(a int, b int)
Swap implements sort.Interface.Swap
type PackageType ¶
type PackageType int
PackageType represents a specific kind of package.
const ( // PackageTypeBase represents a hidden base package that should not be visible from UI (but may be visible in CLI). PackageTypeBase PackageType = iota // PackageTypeMod represents a mod. PackageTypeMod // PackageTypeTool represents a tool. PackageTypeTool // PackageTypeAfterLast is above the last PackageType, to allow iteration in for loops. If it appears, it means "unknown". PackageTypeAfterLast )
const PackageTypeFirst PackageType = 0
PackageTypeFirst is the first PackageType.
func (PackageType) String ¶
func (pt PackageType) String() string
func (PackageType) StringPlural ¶
func (pt PackageType) StringPlural() string
StringPlural is similar to String, but the resulting string is a plural
type RemotePackage ¶
type RemotePackage interface { Package // Installs the package. This does not check dependencies. This may affect other packages. Install(target *GameInstance) error }
RemotePackage represents a package on a remote server.