diff --git a/cmd/swarm/config.go b/cmd/swarm/config.go index 98d4dee7b9..0e1e5e39ba 100644 --- a/cmd/swarm/config.go +++ b/cmd/swarm/config.go @@ -59,31 +59,31 @@ var ( //constants for environment variables const ( - SWARM_ENV_CHEQUEBOOK_ADDR = "SWARM_CHEQUEBOOK_ADDR" - SWARM_ENV_ACCOUNT = "SWARM_ACCOUNT" - SWARM_ENV_LISTEN_ADDR = "SWARM_LISTEN_ADDR" - SWARM_ENV_PORT = "SWARM_PORT" - SWARM_ENV_NETWORK_ID = "SWARM_NETWORK_ID" - SWARM_ENV_SWAP_ENABLE = "SWARM_SWAP_ENABLE" - SWARM_ENV_SWAP_API = "SWARM_SWAP_API" - SWARM_ENV_SYNC_DISABLE = "SWARM_SYNC_DISABLE" - SWARM_ENV_SYNC_UPDATE_DELAY = "SWARM_ENV_SYNC_UPDATE_DELAY" - SWARM_ENV_MAX_STREAM_PEER_SERVERS = "SWARM_ENV_MAX_STREAM_PEER_SERVERS" - SWARM_ENV_LIGHT_NODE_ENABLE = "SWARM_LIGHT_NODE_ENABLE" - SWARM_ENV_DELIVERY_SKIP_CHECK = "SWARM_DELIVERY_SKIP_CHECK" - SWARM_ENV_ENS_API = "SWARM_ENS_API" - SWARM_ENV_ENS_ADDR = "SWARM_ENS_ADDR" - SWARM_ENV_CORS = "SWARM_CORS" - SWARM_ENV_BOOTNODES = "SWARM_BOOTNODES" - SWARM_ENV_PSS_ENABLE = "SWARM_PSS_ENABLE" - SWARM_ENV_STORE_PATH = "SWARM_STORE_PATH" - SWARM_ENV_STORE_CAPACITY = "SWARM_STORE_CAPACITY" - SWARM_ENV_STORE_CACHE_CAPACITY = "SWARM_STORE_CACHE_CAPACITY" - SWARM_ENV_BOOTNODE_MODE = "SWARM_BOOTNODE_MODE" - SWARM_ACCESS_PASSWORD = "SWARM_ACCESS_PASSWORD" - SWARM_AUTO_DEFAULTPATH = "SWARM_AUTO_DEFAULTPATH" - SWARM_GLOBALSTORE_API = "SWARM_GLOBALSTORE_API" - GETH_ENV_DATADIR = "GETH_DATADIR" + SwarmEnvChequebookAddr = "SWARM_CHEQUEBOOK_ADDR" + SwarmEnvAccount = "SWARM_ACCOUNT" + SwarmEnvListenAddr = "SWARM_LISTEN_ADDR" + SwarmEnvPort = "SWARM_PORT" + SwarmEnvNetworkID = "SWARM_NETWORK_ID" + SwarmEnvSwapEnable = "SWARM_SWAP_ENABLE" + SwarmEnvSwapAPI = "SWARM_SWAP_API" + SwarmEnvSyncDisable = "SWARM_SYNC_DISABLE" + SwarmEnvSyncUpdateDelay = "SWARM_ENV_SYNC_UPDATE_DELAY" + SwarmEnvMaxStreamPeerServers = "SWARM_ENV_MAX_STREAM_PEER_SERVERS" + SwarmEnvLightNodeEnable = "SWARM_LIGHT_NODE_ENABLE" + SwarmEnvDeliverySkipCheck = "SWARM_DELIVERY_SKIP_CHECK" + SwarmEnvENSAPI = "SWARM_ENS_API" + SwarmEnvENSAddr = "SWARM_ENS_ADDR" + SwarmEnvCORS = "SWARM_CORS" + SwarmEnvBootnodes = "SWARM_BOOTNODES" + SwarmEnvPSSEnable = "SWARM_PSS_ENABLE" + SwarmEnvStorePath = "SWARM_STORE_PATH" + SwarmEnvStoreCapacity = "SWARM_STORE_CAPACITY" + SwarmEnvStoreCacheCapacity = "SWARM_STORE_CACHE_CAPACITY" + SwarmEnvBootnodeMode = "SWARM_BOOTNODE_MODE" + SwarmAccessPassword = "SWARM_ACCESS_PASSWORD" + SwarmAutoDefaultPath = "SWARM_AUTO_DEFAULTPATH" + SwarmGlobalstoreAPI = "SWARM_GLOBALSTORE_API" + GethEnvDataDir = "GETH_DATADIR" ) // These settings ensure that TOML keys use the same names as Go struct fields. @@ -227,7 +227,7 @@ func cmdLineOverride(currentConfig *bzzapi.Config, ctx *cli.Context) *bzzapi.Con currentConfig.SwapAPI = ctx.GlobalString(SwarmSwapAPIFlag.Name) if currentConfig.SwapEnabled && currentConfig.SwapAPI == "" { - utils.Fatalf(SWARM_ERR_SWAP_SET_NO_API) + utils.Fatalf(SwarmErrSwapSetNoAPI) } if ctx.GlobalIsSet(EnsAPIFlag.Name) { @@ -274,113 +274,113 @@ func cmdLineOverride(currentConfig *bzzapi.Config, ctx *cli.Context) *bzzapi.Con // envVarsOverride overrides the current config with whatver is provided in environment variables // most values are not allowed a zero value (empty string), if not otherwise noted func envVarsOverride(currentConfig *bzzapi.Config) (config *bzzapi.Config) { - if keyid := os.Getenv(SWARM_ENV_ACCOUNT); keyid != "" { + if keyid := os.Getenv(SwarmEnvAccount); keyid != "" { currentConfig.BzzAccount = keyid } - if chbookaddr := os.Getenv(SWARM_ENV_CHEQUEBOOK_ADDR); chbookaddr != "" { + if chbookaddr := os.Getenv(SwarmEnvChequebookAddr); chbookaddr != "" { currentConfig.Contract = common.HexToAddress(chbookaddr) } - if networkid := os.Getenv(SWARM_ENV_NETWORK_ID); networkid != "" { + if networkid := os.Getenv(SwarmEnvNetworkID); networkid != "" { id, err := strconv.ParseUint(networkid, 10, 64) if err != nil { - utils.Fatalf("invalid environment variable %s: %v", SWARM_ENV_NETWORK_ID, err) + utils.Fatalf("invalid environment variable %s: %v", SwarmEnvNetworkID, err) } if id != 0 { currentConfig.NetworkID = id } } - if datadir := os.Getenv(GETH_ENV_DATADIR); datadir != "" { + if datadir := os.Getenv(GethEnvDataDir); datadir != "" { currentConfig.Path = expandPath(datadir) } - bzzport := os.Getenv(SWARM_ENV_PORT) + bzzport := os.Getenv(SwarmEnvPort) if len(bzzport) > 0 { currentConfig.Port = bzzport } - if bzzaddr := os.Getenv(SWARM_ENV_LISTEN_ADDR); bzzaddr != "" { + if bzzaddr := os.Getenv(SwarmEnvListenAddr); bzzaddr != "" { currentConfig.ListenAddr = bzzaddr } - if swapenable := os.Getenv(SWARM_ENV_SWAP_ENABLE); swapenable != "" { + if swapenable := os.Getenv(SwarmEnvSwapEnable); swapenable != "" { swap, err := strconv.ParseBool(swapenable) if err != nil { - utils.Fatalf("invalid environment variable %s: %v", SWARM_ENV_SWAP_ENABLE, err) + utils.Fatalf("invalid environment variable %s: %v", SwarmEnvSwapEnable, err) } currentConfig.SwapEnabled = swap } - if syncdisable := os.Getenv(SWARM_ENV_SYNC_DISABLE); syncdisable != "" { + if syncdisable := os.Getenv(SwarmEnvSyncDisable); syncdisable != "" { sync, err := strconv.ParseBool(syncdisable) if err != nil { - utils.Fatalf("invalid environment variable %s: %v", SWARM_ENV_SYNC_DISABLE, err) + utils.Fatalf("invalid environment variable %s: %v", SwarmEnvSyncDisable, err) } currentConfig.SyncEnabled = !sync } - if v := os.Getenv(SWARM_ENV_DELIVERY_SKIP_CHECK); v != "" { + if v := os.Getenv(SwarmEnvDeliverySkipCheck); v != "" { skipCheck, err := strconv.ParseBool(v) if err != nil { currentConfig.DeliverySkipCheck = skipCheck } } - if v := os.Getenv(SWARM_ENV_SYNC_UPDATE_DELAY); v != "" { + if v := os.Getenv(SwarmEnvSyncUpdateDelay); v != "" { d, err := time.ParseDuration(v) if err != nil { - utils.Fatalf("invalid environment variable %s: %v", SWARM_ENV_SYNC_UPDATE_DELAY, err) + utils.Fatalf("invalid environment variable %s: %v", SwarmEnvSyncUpdateDelay, err) } currentConfig.SyncUpdateDelay = d } - if max := os.Getenv(SWARM_ENV_MAX_STREAM_PEER_SERVERS); max != "" { + if max := os.Getenv(SwarmEnvMaxStreamPeerServers); max != "" { m, err := strconv.Atoi(max) if err != nil { - utils.Fatalf("invalid environment variable %s: %v", SWARM_ENV_MAX_STREAM_PEER_SERVERS, err) + utils.Fatalf("invalid environment variable %s: %v", SwarmEnvMaxStreamPeerServers, err) } currentConfig.MaxStreamPeerServers = m } - if lne := os.Getenv(SWARM_ENV_LIGHT_NODE_ENABLE); lne != "" { + if lne := os.Getenv(SwarmEnvLightNodeEnable); lne != "" { lightnode, err := strconv.ParseBool(lne) if err != nil { - utils.Fatalf("invalid environment variable %s: %v", SWARM_ENV_LIGHT_NODE_ENABLE, err) + utils.Fatalf("invalid environment variable %s: %v", SwarmEnvLightNodeEnable, err) } currentConfig.LightNodeEnabled = lightnode } - if swapapi := os.Getenv(SWARM_ENV_SWAP_API); swapapi != "" { + if swapapi := os.Getenv(SwarmEnvSwapAPI); swapapi != "" { currentConfig.SwapAPI = swapapi } if currentConfig.SwapEnabled && currentConfig.SwapAPI == "" { - utils.Fatalf(SWARM_ERR_SWAP_SET_NO_API) + utils.Fatalf(SwarmErrSwapSetNoAPI) } - if ensapi := os.Getenv(SWARM_ENV_ENS_API); ensapi != "" { + if ensapi := os.Getenv(SwarmEnvENSAPI); ensapi != "" { currentConfig.EnsAPIs = strings.Split(ensapi, ",") } - if ensaddr := os.Getenv(SWARM_ENV_ENS_ADDR); ensaddr != "" { + if ensaddr := os.Getenv(SwarmEnvENSAddr); ensaddr != "" { currentConfig.EnsRoot = common.HexToAddress(ensaddr) } - if cors := os.Getenv(SWARM_ENV_CORS); cors != "" { + if cors := os.Getenv(SwarmEnvCORS); cors != "" { currentConfig.Cors = cors } - if bm := os.Getenv(SWARM_ENV_BOOTNODE_MODE); bm != "" { + if bm := os.Getenv(SwarmEnvBootnodeMode); bm != "" { bootnodeMode, err := strconv.ParseBool(bm) if err != nil { - utils.Fatalf("invalid environment variable %s: %v", SWARM_ENV_BOOTNODE_MODE, err) + utils.Fatalf("invalid environment variable %s: %v", SwarmEnvBootnodeMode, err) } currentConfig.BootnodeMode = bootnodeMode } - if api := os.Getenv(SWARM_GLOBALSTORE_API); api != "" { + if api := os.Getenv(SwarmGlobalstoreAPI); api != "" { currentConfig.GlobalStoreAPI = api } diff --git a/cmd/swarm/config_test.go b/cmd/swarm/config_test.go index 18be316e5f..869edd0f70 100644 --- a/cmd/swarm/config_test.go +++ b/cmd/swarm/config_test.go @@ -52,7 +52,7 @@ func TestConfigFailsSwapEnabledNoSwapApi(t *testing.T) { } swarm := runSwarm(t, flags...) - swarm.Expect("Fatal: " + SWARM_ERR_SWAP_SET_NO_API + "\n") + swarm.Expect("Fatal: " + SwarmErrSwapSetNoAPI + "\n") swarm.ExpectExit() } @@ -63,7 +63,7 @@ func TestConfigFailsNoBzzAccount(t *testing.T) { } swarm := runSwarm(t, flags...) - swarm.Expect("Fatal: " + SWARM_ERR_NO_BZZACCOUNT + "\n") + swarm.Expect("Fatal: " + SwarmErrNoBZZAccount + "\n") swarm.ExpectExit() } diff --git a/cmd/swarm/flags.go b/cmd/swarm/flags.go index b092a77476..39a273d870 100644 --- a/cmd/swarm/flags.go +++ b/cmd/swarm/flags.go @@ -23,68 +23,68 @@ var ( ChequebookAddrFlag = cli.StringFlag{ Name: "chequebook", Usage: "chequebook contract address", - EnvVar: SWARM_ENV_CHEQUEBOOK_ADDR, + EnvVar: SwarmEnvChequebookAddr, } SwarmAccountFlag = cli.StringFlag{ Name: "bzzaccount", Usage: "Swarm account key file", - EnvVar: SWARM_ENV_ACCOUNT, + EnvVar: SwarmEnvAccount, } SwarmListenAddrFlag = cli.StringFlag{ Name: "httpaddr", Usage: "Swarm HTTP API listening interface", - EnvVar: SWARM_ENV_LISTEN_ADDR, + EnvVar: SwarmEnvListenAddr, } SwarmPortFlag = cli.StringFlag{ Name: "bzzport", Usage: "Swarm local http api port", - EnvVar: SWARM_ENV_PORT, + EnvVar: SwarmEnvPort, } SwarmNetworkIdFlag = cli.IntFlag{ Name: "bzznetworkid", Usage: "Network identifier (integer, default 3=swarm testnet)", - EnvVar: SWARM_ENV_NETWORK_ID, + EnvVar: SwarmEnvNetworkID, } SwarmSwapEnabledFlag = cli.BoolFlag{ Name: "swap", Usage: "Swarm SWAP enabled (default false)", - EnvVar: SWARM_ENV_SWAP_ENABLE, + EnvVar: SwarmEnvSwapEnable, } SwarmSwapAPIFlag = cli.StringFlag{ Name: "swap-api", Usage: "URL of the Ethereum API provider to use to settle SWAP payments", - EnvVar: SWARM_ENV_SWAP_API, + EnvVar: SwarmEnvSwapAPI, } SwarmSyncDisabledFlag = cli.BoolTFlag{ Name: "nosync", Usage: "Disable swarm syncing", - EnvVar: SWARM_ENV_SYNC_DISABLE, + EnvVar: SwarmEnvSyncDisable, } SwarmSyncUpdateDelay = cli.DurationFlag{ Name: "sync-update-delay", Usage: "Duration for sync subscriptions update after no new peers are added (default 15s)", - EnvVar: SWARM_ENV_SYNC_UPDATE_DELAY, + EnvVar: SwarmEnvSyncUpdateDelay, } SwarmMaxStreamPeerServersFlag = cli.IntFlag{ Name: "max-stream-peer-servers", Usage: "Limit of Stream peer servers, 0 denotes unlimited", - EnvVar: SWARM_ENV_MAX_STREAM_PEER_SERVERS, + EnvVar: SwarmEnvMaxStreamPeerServers, Value: 10000, // A very large default value is possible as stream servers have very small memory footprint } SwarmLightNodeEnabled = cli.BoolFlag{ Name: "lightnode", Usage: "Enable Swarm LightNode (default false)", - EnvVar: SWARM_ENV_LIGHT_NODE_ENABLE, + EnvVar: SwarmEnvLightNodeEnable, } SwarmDeliverySkipCheckFlag = cli.BoolFlag{ Name: "delivery-skip-check", Usage: "Skip chunk delivery check (default false)", - EnvVar: SWARM_ENV_DELIVERY_SKIP_CHECK, + EnvVar: SwarmEnvDeliverySkipCheck, } EnsAPIFlag = cli.StringSliceFlag{ Name: "ens-api", Usage: "ENS API endpoint for a TLD and with contract address, can be repeated, format [tld:][contract-addr@]url", - EnvVar: SWARM_ENV_ENS_API, + EnvVar: SwarmEnvENSAPI, } SwarmApiFlag = cli.StringFlag{ Name: "bzzapi", @@ -126,7 +126,7 @@ var ( SwarmAccessPasswordFlag = cli.StringFlag{ Name: "password", Usage: "Password", - EnvVar: SWARM_ACCESS_PASSWORD, + EnvVar: SwarmAccessPassword, } SwarmDryRunFlag = cli.BoolFlag{ Name: "dry-run", @@ -135,22 +135,22 @@ var ( CorsStringFlag = cli.StringFlag{ Name: "corsdomain", Usage: "Domain on which to send Access-Control-Allow-Origin header (multiple domains can be supplied separated by a ',')", - EnvVar: SWARM_ENV_CORS, + EnvVar: SwarmEnvCORS, } SwarmStorePath = cli.StringFlag{ Name: "store.path", Usage: "Path to leveldb chunk DB (default <$GETH_ENV_DIR>/swarm/bzz-<$BZZ_KEY>/chunks)", - EnvVar: SWARM_ENV_STORE_PATH, + EnvVar: SwarmEnvStorePath, } SwarmStoreCapacity = cli.Uint64Flag{ Name: "store.size", Usage: "Number of chunks (5M is roughly 20-25GB) (default 5000000)", - EnvVar: SWARM_ENV_STORE_CAPACITY, + EnvVar: SwarmEnvStoreCapacity, } SwarmStoreCacheCapacity = cli.UintFlag{ Name: "store.cache.size", Usage: "Number of recent chunks cached in memory (default 5000)", - EnvVar: SWARM_ENV_STORE_CACHE_CAPACITY, + EnvVar: SwarmEnvStoreCacheCapacity, } SwarmCompressedFlag = cli.BoolFlag{ Name: "compressed", @@ -179,6 +179,6 @@ var ( SwarmGlobalStoreAPIFlag = cli.StringFlag{ Name: "globalstore-api", Usage: "URL of the Global Store API provider (only for testing)", - EnvVar: SWARM_GLOBALSTORE_API, + EnvVar: SwarmGlobalstoreAPI, } ) diff --git a/cmd/swarm/main.go b/cmd/swarm/main.go index af00503ea3..4d63255d7a 100644 --- a/cmd/swarm/main.go +++ b/cmd/swarm/main.go @@ -76,8 +76,8 @@ var gitCommit string //declare a few constant error messages, useful for later error check comparisons in test var ( - SWARM_ERR_NO_BZZACCOUNT = "bzzaccount option is required but not set; check your config file, command line or environment variables" - SWARM_ERR_SWAP_SET_NO_API = "SWAP is enabled but --swap-api is not set" + SwarmErrNoBZZAccount = "bzzaccount option is required but not set; check your config file, command line or environment variables" + SwarmErrSwapSetNoAPI = "SWAP is enabled but --swap-api is not set" ) // this help command gets added to any subcommand that does not define it explicitly @@ -351,7 +351,7 @@ func registerBzzService(bzzconfig *bzzapi.Config, stack *node.Node) { func getAccount(bzzaccount string, ctx *cli.Context, stack *node.Node) *ecdsa.PrivateKey { //an account is mandatory if bzzaccount == "" { - utils.Fatalf(SWARM_ERR_NO_BZZACCOUNT) + utils.Fatalf(SwarmErrNoBZZAccount) } // Try to load the arg as a hex key file. if key, err := crypto.LoadECDSA(bzzaccount); err == nil { diff --git a/cmd/swarm/upload.go b/cmd/swarm/upload.go index 992f2d6e97..ab07908351 100644 --- a/cmd/swarm/upload.go +++ b/cmd/swarm/upload.go @@ -60,10 +60,10 @@ func upload(ctx *cli.Context) { autoDefaultPath = false file string ) - if autoDefaultPathString := os.Getenv(SWARM_AUTO_DEFAULTPATH); autoDefaultPathString != "" { + if autoDefaultPathString := os.Getenv(SwarmAutoDefaultPath); autoDefaultPathString != "" { b, err := strconv.ParseBool(autoDefaultPathString) if err != nil { - utils.Fatalf("invalid environment variable %s: %v", SWARM_AUTO_DEFAULTPATH, err) + utils.Fatalf("invalid environment variable %s: %v", SwarmAutoDefaultPath, err) } autoDefaultPath = b } diff --git a/swarm/api/act.go b/swarm/api/act.go index 9566720b03..a79f1944b9 100644 --- a/swarm/api/act.go +++ b/swarm/api/act.go @@ -33,7 +33,7 @@ var ( } ) -const EMPTY_CREDENTIALS = "" +const EmptyCredentials = "" type AccessEntry struct { Type AccessType diff --git a/swarm/api/api.go b/swarm/api/api.go index c6ca1b5774..86c1119232 100644 --- a/swarm/api/api.go +++ b/swarm/api/api.go @@ -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 diff --git a/swarm/fuse/swarmfs.go b/swarm/fuse/swarmfs.go index c7aa983b7d..db6aefb54c 100644 --- a/swarm/fuse/swarmfs.go +++ b/swarm/fuse/swarmfs.go @@ -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 ( diff --git a/swarm/fuse/swarmfs_unix.go b/swarm/fuse/swarmfs_unix.go index 9ff55cc324..54b879a4da 100644 --- a/swarm/fuse/swarmfs_unix.go +++ b/swarm/fuse/swarmfs_unix.go @@ -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 } diff --git a/swarm/network/stream/peer.go b/swarm/network/stream/peer.go index c59799e08a..1d3868a66b 100644 --- a/swarm/network/stream/peer.go +++ b/swarm/network/stream/peer.go @@ -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 } diff --git a/swarm/storage/ldbstore_test.go b/swarm/storage/ldbstore_test.go index 9e7aba545d..65b72acec8 100644 --- a/swarm/storage/ldbstore_test.go +++ b/swarm/storage/ldbstore_test.go @@ -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]) } } diff --git a/swarm/swarm.go b/swarm/swarm.go index 651ad97c78..b4b08c5c54 100644 --- a/swarm/swarm.go +++ b/swarm/swarm.go @@ -508,7 +508,7 @@ func (s *Swarm) APIs() []rpc.API { }, { Namespace: "swarmfs", - Version: fuse.Swarmfs_Version, + Version: fuse.SwarmFSVersion, Service: s.sfs, Public: false, },