Skip to content

Commit 4ce65a2

Browse files
convert metacache struct to tuple as its transient (minio#13609)
Additionally re-arrange structs for less alignment size
1 parent d9800c8 commit 4ce65a2

File tree

4 files changed

+168
-166
lines changed

4 files changed

+168
-166
lines changed

cmd/data-scanner.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"context"
2323
"encoding/binary"
2424
"errors"
25+
"io/fs"
2526
"math"
2627
"math/rand"
2728
"net/http"
@@ -816,14 +817,13 @@ func (f *folderScanner) scanFolder(ctx context.Context, folder cachedFolder, int
816817

817818
// scannerItem represents each file while walking.
818819
type scannerItem struct {
819-
Path string
820-
Typ os.FileMode
821-
820+
Path string
822821
bucket string // Bucket.
823822
prefix string // Only the prefix if any, does not have final object name.
824823
objectName string // Only the object name without prefixes.
825-
lifeCycle *lifecycle.Lifecycle
826824
replication replicationConfig
825+
lifeCycle *lifecycle.Lifecycle
826+
Typ fs.FileMode
827827
heal bool // Has the object been selected for heal check?
828828
debug bool
829829
}

cmd/metacache-stream.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,13 @@ const metacacheStreamVersion = 2
5656

5757
// metacacheWriter provides a serializer of metacache objects.
5858
type metacacheWriter struct {
59+
streamErr error
5960
mw *msgp.Writer
6061
creator func() error
6162
closer func() error
6263
blockSize int
64+
streamWg sync.WaitGroup
6365
reuseBlocks bool
64-
65-
streamErr error
66-
streamWg sync.WaitGroup
6766
}
6867

6968
// newMetacacheWriter will create a serializer that will write objects in given order to the output.

cmd/metacache.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,21 @@ const (
5656

5757
// metacache contains a tracked cache entry.
5858
type metacache struct {
59-
id string `msg:"id"`
59+
// do not re-arrange the struct this struct has been ordered to use less
60+
// space - if you do so please run https://github.com/orijtech/structslop
61+
// and verify if your changes are optimal.
62+
ended time.Time `msg:"end"`
63+
started time.Time `msg:"st"`
64+
lastHandout time.Time `msg:"lh"`
65+
lastUpdate time.Time `msg:"u"`
6066
bucket string `msg:"b"`
61-
root string `msg:"root"`
62-
recursive bool `msg:"rec"`
6367
filter string `msg:"flt"`
64-
status scanStatus `msg:"stat"`
65-
fileNotFound bool `msg:"fnf"`
68+
id string `msg:"id"`
6669
error string `msg:"err"`
67-
started time.Time `msg:"st"`
68-
ended time.Time `msg:"end"`
69-
lastUpdate time.Time `msg:"u"`
70-
lastHandout time.Time `msg:"lh"`
70+
root string `msg:"root"`
71+
fileNotFound bool `msg:"fnf"`
72+
status scanStatus `msg:"stat"`
73+
recursive bool `msg:"rec"`
7174
dataVersion uint8 `msg:"v"`
7275
}
7376

0 commit comments

Comments
 (0)