Files
zot/pkg/storage/constants/constants.go
T
Ramkumar Chinchani fc03749c38 fix(storage): address review comments on global blobstore PR
- Use a dedicated migration marker (_blobstore/.migrated) instead of
  the heuristic blob-count sentinel in upgradeToGlobalBlobstore; this
  correctly skips the upgrade scan on fresh installs where the blobstore
  is empty and has never had blobs.

- Remove the stale gc.CleanRepo ShouldNotBeNil assertion in local_test.go
  that had no state change between calls and was incorrect once CleanRepo
  became idempotent for missing blobs.

- Accept HTTP 409 Conflict (bucket already exists) as a success case in
  the three S3 bucket-creation panics in controller_test.go, preventing
  test flakiness when the S3 mock retains bucket state across Convey blocks.

Signed-off-by: Ramkumar Chinchani <rchincha.dev@gmail.com>
2026-06-16 18:33:58 -07:00

49 lines
2.2 KiB
Go

package constants
import (
"time"
)
const (
// BlobUploadDir defines the upload directory for blob uploads.
BlobUploadDir = ".uploads"
SchemaVersion = 2
DefaultFilePerms = 0o600
DefaultDirPerms = 0o700
RLOCK = "RLock"
RWLOCK = "RWLock"
BlobsCache = "blobs"
DuplicatesBucket = "duplicates"
OriginalBucket = "original"
DBExtensionName = ".db"
DBCacheLockCheckTimeout = 10 * time.Second
BoltdbName = "cache"
DynamoDBDriverName = "dynamodb"
RedisDriverName = "redis"
RedisLocksBucket = "locks"
DefaultGCDelay = 1 * time.Hour
DefaultGCInterval = 1 * time.Hour
S3StorageDriverName = "s3"
GCSStorageDriverName = "gcs"
LocalStorageDriverName = "local"
// DedupeRestoreCompleteMarker is written at the image store root when a full dedupe-restore
// pass has completed. Its presence means no deduped blobs remain, so subsequent startups
// with dedupe=false can skip the expensive per-digest restore scan. The marker is deleted
// whenever dedupe is re-enabled, so that the next dedupe→false transition reruns restore.
DedupeRestoreCompleteMarker = "_restore_complete"
// DedupeRestoreMarkerComplete is the content of DedupeRestoreCompleteMarker when a restore
// pass has completed successfully.
DedupeRestoreMarkerComplete = "1"
// DedupeRestoreMarkerInvalid is the content written to DedupeRestoreCompleteMarker to
// invalidate a previous completion, forcing the restore scan to run again.
DedupeRestoreMarkerInvalid = "0"
// GlobalBlobsRepo is the internal directory used as the master copy location for deduped blobs.
// It uses a leading underscore to ensure it can never collide with a valid OCI repository name.
GlobalBlobsRepo = "_blobstore"
// BlobstoreMigratedMarker is written inside GlobalBlobsRepo when the one-time upgrade from
// per-repo blob layout to the global blobstore has completed. Its presence on subsequent
// startups causes the upgrade scan to be skipped entirely, even when the blobstore is empty
// (e.g. a fresh install that never had blobs).
BlobstoreMigratedMarker = "_blobstore/.migrated"
)