Skip to content

Commit

Permalink
lint: align fields
Browse files Browse the repository at this point in the history
* part two, prev. commit: 2fc40de

Signed-off-by: Alex Aizman <[email protected]>
  • Loading branch information
alex-aizman committed Nov 13, 2024
1 parent 2fc40de commit 39a5943
Show file tree
Hide file tree
Showing 27 changed files with 103 additions and 100 deletions.
7 changes: 4 additions & 3 deletions ais/bucketmeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ type (
pre func(*bmdModifier, *bucketMD) error
final func(*bmdModifier, *bucketMD)

msg *apc.ActMsg
txnID string // transaction UUID
bcks []*meta.Bck
msg *apc.ActMsg

propsToUpdate *cmn.BpropsToSet // update existing props
revertProps *cmn.BpropsToSet // props to revert
setProps *cmn.Bprops // new props to set

txnID string // transaction UUID
bcks []*meta.Bck

wait bool
needReMirror bool
needReEC bool
Expand Down
6 changes: 3 additions & 3 deletions ais/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const usecli = " -role=<proxy|target> -config=</dir/config.json> -local_config=<

type (
daemonCtx struct {
cli cliFlags
rg *rungroup
version string // major.minor.build (see cmd/aisnode)
buildTime string // YYYY-MM-DD HH:MM:SS-TZ
Expand All @@ -44,6 +43,7 @@ type (
reason string // Reason why resilver needs to be run.
required bool // Determines if the resilver needs to be started.
}
cli cliFlags
}
cliFlags struct {
localConfigPath string // path to local config
Expand All @@ -67,8 +67,8 @@ type (
usage bool // show usage and exit
}
runRet struct {
name string
err error
name string
}
rungroup struct {
rs map[string]cos.Runner
Expand Down Expand Up @@ -374,7 +374,7 @@ func (g *rungroup) run(r cos.Runner) {
if err != nil {
nlog.Warningf("runner [%s] exited with err [%v]", r.Name(), err)
}
g.errCh <- runRet{r.Name(), err}
g.errCh <- runRet{err, r.Name()}
}

func (g *rungroup) runAll(mainRunner cos.Runner) error {
Expand Down
14 changes: 7 additions & 7 deletions ais/htcommon.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ type (
}

networkHandler struct {
r string // resource
h http.HandlerFunc // handler
net netAccess // handler network access
r string // resource
net netAccess // handler's network access
}

nodeRegPool []cluMeta
Expand Down Expand Up @@ -175,10 +175,10 @@ type (

// http server and http runner (common for proxy and target)
netServer struct {
sync.Mutex
s *http.Server
muxers httpMuxers
sndRcvBufSize int
sync.Mutex
}

nlogWriter struct{}
Expand All @@ -191,16 +191,16 @@ type (
errBmdUUIDSplit struct{ detail string }
errSmapUUIDDiffer struct{ detail string } // ditto Smap
errNodeNotFound struct {
msg string
id string
si *meta.Snode // self
smap *smapX
msg string
id string
}
errSelfNotFound struct {
act string
si *meta.Snode
tag string
smap *smapX
act string
tag string
}
errNotEnoughTargets struct {
si *meta.Snode
Expand Down
22 changes: 11 additions & 11 deletions ais/htrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,22 @@ type htext interface {
}

type htrun struct {
si *meta.Snode
keepalive keepaliver
statsT stats.Tracker
owner struct {
owner struct {
smap *smapOwner
bmd bmdOwner // an interface with proxy and target impl-s
bmd bmdOwner // interface with proxy and target impl-s
rmd *rmdOwner
config *configOwner
etl etlOwner // ditto
etl etlOwner
}
startup struct {
keepalive keepaliver
statsT stats.Tracker
si *meta.Snode
gmm *memsys.MMSA // system pagesize-based memory manager and slab allocator
smm *memsys.MMSA // small-size allocator (up to 4K)
startup struct {
cluster atomic.Int64 // mono.NanoTime() since cluster startup, zero prior to that
node atomic.Int64 // ditto - for the node
node atomic.Int64 // ditto - for this node
}
gmm *memsys.MMSA // system pagesize-based memory manager and slab allocator
smm *memsys.MMSA // system MMSA for small-size allocations
}

///////////
Expand Down Expand Up @@ -788,7 +788,7 @@ func (h *htrun) _nfy(n core.Notif, err error, upon string, aborted bool) {
if si := smap.GetActiveNode(dst); si != nil {
nodes = append(nodes, si)
} else {
nlog.Errorln(&errNodeNotFound{"failed to notify", dst, h.si, smap})
nlog.Errorln(&errNodeNotFound{h.si, smap, "failed to notify", dst})
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions ais/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import (
)

type global struct {
client struct {
control *http.Client // http client for intra-cluster comm
data *http.Client // http client to execute target <=> target GET & PUT (object)
}
netServ struct {
pub *netServer
pubExtra []*netServer
control *netServer
data *netServer
}
client struct {
control *http.Client // http client for intra-cluster comm
data *http.Client // http client to execute target <=> target GET & PUT (object)
pubExtra []*netServer
}
}

Expand Down
14 changes: 7 additions & 7 deletions ais/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ type (
mu sync.RWMutex
}
remais struct {
meta.RemAisVec
old []*meta.RemAis // to facilitate a2u resolution (and, therefore, offline access)
mu sync.RWMutex
in atomic.Bool
meta.RemAisVec
mu sync.RWMutex
in atomic.Bool
}
ec struct {
last atomic.Int64 // last active EC via apc.HdrActiveEC (mono time)
Expand Down Expand Up @@ -833,7 +833,7 @@ func (p *proxy) httpobjput(w http.ResponseWriter, r *http.Request, apireq *apiRe
} else {
if tsi = smap.GetTarget(nodeID); tsi == nil {
p.statsT.IncErr(errcnt)
err = &errNodeNotFound{verb + " failure:", nodeID, p.si, smap}
err = &errNodeNotFound{p.si, smap, verb + " failure:", nodeID}
p.writeErr(w, r, err)
return
}
Expand Down Expand Up @@ -1793,7 +1793,7 @@ func (p *proxy) _lsofc(bck *meta.Bck, lsmsg *apc.LsoMsg, smap *smapX) (tsi *meta
if lsmsg.SID != "" {
tsi = smap.GetTarget(lsmsg.SID)
if tsi == nil || tsi.InMaintOrDecomm() {
err = &errNodeNotFound{lsotag + " failure:", lsmsg.SID, p.si, smap}
err = &errNodeNotFound{p.si, smap, lsotag + " failure:", lsmsg.SID}
nlog.Errorln(err)
if smap.CountActiveTs() == 1 {
// (walk an extra mile)
Expand Down Expand Up @@ -1871,7 +1871,7 @@ func (p *proxy) httpobjpost(w http.ResponseWriter, r *http.Request, apireq *apiR
if args.DaemonID != "" {
smap := p.owner.smap.get()
if tsi = smap.GetTarget(args.DaemonID); tsi == nil {
err := &errNodeNotFound{apc.ActPromote + " failure:", args.DaemonID, p.si, smap}
err := &errNodeNotFound{p.si, smap, apc.ActPromote + " failure:", args.DaemonID}
p.writeErr(w, r, err)
return
}
Expand Down Expand Up @@ -2590,7 +2590,7 @@ func (p *proxy) reverseHandler(w http.ResponseWriter, r *http.Request) {
if !smap.IsPrimary(p.si) {
s = "non-primary, " // TODO above
}
err = &errNodeNotFound{s + "cannot forward request to node", nodeID, p.si, smap}
err = &errNodeNotFound{p.si, smap, s + "cannot forward request to node", nodeID}
p.writeErr(w, r, err, http.StatusNotFound)
return
}
Expand Down
3 changes: 2 additions & 1 deletion ais/prxauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type (
tokenList authn.TokenList // token strings
tkList map[string]*tok.Token // tk structs
authManager struct {
sync.Mutex
// cache of decrypted tokens
tkList tkList
// list of invalid tokens(revoked or of deleted users)
Expand All @@ -36,6 +35,8 @@ type (
version int64
// signing key secret
secret string
// lock
sync.Mutex
}
)

Expand Down
12 changes: 6 additions & 6 deletions ais/prxclu.go
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ func (p *proxy) xstart(w http.ResponseWriter, r *http.Request, msg *apc.ActMsg)
args.smap = p.owner.smap.get()
tsi := args.smap.GetTarget(xargs.DaemonID)
if tsi == nil {
err := &errNodeNotFound{"cannot resilver", xargs.DaemonID, p.si, args.smap}
err := &errNodeNotFound{p.si, args.smap, "cannot resilver", xargs.DaemonID}
p.writeErr(w, r, err)
return
}
Expand Down Expand Up @@ -1684,7 +1684,7 @@ func (p *proxy) cluputItems(w http.ResponseWriter, r *http.Request, items []stri
smap := p.owner.smap.get()
node := smap.GetNode(sid)
if node == nil {
err := &errNodeNotFound{"X.509 load failure:", sid, p.si, smap}
err := &errNodeNotFound{p.si, smap, "X.509 load failure:", sid}
p.writeErr(w, r, err, http.StatusNotFound)
return
}
Expand Down Expand Up @@ -1873,7 +1873,7 @@ func (p *proxy) _stopMaintPre(ctx *smapModifier, clone *smapX) error {
node := clone.GetNode(ctx.sid)
if node == nil {
ctx.status = http.StatusNotFound
return &errNodeNotFound{fmt.Sprintf(efmt, ctx.sid), ctx.sid, p.si, clone}
return &errNodeNotFound{p.si, clone, fmt.Sprintf(efmt, ctx.sid), ctx.sid}
}
clone.clearNodeFlags(ctx.sid, ctx.flags)
if node.IsProxy() {
Expand Down Expand Up @@ -1925,7 +1925,7 @@ func (p *proxy) httpcludel(w http.ResponseWriter, r *http.Request) {
node = smap.GetNode(sid)
)
if node == nil {
err = &errNodeNotFound{"cannot remove", sid, p.si, smap}
err = &errNodeNotFound{p.si, smap, "cannot remove", sid}
p.writeErr(w, r, err, http.StatusNotFound)
return
}
Expand Down Expand Up @@ -1986,7 +1986,7 @@ func (p *proxy) rmNodeFinal(msg *apc.ActMsg, si *meta.Snode, ctx *smapModifier)
)
if node == nil {
txt := "cannot \"" + msg.Action + "\""
return http.StatusNotFound, &errNodeNotFound{txt, si.ID(), p.si, smap}
return http.StatusNotFound, &errNodeNotFound{p.si, smap, txt, si.ID()}
}

var (
Expand Down Expand Up @@ -2067,7 +2067,7 @@ func (p *proxy) _unregNodePre(ctx *smapModifier, clone *smapX) error {
node := clone.GetNode(sid)
if node == nil {
ctx.status = http.StatusNotFound
return &errNodeNotFound{"failed to " + verb, sid, p.si, clone}
return &errNodeNotFound{p.si, clone, "failed to " + verb, sid}
}
if node.IsProxy() {
clone.delProxy(sid)
Expand Down
8 changes: 4 additions & 4 deletions ais/prxlso.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ type (

// Request buffer that corresponds to a single `uuid`.
lsobjBuffer struct {
// Buffers for each target that are finally merged and the entries are
// appended to the `currentBuff`.
leftovers map[string]*lsobjBufferTarget // targetID (string) -> target buffer
// Contains the last entry that was returned to the user.
nextToken string
// Currently maintained buffer that keeps the entries sorted
// and ready to be dispatched to the client.
currentBuff cmn.LsoEntries
// Buffers for each target that are finally merged and the entries are
// appended to the `currentBuff`.
leftovers map[string]*lsobjBufferTarget // targetID (string) -> target buffer
// Timestamp of the last access to this buffer. Idle buffers get removed
// after `lsobjBufferTTL`.
lastAccess atomic.Int64
Expand Down Expand Up @@ -113,8 +113,8 @@ type (

// Single cache that corresponds to single `cacheReqID`.
lsobjCache struct {
mtx sync.RWMutex
intervals []*cacheInterval
mtx sync.RWMutex
}

// Contains all lsobj caches.
Expand Down
2 changes: 1 addition & 1 deletion ais/prxnotif.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ repeat:
delete(remnl, uuid)
goto repeat
}
err := &errNodeNotFound{"abort " + nl.String() + " via 'smap-changed':", sid, n.p.si, smap}
err := &errNodeNotFound{n.p.si, smap, "abort " + nl.String() + " via 'smap-changed':", sid}
nl.Lock()
nl.AddErr(err)
nl.SetAborted()
Expand Down
2 changes: 1 addition & 1 deletion ais/psetforce.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ func (p *proxy) daeSetPrimary(w http.ResponseWriter, r *http.Request) {
smap := p.owner.smap.get()
psi := smap.GetProxy(proxyID)
if psi == nil {
err := &errNodeNotFound{"cannot set new primary", proxyID, p.si, smap}
err := &errNodeNotFound{p.si, smap, "cannot set new primary", proxyID}
p.writeErr(w, r, err)
return
}
Expand Down
15 changes: 8 additions & 7 deletions ais/rebmeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ type (
// rmdOwner is used to keep the information about the rebalances. Currently
// it keeps the Version of the latest rebalance.
rmdOwner struct {
rmd ratomic.Pointer[rebMD]
cluID string
fpath string
sync.Mutex
rmd ratomic.Pointer[rebMD]
interrupted atomic.Bool // when joining target reports interrupted rebalance
starting atomic.Bool // when starting up
}
Expand All @@ -60,14 +60,15 @@ type (
pre func(ctx *rmdModifier, clone *rebMD)
final func(ctx *rmdModifier, clone *rebMD)

prev *rebMD // pre-modification rmd
cur *rebMD // CoW clone
rebID string // cluster-wide rebalance ID, "g[uuid]" in the logs

cluID string // cluster ID (== smap.UUID) - never changes
prev *rebMD // pre-modification rmd
cur *rebMD // CoW clone
p *proxy
smapCtx *smapModifier
wait bool

rebID string // cluster-wide rebalance ID, "g[uuid]" in the logs
cluID string // cluster ID (== smap.UUID) - never changes

wait bool
}
)

Expand Down
2 changes: 1 addition & 1 deletion ais/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ type (

type redial struct {
t *target
inUse string
dialTout time.Duration
totalTout time.Duration
inUse string
}

// interface guard
Expand Down
2 changes: 1 addition & 1 deletion ais/tgtbck.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func (t *target) listObjects(w http.ResponseWriter, r *http.Request, bck *meta.B
if lsmsg.SID != "" {
smap := t.owner.smap.get()
if smap.GetTarget(lsmsg.SID) == nil {
err := &errNodeNotFound{"list-objects failure:", lsmsg.SID, t.si, smap}
err := &errNodeNotFound{t.si, smap, "list-objects failure:", lsmsg.SID}
t.writeErr(w, r, err)
return
}
Expand Down
2 changes: 1 addition & 1 deletion ais/tgtcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func (t *target) _setPrim(ctx *smapModifier, clone *smapX) (err error) {
}
psi := clone.GetProxy(ctx.sid)
if psi == nil {
return &errNodeNotFound{"cannot set new primary", ctx.sid, t.si, clone}
return &errNodeNotFound{t.si, clone, "cannot set new primary", ctx.sid}
}
clone.Primary = psi
return
Expand Down
Loading

0 comments on commit 39a5943

Please sign in to comment.