versionfile

package
v0.21.9-dev.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DatabaseStructVersion = 20220411
View Source
const InstalledVersionStructVersion = 20230502
View Source
const (
	PluginStructVersion = 20220411
)

Variables

View Source
var (
	ErrNoContent = errors.New("no content")
)

Functions

func EnsureVersionFilesInPluginDirectories added in v0.21.0

func EnsureVersionFilesInPluginDirectories(ctx context.Context) error

EnsureVersionFilesInPluginDirectories attempts a backfill of the individual version.json for plugins this is required only once when upgrading from 0.20.x

func FormatTime

func FormatTime(localTime time.Time) string

FormatTime :: format time as RFC3339 in UTC

Types

type DatabaseVersionFile

type DatabaseVersionFile struct {
	FdwExtension  InstalledVersion `json:"fdw_extension"`
	EmbeddedDB    InstalledVersion `json:"embedded_db"`
	StructVersion int64            `json:"struct_version"`
}

func LoadDatabaseVersionFile

func LoadDatabaseVersionFile() (*DatabaseVersionFile, error)

LoadDatabaseVersionFile migrates from the old version file format if necessary and loads the database version data

func NewDBVersionFile

func NewDBVersionFile() *DatabaseVersionFile

func (DatabaseVersionFile) IsValid

func (s DatabaseVersionFile) IsValid() bool

IsValid checks whether the struct was correctly deserialized, by checking if the StructVersion is populated

func (*DatabaseVersionFile) Save

func (f *DatabaseVersionFile) Save() error

Save writes the config

type InstalledVersion

type InstalledVersion struct {
	Name               string `json:"name"`
	Version            string `json:"version"`
	ImageDigest        string `json:"image_digest,omitempty"`
	BinaryDigest       string `json:"binary_digest,omitempty"`
	BinaryArchitecture string `json:"binary_arch,omitempty"`
	InstalledFrom      string `json:"installed_from,omitempty"`
	LastCheckedDate    string `json:"last_checked_date,omitempty"`
	InstallDate        string `json:"install_date,omitempty"`
	StructVersion      int64  `json:"struct_version"`
}

func EmptyInstalledVersion added in v0.21.0

func EmptyInstalledVersion() *InstalledVersion

func (*InstalledVersion) Equal added in v0.21.0

func (f *InstalledVersion) Equal(other *InstalledVersion) bool

Equal compares the `Name` and `BinaryDigest`

type PluginVersionFile

type PluginVersionFile struct {
	Plugins       map[string]*InstalledVersion `json:"plugins"`
	StructVersion int64                        `json:"struct_version"`
}

func LoadPluginVersionFile

func LoadPluginVersionFile(ctx context.Context) (*PluginVersionFile, error)

LoadPluginVersionFile migrates from the old version file format if necessary and loads the plugin version data

func (*PluginVersionFile) EnsurePluginVersionFile added in v0.21.0

func (f *PluginVersionFile) EnsurePluginVersionFile(installData *InstalledVersion) error

EnsurePluginVersionFile reads the version file in the plugin directory (if exists) and overwrites it if the data in the argument is different. The comparison is done using the `Name` and `BinaryDigest` properties. If the file doesn't exist, or cannot be read/parsed, EnsurePluginVersionFile fails over to overwriting the data

func (PluginVersionFile) IsValid

func (f PluginVersionFile) IsValid() bool

IsValid checks whether the struct was correctly deserialized, by checking if the StructVersion is populated

func (*PluginVersionFile) Save

func (f *PluginVersionFile) Save() error

Save writes the config file to disk

Jump to

Keyboard shortcuts

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