buflock

package
v1.28.1 Latest Latest
Warning

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

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

Documentation

Overview

Package buflock manages the buf.lock lock file.

Index

Constants

View Source
const (
	// ExternalConfigFilePath defines the path to the lock file, relative to the root of the module.
	ExternalConfigFilePath = "buf.lock"
	// V1Version is the string used to identify the v1 version of the lock file.
	V1Version = "v1"
	// V1Beta1Version is the string used to identify the v1beta1 version of the lock file.
	V1Beta1Version = "v1beta1"
	// Header is the header prepended to any lock files.
	Header = "# Generated by buf. DO NOT EDIT.\n"
)

Variables

This section is empty.

Functions

func CheckDeprecatedDigests added in v1.28.0

func CheckDeprecatedDigests(
	ctx context.Context,
	logger *zap.Logger,
	readBucket storage.ReadBucket,
) error

CheckDeprecatedDigests prints a warning if a lock file exists at ExternalConfigFilePath and has deprecated digest formats.

func WriteConfig

func WriteConfig(ctx context.Context, writeBucket storage.WriteBucket, config *Config) error

WriteConfig writes the lock file to the WriteBucket at ExternalConfigFilePath.

Types

type Config

type Config struct {
	Dependencies []Dependency
}

Config holds the parsed lock file information.

func ReadConfig

func ReadConfig(ctx context.Context, readBucket storage.ReadBucket) (*Config, error)

ReadConfig reads the lock file at ExternalConfigFilePath relative to the root of the bucket.

type Dependency

type Dependency struct {
	Remote     string
	Owner      string
	Repository string
	Commit     string
	Digest     string
}

Dependency describes a single pinned dependency.

func DependencyForExternalConfigDependencyV1 added in v1.0.0

func DependencyForExternalConfigDependencyV1(dep ExternalConfigDependencyV1) Dependency

DependencyForExternalConfigDependencyV1 returns the Dependency representation of a ExternalConfigDependencyV1.

func DependencyForExternalConfigDependencyV1Beta1 added in v1.0.0

func DependencyForExternalConfigDependencyV1Beta1(dep ExternalConfigDependencyV1Beta1) Dependency

DependencyForExternalConfigDependencyV1Beta1 returns the Dependency representation of a ExternalConfigDependencyV1Beta1.

type ExternalConfigDependencyV1

type ExternalConfigDependencyV1 struct {
	Remote     string    `json:"remote,omitempty" yaml:"remote,omitempty"`
	Owner      string    `json:"owner,omitempty" yaml:"owner,omitempty"`
	Repository string    `json:"repository,omitempty" yaml:"repository,omitempty"`
	Branch     string    `json:"branch,omitempty" yaml:"branch,omitempty"`
	Commit     string    `json:"commit,omitempty" yaml:"commit,omitempty"`
	Digest     string    `json:"digest,omitempty" yaml:"digest,omitempty"`
	CreateTime time.Time `json:"create_time,omitempty" yaml:"create_time,omitempty"`
}

ExternalConfigDependencyV1 represents a single dependency within the v1 lock file.

func ExternalConfigDependencyV1ForDependency added in v1.0.0

func ExternalConfigDependencyV1ForDependency(dep Dependency) ExternalConfigDependencyV1

ExternalConfigDependencyV1ForDependency returns the ExternalConfigDependencyV1 of a Dependency.

Note, some fields will be their empty value since not all values are available on the Dependency.

type ExternalConfigDependencyV1Beta1

type ExternalConfigDependencyV1Beta1 struct {
	Remote     string    `json:"remote,omitempty" yaml:"remote,omitempty"`
	Owner      string    `json:"owner,omitempty" yaml:"owner,omitempty"`
	Repository string    `json:"repository,omitempty" yaml:"repository,omitempty"`
	Branch     string    `json:"branch,omitempty" yaml:"branch,omitempty"`
	Commit     string    `json:"commit,omitempty" yaml:"commit,omitempty"`
	Digest     string    `json:"digest,omitempty" yaml:"digest,omitempty"`
	CreateTime time.Time `json:"create_time,omitempty" yaml:"create_time,omitempty"`
}

ExternalConfigDependencyV1Beta1 represents a single dependency within the v1beta1 lock file.

func ExternalConfigDependencyV1Beta1ForDependency added in v1.0.0

func ExternalConfigDependencyV1Beta1ForDependency(dep Dependency) ExternalConfigDependencyV1Beta1

ExternalConfigDependencyV1Beta1ForDependency returns the ExternalConfigDependencyV1Beta1 of a Dependency.

Note, some fields will be their empty value since not all values are available on the Dependency.

type ExternalConfigV1

type ExternalConfigV1 struct {
	Version string                       `json:"version,omitempty" yaml:"version,omitempty"`
	Deps    []ExternalConfigDependencyV1 `json:"deps,omitempty" yaml:"deps,omitempty"`
}

ExternalConfigV1 represents the v1 lock file.

type ExternalConfigV1Beta1

type ExternalConfigV1Beta1 struct {
	Version string                            `json:"version,omitempty" yaml:"version,omitempty"`
	Deps    []ExternalConfigDependencyV1Beta1 `json:"deps,omitempty" yaml:"deps,omitempty"`
}

ExternalConfigV1Beta1 represents the v1beta1 lock file.

type ExternalConfigVersion

type ExternalConfigVersion struct {
	Version string `json:"version,omitempty" yaml:"version,omitempty"`
}

ExternalConfigVersion defines the subset of all lock file versions that is used to determine the version.

Jump to

Keyboard shortcuts

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