resolver

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: GPL-3.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

View Source
const (
	InitialLockfileVersion = LockfileVersion(iota)

	ModTargetsLockfileVersion

	CurrentLockfileVersion = nextLockfileVersion - 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependency

type Dependency struct {
	ModID     string `json:"mod_id"`
	Condition string `json:"condition"`
	Optional  bool   `json:"optional"`
}

type DependencyResolver

type DependencyResolver struct {
	// contains filtered or unexported fields
}

func NewDependencyResolver

func NewDependencyResolver(provider Provider, apiBase string) DependencyResolver

func (DependencyResolver) ResolveModDependencies

func (d DependencyResolver) ResolveModDependencies(ctx context.Context, constraints map[string]string, lockFile *LockFile, gameVersion int, requiredTargets []TargetName) (*LockFile, error)

type DependencyResolverError

type DependencyResolverError struct {
	pubgrub.SolvingError
	// contains filtered or unexported fields
}

func (DependencyResolverError) Error

func (e DependencyResolverError) Error() string

type DependencyResolverErrorStringer

type DependencyResolverErrorStringer struct {
	pubgrub.StandardIncompatibilityStringer
	// contains filtered or unexported fields
}

func MakeDependencyResolverErrorStringer

func MakeDependencyResolverErrorStringer(provider Provider, smlVersions []SMLVersion, gameVersion int) *DependencyResolverErrorStringer

func (*DependencyResolverErrorStringer) IncompatibilityString

func (w *DependencyResolverErrorStringer) IncompatibilityString(incompatibility *pubgrub.Incompatibility, rootPkg string) string

func (*DependencyResolverErrorStringer) Term

func (w *DependencyResolverErrorStringer) Term(t pubgrub.Term, includeVersion bool) string

type LockFile

type LockFile struct {
	Mods    map[string]LockedMod `json:"mods"`
	Version LockfileVersion      `json:"version"`
}

func NewLockfile

func NewLockfile() *LockFile

func (*LockFile) Clone

func (l *LockFile) Clone() *LockFile

func (*LockFile) Remove

func (l *LockFile) Remove(modID ...string) *LockFile

type LockedMod

type LockedMod struct {
	Dependencies map[string]string          `json:"dependencies"`
	Targets      map[string]LockedModTarget `json:"targets"`
	Version      string                     `json:"version"`
}

type LockedModTarget

type LockedModTarget struct {
	Hash string `json:"hash"`
	Link string `json:"link"`
}

type LockfileVersion

type LockfileVersion int

type MockProvider

type MockProvider struct{}

func (MockProvider) GetModName

func (m MockProvider) GetModName(_ context.Context, modReference string) (*ModName, error)

func (MockProvider) ModVersionsWithDependencies

func (m MockProvider) ModVersionsWithDependencies(_ context.Context, modID string) ([]ModVersion, error)

func (MockProvider) SMLVersions

func (m MockProvider) SMLVersions(_ context.Context) ([]SMLVersion, error)

type ModName

type ModName struct {
	ID           string `json:"id"`
	ModReference string `json:"mod_reference"`
	Name         string `json:"name"`
}

type ModVersion

type ModVersion struct {
	ID           string       `json:"id"`
	Version      string       `json:"version"`
	Dependencies []Dependency `json:"dependencies"`
	Targets      []Target     `json:"targets"`
}

type Provider

type Provider interface {
	SMLVersions(context context.Context) ([]SMLVersion, error)
	ModVersionsWithDependencies(context context.Context, modID string) ([]ModVersion, error)
	GetModName(context context.Context, modReference string) (*ModName, error)
}

type SMLVersion

type SMLVersion struct {
	ID                  string             `json:"id"`
	Version             string             `json:"version"`
	Targets             []SMLVersionTarget `json:"targets"`
	SatisfactoryVersion int                `json:"satisfactory_version"`
}

type SMLVersionTarget

type SMLVersionTarget struct {
	TargetName TargetName `json:"targetName"`
	Link       string     `json:"link"`
}

type Target

type Target struct {
	VersionID  string     `json:"version_id"`
	TargetName TargetName `json:"target_name"`
	Hash       string     `json:"hash"`
	Size       int64      `json:"size"`
}

type TargetName

type TargetName string
const (
	TargetNameLinuxServer   TargetName = "LinuxServer"
	TargetNameWindows       TargetName = "Windows"
	TargetNameWindowsServer TargetName = "WindowsServer"
)

type VersionDependency

type VersionDependency struct {
	ModReference string
	Constraint   string
	Optional     bool
}

Jump to

Keyboard shortcuts

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