8000 assorted lint; align fields · NVIDIA/aistore@a5f7cfe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit a5f7cfe

Browse files
committed
assorted lint; align fields
Signed-off-by: Alex Aizman <alex.aizman@gmail.com>
1 parent a520583 commit a5f7cfe

File tree

16 files changed

+74
-85
lines changed

16 files changed

+74
-85
lines changed

3rdparty/golang/mux/mux.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,19 @@ import (
5858
// ServeMux also takes care of sanitizing the URL request path and the Host
5959
// header, stripping the port number and redirecting any request containing . or
6060
// .. elements or repeated slashes to an equivalent, cleaner URL.
61-
type ServeMux struct {
62-
mu sync.RWMutex
63-
m map[string]muxEntry
64-
es []muxEntry // slice of entries sorted from longest to shortest.
65-
hosts bool // whether any patterns contain hostnames
66-
tracingEnabled bool // enable tracing
67-
}
68-
69-
type muxEntry struct {
70-
h http.Handler
71-
pattern string
72-
}
61+
type (
62+
muxEntry struct {
63+
h http.Handler
64+
pattern string
65+
}
66+
ServeMux struct {
67+
m map[string]muxEntry
68+
es []muxEntry // entries sorted longest to shortest
69+
mu sync.RWMutex
70+
hosts bool // whether any patterns contain hostnames
71+
tracingEnabled bool // as the name implies
72+
}
73+
)
7374

7475
// NewServeMux allocates and returns a new ServeMux.
7576
func NewServeMux(enableTracing bool) *ServeMux {

ais/backend/aws.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Package backend contains implementation of various backend providers.
44
/*
5-
* Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.
5+
* Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
66
*/
77
package backend
88

ais/prxnotif.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -663,14 +663,12 @@ func (l *listeners) add(nl nl.Listener, locked bool) (exists bool) {
663663
if !locked {
664664
l.mtx.Unlock()
665665
}
666-
return
666+
return exists
667667
}
668668

669669
func (l *listeners) del(nl nl.Listener, locked bool) (ok bool) {
670670
if !locked {
671671
l.mtx.Lock()
672-
} else {
673-
debug.AssertRWMutexLocked(&l.mtx)
674672
}
675673
if _, ok = l.m[nl.UUID()]; ok {
676674
delete(l.m, nl.UUID())
@@ -680,13 +678,13 @@ func (l *listeners) del(nl nl.Listener, locked bool) (ok bool) {
680678
if !locked {
681679
l.mtx.Unlock()
682680
}
683-
return
681+
return ok
684682
}
685683

686684
// PRECONDITION: `l` should be under lock.
687685
func (l *listeners) exists(uuid string) (ok bool) {
688686
_, ok = l.m[uuid]
689-
return
687+
return ok
690688
}
691689

692690
// Returns a listener that matches the filter condition.

ais/test/etl_stress_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Package integration_test.
22
/*
3-
* Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
3+
* Copyright (c) 2021-2025, NVIDIA CORPORATION. All rights reserved.
44
*/
55
package integration_test
66

api/object.go

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -70,30 +70,23 @@ type (
7070
)
7171

7272
// PUT(object)
73+
// - Cksum is optional; when provided:
74+
// if object exists: load the object's metadata, compare checksums - skip writing if equal
75+
// otherwise, compare the two checksums upon writing (aka, "end-to-end protection")
76+
// - SkipVC:
77+
// skip loading existing object's metadata in order to
78+
// compare its Checksum and update its existing Version (if exists);
79+
// can be used to reduce PUT latency when massively writing new content (or simply don't care)
7380
type (
7481
PutArgs struct {
75-
Reader cos.ReadOpenCloser
76-
77-
// optional; if provided:
78-
// - if object exists: load the object's metadata, compare checksums - skip writing if equal
79-
// - otherwise, compare the two checksums upon writing (aka, "end-to-end protection")
80-
Cksum *cos.Cksum
81-
82+
Reader cos.ReadOpenCloser
83+
Cksum *cos.Cksum
84+
Header http.Header
8285
BaseParams BaseParams
83-
84-
Bck cmn.Bck
85-
ObjName string
86-
87-
Size uint64 // optional
88-
89-
// Skip loading existing object's metadata in order to
90-
// compare its Checksum and update its existing Version (if exists);
91-
// can be used to reduce PUT latency when:
92-
// - we massively write a new content into a bucket, and/or
93-
// - we simply don't care.
94-
SkipVC bool
95-
96-
Header http.Header
86+
Bck cmn.Bck
87+
ObjName string
88+
Size uint64
89+
SkipVC bool
9790
}
9891
)
9992

@@ -113,7 +106,7 @@ type (
113106
// Archive files and directories
114107
PutApndArchArgs struct {
115108
ArchPath string // filename _in_ archive
116-
Mime string // user-specified mime type (NOTE: takes precedence if defined)
109+
Mime string // user-specified mime type, takes precedence if defined
117110
PutArgs
118111
Flags int64 // apc.ArchAppend and apc.ArchAppendIfExist (the former requires destination shard to exist)
119112
}

cmd/cli/cli/job_hdlr.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,8 @@ func stopJobHandler(c *cli.Context) error {
816816
case commandRebalance:
817817
if xid == "" {
818818
return stopRebHandler(c)
819-
} else {
820-
return stopReb(c, xid)
821819
}
820+
return stopReb(c, xid)
822821
}
823822

824823
// generic xstop

cmd/cli/teb/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Package teb contains templates and (templated) tables to format CLI output.
22
/*
3-
* Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.
3+
* Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
44
*/
55
package teb
66

cmn/cos/stats.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ type (
2626
IncWith(name string, VarLabs map[string]string)
2727
}
2828
NamedVal64 struct {
29+
VarLabs map[string]string
2930
Name string
3031
Value int64
31-
VarLabs map[string]string // (Prometheus only)
3232
}
3333
)

ext/etl/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Package etl provides utilities to initialize and use transformation pods.
22
/*
3-
* Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
3+
* Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
44
*/
55
package etl
66

nl/listener.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Package notifications provides interfaces for AIStore notifications
22
/*
3-
* Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.
3+
* Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
44
*/
55
package nl
66

@@ -177,8 +177,6 @@ func (nlb *ListenerBase) Err() error {
177177
}
178178

179179
func (nlb *ListenerBase) SetStats(daeID string, stats any) {
180-
debug.AssertRWMutexLocked(&nlb.mu)
181-
182180
_, ok := nlb.Srcs[daeID]
183181
debug.Assert(ok)
184182
nlb.Stats.Store(daeID, stats)

tools/tetl/etl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Package tetl provides helpers for ETL.
22
/*
3-
* Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
3+
* Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
44
*/
55
package tetl
66

transport/api.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Package transport provides long-lived http/tcp connections for
22
// intra-cluster communications (see README for details and usage example).
33
/*
4-
* Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.
4+
* Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
55
*/
66
package transport
77

@@ -49,14 +49,14 @@ const sizeofh = int(unsafe.Sizeof(Obj{}))
4949
type (
5050
// advanced usage: additional stream control
5151
Extra struct {
52-
Callback ObjSentCB // typical usage: to free SGLs, close files, etc.
52+
Xact core.Xact // usage: sender ID; abort
53+
Callback ObjSentCB // typical usage: to free SGLs, close files
5354
Config *cmn.Config // (to optimize-out GCO.Get())
5455
Compression string // see CompressAlways, etc. enum
55-
Xact core.Xact // usage: sender ID; abort
5656
IdleTeardown time.Duration // when exceeded, causes PUT to terminate (and to renew upon the very next send)
57-
SizePDU int32 // NOTE: 0(zero): no PDUs; must be below maxSizePDU; unknown size _requires_ PDUs
58-
MaxHdrSize int32 // overrides config.Transport.MaxHeaderSize
5957
ChanBurst int // overrides config.Transport.Burst
58+
SizePDU int32 // NOTE: 0(zero): no PDUs; must be <= `maxSizePDU`; unknown size _requires_ PDUs
59+
MaxHdrSize int32 // overrides config.Transport.MaxHeaderSize
6060
}
6161

6262
// receive-side session stats indexed by session ID (see recv.go for "uid")

xact/xs/archive.go

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Package xs is a collection of eXtended actions (xactions), including multi-object
22
// operations, list-objects, (cluster) rebalance and (target) resilver, ETL, and more.
33
/*
4-
* Copyright (c) 2021-2024, NVIDIA CORPORATION. All rights reserved.
4+
* Copyright (c) 2021-2025, NVIDIA CORPORATION. All rights reserved.
55
*/
66
package xs
77

@@ -40,22 +40,21 @@ type (
4040
archFactory struct {
4141
streamingF
4242
}
43-
archwi struct { // archival work item; implements lrwi
44-
j *jogger
45-
writer archive.Writer
46-
r *XactArch
47-
msg *cmn.ArchiveBckMsg
48-
tsi *meta.Snode
49-
archlom *core.LOM
50-
fqn string // workFQN --/--
51-
wfh cos.LomWriter // -> workFQN
52-
cksum cos.CksumHashSize
53-
cnt atomic.Int32 // num archived
54-
// tar only
55-
appendPos int64 // append to existing
43+
// archival work item; implements lrwi
44+
archwi struct {
45+
wfh cos.LomWriter // -> workFQN
46+
writer archive.Writer
47+
r *XactArch
48+
msg *cmn.ArchiveBckMsg
49+
tsi *meta.Snode
50+
archlom *core.LOM
51+
j *jogger
52+
fqn string // workFQN --/--
53+
cksum cos.CksumHashSize
54+
appendPos int64 // append to existing (tar only)
5655
tarFormat tar.Format
57-
// finishing
58-
refc atomic.Int32
56+
cnt atomic.Int32 // num archived
57+
refc atomic.Int32 // finishing
5958
}
6059
archtask struct {
6160
wi *archwi
@@ -66,8 +65,10 @@ type (
6665
workCh chan *archtask
6766
stopCh cos.StopCh
6867
}
68+
)
69+
70+
type (
6971
XactArch struct {
70-
streamingX
7172
bckTo *meta.Bck
7273
joggers struct {
7374
wg sync.WaitGroup
@@ -78,6 +79,7 @@ type (
7879
m map[string]*archwi
7980
sync.RWMutex
8081
}
82+
streamingX
8183
}
8284
)
8385

xact/xs/lrit.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,15 @@ type (
6868

6969
// common multi-object operation context and list|range|prefix logic
7070
lrit struct {
71-
parent lrxact
72-
msg *apc.ListRange
73-
bck *meta.Bck
74-
pt *cos.ParsedTemplate
75-
prefix string
76-
lrp int // { lrpList, ... } enum
77-
78-
// running concurrency
79-
workCh chan lrpair
80-
workers []*lrworker
81-
wg sync.WaitGroup
71+
parent lrxact
72+
msg *apc.ListRange
73+
bck *meta.Bck
74+
pt *cos.ParsedTemplate
75+
workCh chan lrpair // running concurrency
76+
prefix string
77+
workers []*lrworker // running concurrency
78+
wg sync.WaitGroup // ditto
79+
lrp int // enum { lrpList, ... }
8280
}
8381
)
8482

xact/xs/prefetch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ type (
4848
config *cmn.Config
4949
msg *apc.PrefetchMsg
5050
lrit
51+
pebl pebl
5152
xact.Base
52-
pebl pebl
5353
latestVer bool
5454
}
5555
)

xact/xs/wi_lso.go

Lines changed: 1 addition & 1 deletion
lomVisitedCb lomVisitedCb
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ type (
2828
smap *meta.Smap
2929
msg *apc.LsoMsg
3030
31+
custom cos.StrKVs
3132
markerDir string
3233
wanted cos.BitFlags
33-
custom cos.StrKVs
3434
}
3535
)
3636

0 commit comments

Comments
 (0)
0