storage

package
v0.0.0-...-94e6d93 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// LocalMods implements a ModProvider to access local mods
	LocalMods = genericModProvider{
		// contains filtered or unexported fields
	}
)
View Source
var (

	// RemoteMods implements a ModProvider to access remote mods
	RemoteMods = genericModProvider{
		// contains filtered or unexported fields
	}
)

Functions

func BatchRead

func BatchRead(ctx context.Context, callback func(context.Context) error) error

func BatchUpdate

func BatchUpdate(ctx context.Context, callback func(context.Context) error) error

func Clean

func Clean(ctx context.Context) error

func Close

func Close(ctx context.Context)

func CtxWithTx

func CtxWithTx(ctx context.Context, tx *bolt.Tx) context.Context

func DeleteLocalModRelease

func DeleteLocalModRelease(ctx context.Context, release *common.Release) error

func GetFile

func GetFile(ctx context.Context, id string) (*common.FileRef, error)

func GetSettings

func GetSettings(ctx context.Context) (*client.Settings, error)

func GetUserSettingsForMod

func GetUserSettingsForMod(ctx context.Context, id, version string) (*client.UserSettings, error)

func ImportFile

func ImportFile(ctx context.Context, ref *common.FileRef) error

func ImportMods

func ImportMods(ctx context.Context, callback func(context.Context) error) error

func ImportRemoteMods

func ImportRemoteMods(ctx context.Context, callback func(context.Context, RemoteImportCallbackParams) error) error

func ImportUserSettings

func ImportUserSettings(ctx context.Context, callback func(context.Context, func(string, string, *client.UserSettings) error) error) error

func Open

func Open(ctx context.Context) error

func SaveEngineFlags

func SaveEngineFlags(ctx context.Context, path string, flags *JSONFlags) error

func SaveLocalMod

func SaveLocalMod(ctx context.Context, mod *common.ModMeta) error

func SaveLocalModRelease

func SaveLocalModRelease(ctx context.Context, release *common.Release) error

func SaveSettings

func SaveSettings(ctx context.Context, settings *client.Settings) error

func SaveUserSettingsForMod

func SaveUserSettingsForMod(ctx context.Context, id, version string, settings *client.UserSettings) error

func SetHTTPCacheEntryForURL

func SetHTTPCacheEntryForURL(ctx context.Context, url string, entry *HTTPCacheEntry) error

func TxFromCtx

func TxFromCtx(ctx context.Context) *bolt.Tx

func UpdateRemoteModsLastModifiedDates

func UpdateRemoteModsLastModifiedDates(ctx context.Context, dates RemoteIndexLastModifiedDates) error

Types

type HTTPCacheEntry

type HTTPCacheEntry struct {
	LastAccessed time.Time
	FetchDate    string
	ETag         string
}

func GetHTTPCacheEntryForURL

func GetHTTPCacheEntryForURL(ctx context.Context, url string) (*HTTPCacheEntry, error)

type JSONFlags

type JSONFlags struct {
	Version struct {
		Full        string
		Major       int
		Minor       int
		Build       int
		HasRevision bool `json:"has_revision"`
		Revision    int
		RevisionStr string `json:"revision_str"`
	}

	Flags []struct {
		Name        string
		Description string
		FsoOnly     bool `json:"fso_only"`
		// on_flags and off_flags skipped
		Type   string
		WebURL string `json:"web_url"`
	}

	Caps     []string
	Voices   []string
	Displays []struct {
		Index  int
		Name   string
		X      int
		Y      int
		Width  int
		Height int
		Modes  []struct {
			X    int
			Y    int
			Bits int
		}
	}

	Openal struct {
		VersionMajor    int             `json:"version_major"`
		VersionMinor    int             `json:"version_minor"`
		DefaultPlayback string          `json:"default_playback"`
		DefaultCapture  string          `json:"default_capture"`
		PlaybackDevices []string        `json:"playback_devices"`
		CaptureDevices  []string        `json:"capture_devices"`
		EfxSupport      map[string]bool `json:"efx_support"`
	}

	Joysticks []struct {
		Name       string
		GUID       string
		NumAxes    int  `json:"num_axes"`
		NumBalls   int  `json:"num_balls"`
		NumButtons int  `json:"num_buttons"`
		NumHats    int  `json:"num_hats"`
		IsHaptic   bool `json:"is_haptic"`
	}

	PrefPath string `json:"pref_path"`
}

func GetEngineFlags

func GetEngineFlags(ctx context.Context, path string) (*JSONFlags, error)

type ModProvider

type ModProvider interface {
	GetVersionsForMod(context.Context, string) ([]string, error)
	GetModRelease(context.Context, string, string) (*common.Release, error)
	GetMods(context.Context) ([]*common.Release, error)
	GetAllReleases(context.Context) ([]*common.Release, error)
	GetMod(context.Context, string) (*common.ModMeta, error)
}

type RemoteImportCallbackParams

type RemoteImportCallbackParams struct {
	ForAllVersions    func(func(string, []string) error) error
	RemoveMod         func(string) error
	RemoveRelease     func(string, string) error
	RemoveModReleases func(string) error
	AddMod            func(*common.ModMeta) error
	AddRelease        func(*common.Release) error
}

type RemoteIndexLastModifiedDates

type RemoteIndexLastModifiedDates map[string][]time.Time

func GetRemoteModsLastModifiedDates

func GetRemoteModsLastModifiedDates(ctx context.Context) (RemoteIndexLastModifiedDates, error)

type StringListIndex

type StringListIndex struct {
	Name string
	// contains filtered or unexported fields
}

func NewStringListIndex

func NewStringListIndex(name string, sorter StringListSorter) *StringListIndex

func (*StringListIndex) Add

func (i *StringListIndex) Add(tx *bolt.Tx, key, value string) error

func (*StringListIndex) BatchedAdd

func (i *StringListIndex) BatchedAdd(key, value string)

func (*StringListIndex) BatchedRemove

func (i *StringListIndex) BatchedRemove(key, value string)

func (*StringListIndex) BatchedRemoveAll

func (i *StringListIndex) BatchedRemoveAll(key string)

func (*StringListIndex) Clear

func (i *StringListIndex) Clear()

func (*StringListIndex) FinishBatch

func (i *StringListIndex) FinishBatch(tx *bolt.Tx) error

func (*StringListIndex) ForEach

func (i *StringListIndex) ForEach(cb func(string, []string) error) error

func (*StringListIndex) Lookup

func (i *StringListIndex) Lookup(key string) []string

func (*StringListIndex) Open

func (i *StringListIndex) Open(tx *bolt.Tx) error

func (*StringListIndex) Remove

func (i *StringListIndex) Remove(tx *bolt.Tx, key, value string) error

func (*StringListIndex) RemoveAll

func (i *StringListIndex) RemoveAll(tx *bolt.Tx, key, value string) error

func (*StringListIndex) Save

func (i *StringListIndex) Save(tx *bolt.Tx) error

func (*StringListIndex) StartBatch

func (i *StringListIndex) StartBatch()

type StringListSorter

type StringListSorter func(string, []string) error

type StringVersionCollection

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

StringVersionCollection can be used to sort a string slice based on semver ordering rules

func NewStringVersionCollection

func NewStringVersionCollection(versions []string) (*StringVersionCollection, error)

NewStringVersionCollection wraps the passed versions in a StringVersionCollection which can then be passed to sort.Sort

func (StringVersionCollection) Len

func (c StringVersionCollection) Len() int

func (StringVersionCollection) Less

func (c StringVersionCollection) Less(i, j int) bool

func (*StringVersionCollection) Swap

func (c *StringVersionCollection) Swap(i, j int)

Jump to

Keyboard shortcuts

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