cmd,swarm: enforce camel case variable names (#19060)
This commit is contained in:
committed by
Viktor Trón
parent
64d10c0872
commit
90b6cdaadf
@ -33,7 +33,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
const EMPTY_CREDENTIALS = ""
|
||||
const EmptyCredentials = ""
|
||||
|
||||
type AccessEntry struct {
|
||||
Type AccessType
|
||||
|
@ -431,7 +431,7 @@ func (a *API) Delete(ctx context.Context, addr string, path string) (storage.Add
|
||||
apiDeleteFail.Inc(1)
|
||||
return nil, err
|
||||
}
|
||||
key, err := a.ResolveURI(ctx, uri, EMPTY_CREDENTIALS)
|
||||
key, err := a.ResolveURI(ctx, uri, EmptyCredentials)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -643,7 +643,7 @@ func (a *API) AddFile(ctx context.Context, mhash, path, fname string, content []
|
||||
apiAddFileFail.Inc(1)
|
||||
return nil, "", err
|
||||
}
|
||||
mkey, err := a.ResolveURI(ctx, uri, EMPTY_CREDENTIALS)
|
||||
mkey, err := a.ResolveURI(ctx, uri, EmptyCredentials)
|
||||
if err != nil {
|
||||
apiAddFileFail.Inc(1)
|
||||
return nil, "", err
|
||||
@ -760,7 +760,7 @@ func (a *API) RemoveFile(ctx context.Context, mhash string, path string, fname s
|
||||
apiRmFileFail.Inc(1)
|
||||
return "", err
|
||||
}
|
||||
mkey, err := a.ResolveURI(ctx, uri, EMPTY_CREDENTIALS)
|
||||
mkey, err := a.ResolveURI(ctx, uri, EmptyCredentials)
|
||||
if err != nil {
|
||||
apiRmFileFail.Inc(1)
|
||||
return "", err
|
||||
@ -827,7 +827,7 @@ func (a *API) AppendFile(ctx context.Context, mhash, path, fname string, existin
|
||||
apiAppendFileFail.Inc(1)
|
||||
return nil, "", err
|
||||
}
|
||||
mkey, err := a.ResolveURI(ctx, uri, EMPTY_CREDENTIALS)
|
||||
mkey, err := a.ResolveURI(ctx, uri, EmptyCredentials)
|
||||
if err != nil {
|
||||
apiAppendFileFail.Inc(1)
|
||||
return nil, "", err
|
||||
|
@ -24,10 +24,10 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
Swarmfs_Version = "0.1"
|
||||
mountTimeout = time.Second * 5
|
||||
unmountTimeout = time.Second * 10
|
||||
maxFuseMounts = 5
|
||||
SwarmFSVersion = "0.1"
|
||||
mountTimeout = time.Second * 5
|
||||
unmountTimeout = time.Second * 10
|
||||
maxFUSEMounts = 5
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -96,7 +96,7 @@ func (swarmfs *SwarmFS) Mount(mhash, mountpoint string) (*MountInfo, error) {
|
||||
|
||||
noOfActiveMounts := len(swarmfs.activeMounts)
|
||||
log.Debug("swarmfs mount", "# active mounts", noOfActiveMounts)
|
||||
if noOfActiveMounts >= maxFuseMounts {
|
||||
if noOfActiveMounts >= maxFUSEMounts {
|
||||
return nil, errMaxMountCount
|
||||
}
|
||||
|
||||
|
@ -101,20 +101,20 @@ func NewPeer(peer *protocols.Peer, streamer *Registry) *Peer {
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
var len_maxi int
|
||||
var cap_maxi int
|
||||
var lenMaxi int
|
||||
var capMaxi int
|
||||
for k := range pq.Queues {
|
||||
if len_maxi < len(pq.Queues[k]) {
|
||||
len_maxi = len(pq.Queues[k])
|
||||
if lenMaxi < len(pq.Queues[k]) {
|
||||
lenMaxi = len(pq.Queues[k])
|
||||
}
|
||||
|
||||
if cap_maxi < cap(pq.Queues[k]) {
|
||||
cap_maxi = cap(pq.Queues[k])
|
||||
if capMaxi < cap(pq.Queues[k]) {
|
||||
capMaxi = cap(pq.Queues[k])
|
||||
}
|
||||
}
|
||||
|
||||
metrics.GetOrRegisterGauge(fmt.Sprintf("pq_len_%s", p.ID().TerminalString()), nil).Update(int64(len_maxi))
|
||||
metrics.GetOrRegisterGauge(fmt.Sprintf("pq_cap_%s", p.ID().TerminalString()), nil).Update(int64(cap_maxi))
|
||||
metrics.GetOrRegisterGauge(fmt.Sprintf("pq_len_%s", p.ID().TerminalString()), nil).Update(int64(lenMaxi))
|
||||
metrics.GetOrRegisterGauge(fmt.Sprintf("pq_cap_%s", p.ID().TerminalString()), nil).Update(int64(capMaxi))
|
||||
case <-p.quit:
|
||||
return
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ func testIterator(t *testing.T, mock bool) {
|
||||
var i int
|
||||
var poc uint
|
||||
chunkkeys := NewAddressCollection(chunkcount)
|
||||
chunkkeys_results := NewAddressCollection(chunkcount)
|
||||
chunkkeysResults := NewAddressCollection(chunkcount)
|
||||
|
||||
db, cleanup, err := newTestDbStore(mock, false)
|
||||
defer cleanup()
|
||||
@ -218,7 +218,7 @@ func testIterator(t *testing.T, mock bool) {
|
||||
for poc = 0; poc <= 255; poc++ {
|
||||
err := db.SyncIterator(0, uint64(chunkkeys.Len()), uint8(poc), func(k Address, n uint64) bool {
|
||||
log.Trace(fmt.Sprintf("Got key %v number %d poc %d", k, n, uint8(poc)))
|
||||
chunkkeys_results[n] = k
|
||||
chunkkeysResults[n] = k
|
||||
i++
|
||||
return true
|
||||
})
|
||||
@ -228,8 +228,8 @@ func testIterator(t *testing.T, mock bool) {
|
||||
}
|
||||
|
||||
for i = 0; i < chunkcount; i++ {
|
||||
if !bytes.Equal(chunkkeys[i], chunkkeys_results[i]) {
|
||||
t.Fatalf("Chunk put #%d key '%v' does not match iterator's key '%v'", i, chunkkeys[i], chunkkeys_results[i])
|
||||
if !bytes.Equal(chunkkeys[i], chunkkeysResults[i]) {
|
||||
t.Fatalf("Chunk put #%d key '%v' does not match iterator's key '%v'", i, chunkkeys[i], chunkkeysResults[i])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -508,7 +508,7 @@ func (s *Swarm) APIs() []rpc.API {
|
||||
},
|
||||
{
|
||||
Namespace: "swarmfs",
|
||||
Version: fuse.Swarmfs_Version,
|
||||
Version: fuse.SwarmFSVersion,
|
||||
Service: s.sfs,
|
||||
Public: false,
|
||||
},
|
||||
|
Reference in New Issue
Block a user