ncps

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Migration result constants for metrics.
	MigrationResultSuccess = "success"
	MigrationResultFailure = "failure"
	MigrationResultSkipped = "skipped"

	// Migration operation constants for metrics.
	MigrationOperationMigrate = "migrate"
	MigrationOperationDelete  = "delete"

	// Migration type constants for metrics.
	MigrationTypeNarInfoToDB = "narinfo-to-db"
	MigrationTypeNarToChunks = "nar-to-chunks"
)

Variables

View Source
var (
	// ErrXZBinAbsPath is returned when the xz binary path is not an absolute
	// path.
	ErrXZBinAbsPath = errors.New("the path to xz binary must be an absolute path")

	// ErrXZBinEmptyPath is returned when the xz binary path is empty.
	ErrXZBinEmptyPath = errors.New("--xz-binary-path cannot be empty")

	// Version defines the version of the binary, and is meant to be set with ldflags at build time.
	//
	//nolint:gochecknoglobals
	Version = "dev"
)
View Source
var (
	// ErrCacheMaxSizeRequired is returned if --cache-lru-schedule was given but not --cache-max-size.
	ErrCacheMaxSizeRequired = errors.New("--cache-max-size is required when --cache-lru-schedule is specified")

	// ErrStorageConfigRequired is returned if neither local nor S3 storage is configured.
	ErrStorageConfigRequired = errors.New("either --cache-storage-local or --cache-storage-s3-bucket is required")

	ErrS3ConfigIncomplete = errors.New(
		"S3 requires --cache-storage-s3-endpoint, --cache-storage-s3-access-key-id, and --cache-storage-s3-secret-access-key",
	)

	// ErrStorageConflict is returned if both local and S3 storage are configured.
	ErrStorageConflict = errors.New("cannot use both --cache-storage-local and --cache-storage-s3-bucket")

	// ErrUpstreamCacheRequired is returned if no upstream cache is configured.
	ErrUpstreamCacheRequired = errors.New("at least one --cache-upstream-url is required")

	// ErrRedisAddrsRequired is returned when Redis backend is selected but no addresses are provided.
	ErrRedisAddrsRequired = errors.New("--cache-lock-backend=redis requires --cache-redis-addrs to be set")

	// ErrUnknownLockBackend is returned when an unknown lock backend is specified.
	ErrUnknownLockBackend = errors.New("unknown lock backend")
)
View Source
var ErrFsckIssuesFound = errors.New("consistency issues found")

ErrFsckIssuesFound is returned when fsck finds consistency issues.

View Source
var ErrMigrationFailed = errors.New("narinfos failed to migrate")

ErrMigrationFailed is returned when one or more NarInfos fail to migrate.

View Source
var ErrStorageIterationNotSupported = errors.New("storage backend does not support iteration")

ErrStorageIterationNotSupported is returned when the storage backend does not support iteration.

View Source
var ErrUnmigratedNarinfosFound = errors.New("unmigrated narinfos found")

ErrUnmigratedNarinfosFound is returned when there are unmigrated narinfos.

Functions

func New

func New() (*cli.Command, error)

func RecordMigrationBatchSize added in v0.8.0

func RecordMigrationBatchSize(ctx context.Context, migrationType string, size int64)

RecordMigrationBatchSize records the size of a migration batch. migrationType should be one of MigrationType* constants.

func RecordMigrationDuration added in v0.8.0

func RecordMigrationDuration(ctx context.Context, migrationType, operation string, duration float64)

RecordMigrationDuration records the duration of a migration operation. migrationType should be one of MigrationType* constants. operation should be one of MigrationOperation* constants. duration should be in seconds.

func RecordMigrationObject added in v0.8.1

func RecordMigrationObject(ctx context.Context, migrationType, operation, result string)

RecordMigrationObject records an object migration operation. migrationType should be one of MigrationType* constants. operation should be one of MigrationOperation* constants. result should be one of MigrationResult* constants.

Types

type ChunkWalker added in v0.9.2

type ChunkWalker interface {
	WalkChunks(ctx context.Context, fn func(hash string) error) error
}

ChunkWalker is implemented by chunk stores that support walking chunk files.

type NarInfoWalker added in v0.8.0

type NarInfoWalker interface {
	WalkNarInfos(ctx context.Context, fn func(hash string) error) error
}

type NarWalker added in v0.9.2

type NarWalker interface {
	WalkNars(ctx context.Context, fn func(narURL nar.URL) error) error
}

NarWalker is implemented by storage backends that support walking NAR files.

Jump to

Keyboard shortcuts

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