Skip to content
Snippets Groups Projects
Unverified Commit 1174edaa authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Allow to ignore blobs processing

parent e93a30e2
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -32,6 +32,10 @@ func (b blobsData) mark(name string) error {
blobsLock.Lock()
defer blobsLock.Unlock()
 
if *ignoreBlobs {
return nil
}
blob := b[name]
if blob == nil {
return fmt.Errorf("blob not found: %v", name)
Loading
Loading
@@ -48,6 +52,14 @@ func (b blobsData) etag(name string) string {
return ""
}
 
func (b blobsData) size(name string) int64 {
blob := b[name]
if blob != nil {
return blob.size
}
return 0
}
func (b blobsData) sweep(deletes deletesData) {
for _, blob := range b {
if blob.references == 0 {
Loading
Loading
@@ -114,6 +126,10 @@ func (b blobsData) info() {
var blobsUsed, blobsUnused int
var blobsUsedSize, blobsUnusedSize int64
 
if *ignoreBlobs {
return
}
for _, blob := range b {
if blob.references > 0 {
blobsUsed++
Loading
Loading
Loading
Loading
@@ -16,6 +16,7 @@ var (
storage = flag.String("storage", "filesystem", "Storage type to use: filesystem or s3")
jobs = flag.Int("jobs", 10, "Number of concurrent jobs to execute")
parallelWalkJobs = flag.Int("parallel-walk-jobs", 10, "Number of concurrent parallel walk jobs to execute")
ignoreBlobs = flag.Bool("ignore-blobs", true, "Ignore blobs processing and recycling")
)
 
func main() {
Loading
Loading
@@ -74,6 +75,10 @@ func main() {
go func() {
defer wg.Done()
 
if *ignoreBlobs {
return
}
err = blobs.walk()
if err != nil {
logrus.Fatalln(err)
Loading
Loading
Loading
Loading
@@ -278,16 +278,12 @@ func (r *repositoryData) info(blobs blobsData) {
var layersUsedSize, layersUnusedSize int64
 
for name, used := range r.layers {
blob := blobs[name]
if blob == nil {
continue
}
if used > 0 {
layersUsed++
layersUsedSize += blob.size
layersUsedSize += blobs.size(name)
} else {
layersUnused++
layersUnusedSize += blob.size
layersUnusedSize += blobs.size(name)
}
}
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment