Documentation ¶
Index ¶
- Constants
- func GenerateInstanceID() string
- func IsUnknownVersion(err error) bool
- func IsValidVersion(version int) bool
- type ErrUnknownRepoVersion
- type FsRepo
- func (fsr *FsRepo) EnsureRepoPathsConfigured(c config_legacy.ReadWriter)
- func (fsr *FsRepo) Exists() (bool, error)
- func (fsr *FsRepo) Init() error
- func (fsr *FsRepo) InstanceID() string
- func (fsr *FsRepo) MustInstanceID() (string, error)
- func (fsr *FsRepo) Open() error
- func (fsr *FsRepo) Path() (string, error)
- func (fsr *FsRepo) ReadLastUpdateCheck() (time.Time, error)
- func (fsr *FsRepo) ReadLegacyVersion() (int, error)
- func (fsr *FsRepo) ReadNodeName() (string, error)
- func (fsr *FsRepo) SystemMetadata() (*SystemMetadata, error)
- func (fsr *FsRepo) Version() (int, error)
- func (fsr *FsRepo) WriteLastUpdateCheck(lastUpdateCheck time.Time) error
- func (fsr *FsRepo) WriteLegacyVersion(version int) error
- func (fsr *FsRepo) WriteNodeName(name string) error
- func (fsr *FsRepo) WriteRunInfo(ctx context.Context, summaryShellVariablesString string) (string, error)
- func (fsr *FsRepo) WriteVersion(version int) error
- type FsRepoParams
- type Migration
- type MigrationFn
- type MigrationManager
- type SystemMetadata
- type Version
Constants ¶
const ( // Version1 is the repo versioning for v1-v1.1.4 Version1 = iota + 1 // Version2 is the repo versioning up to v1.2.1 Version2 // Version3 is the repo version to (including) v1.4.0 Version3 // Version4 is the latest version Version4 )
const LegacyVersionFile = "repo.version"
LegacyVersionFile is the name of the repo file containing the repo version. This file is only used in versions 1.4.0 and below. Subsequent bacalhau versions persist the repo version to system_metadata.yaml
const SystemMetadataFile = "system_metadata.yaml"
SystemMetadataFile is the name of the file containing the SystemMetadata.
const UnknownVersion = -1
Variables ¶
This section is empty.
Functions ¶
func GenerateInstanceID ¶ added in v1.5.0
func GenerateInstanceID() string
GenerateInstanceID creates a unique, anonymous identifier for the instance of bacalhau.
func IsUnknownVersion ¶ added in v1.3.0
func IsValidVersion ¶ added in v1.2.1
IsValidVersion returns true if the version is valid.
Types ¶
type ErrUnknownRepoVersion ¶ added in v1.3.0
type ErrUnknownRepoVersion int
func NewUnknownRepoVersionError ¶ added in v1.3.0
func NewUnknownRepoVersionError(version int) ErrUnknownRepoVersion
func (ErrUnknownRepoVersion) Error ¶ added in v1.3.0
func (e ErrUnknownRepoVersion) Error() string
type FsRepo ¶
type FsRepo struct { Migrations *MigrationManager // contains filtered or unexported fields }
func NewFS ¶
func NewFS(params FsRepoParams) (*FsRepo, error)
func (*FsRepo) EnsureRepoPathsConfigured ¶ added in v1.3.2
func (fsr *FsRepo) EnsureRepoPathsConfigured(c config_legacy.ReadWriter)
EnsureRepoPathsConfigured modifies the config to include keys for accessing repo paths
func (*FsRepo) InstanceID ¶ added in v1.5.0
InstanceID reads the InstanceID in the metadata. It returns empty string if it fails to read the metadata.
func (*FsRepo) MustInstanceID ¶ added in v1.5.0
MustInstanceID reads the InstanceID in the metadata. It fails if the metadata file doesn't exist.
func (*FsRepo) ReadLastUpdateCheck ¶ added in v1.5.0
ReadLastUpdateCheck returns the last update check value from system_metadata.yaml It fails if the metadata file doesn't exist.
func (*FsRepo) ReadLegacyVersion ¶ added in v1.5.0
ReadLegacyVersion reads the repo version from the LegacyVersionFile.
func (*FsRepo) ReadNodeName ¶ added in v1.5.0
func (*FsRepo) SystemMetadata ¶ added in v1.5.0
func (fsr *FsRepo) SystemMetadata() (*SystemMetadata, error)
func (*FsRepo) WriteLastUpdateCheck ¶ added in v1.5.0
WriteLastUpdateCheck updates the LastUpdateCheck in the metadata. It fails if the metadata file doesn't exist.
func (*FsRepo) WriteLegacyVersion ¶ added in v1.5.0
WriteLegacyVersion writes the repo version to LegacyVersionFile.
func (*FsRepo) WriteNodeName ¶ added in v1.5.0
func (*FsRepo) WriteRunInfo ¶
func (*FsRepo) WriteVersion ¶ added in v1.5.0
WriteVersion updates the RepoVersion in the SystemMetadataFile. If the metadata file doesn't exist, it creates a new one.
type FsRepoParams ¶ added in v1.2.2
type FsRepoParams struct { Path string Migrations *MigrationManager }
type Migration ¶ added in v1.2.2
type Migration struct { FromVersion int ToVersion int Migrations []MigrationFn }
func NewMigration ¶ added in v1.2.2
func NewMigration(fromVersion, toVersion int, migrations ...MigrationFn) Migration
NewMigration creates a new migration.
type MigrationFn ¶ added in v1.2.2
type MigrationManager ¶ added in v1.2.2
type MigrationManager struct {
// contains filtered or unexported fields
}
func NewMigrationManager ¶ added in v1.2.2
func NewMigrationManager(migrations ...Migration) (*MigrationManager, error)
NewMigrationManager creates a new migration manager.
func (*MigrationManager) Add ¶ added in v1.2.2
func (m *MigrationManager) Add(migration Migration) error
Add adds a migration to the manager.
func (*MigrationManager) Migrate ¶ added in v1.2.2
func (m *MigrationManager) Migrate(repo FsRepo) error
Migrate runs the migrations on the given repo.
type SystemMetadata ¶ added in v1.5.0
type SystemMetadata struct { RepoVersion int `yaml:"RepoVersion"` InstanceID string `yaml:"InstanceID"` LastUpdateCheck time.Time `yaml:"LastUpdateCheck"` NodeName string `yaml:"NodeName"` }
func LoadSystemMetadata ¶ added in v1.5.0
func LoadSystemMetadata(path string) (*SystemMetadata, error)