Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Display data received count on storjshare status
Browse files Browse the repository at this point in the history
  • Loading branch information
aleitner committed Jul 17, 2017
1 parent 0d2b690 commit b5aff9f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
15 changes: 11 additions & 4 deletions bin/storjshare-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function prepareJson(shares) {
json[i].uptime = prettyMs(share.meta.uptimeMs);
json[i].restarts = share.meta.numRestarts || 0;
json[i].peers = share.meta.farmerState.totalPeers || 0;
json[i].contracts = fixContractValue(
json[i].offers = fixContractValue(
share.meta.farmerState.contractCount
);
json[i].dataReceivedCount = fixContractValue(
Expand All @@ -103,12 +103,12 @@ utils.connectToDaemon(port, function(rpc, sock) {
} else {
let table = new Table({
head: ['Share', 'Status', 'Uptime', 'Restarts', 'Peers',
'Contracts', 'Delta', 'Port', 'Shared'],
'Offers', 'Delta', 'Port', 'Shared'],
style: {
head: ['cyan', 'bold'],
border: []
},
colWidths: [45, 10, 10, 10, 10, 11, 9, 11, 10]
colWidths: [45, 9, 10, 10, 9, 15, 9, 10, 9]
});
shares.forEach((share) => {
let status = '?';
Expand Down Expand Up @@ -138,13 +138,20 @@ utils.connectToDaemon(port, function(rpc, sock) {

let contracts = fixContractValue(share.meta.farmerState.contractCount);

let percentDataReceived = (
share.meta.farmerState.dataReceivedCount !== 0 ?
Math.round(
fixContractValue(share.meta.farmerState.dataReceivedCount) /
fixContractValue(share.meta.farmerState.contractCount) * 100
) : 0);

table.push([
`${share.id}\n → ${share.config.storagePath}`,
status,
prettyMs(share.meta.uptimeMs),
share.meta.numRestarts || 0,
share.meta.farmerState.totalPeers || 0,
contracts,
contracts + '\n' + `${percentDataReceived}% received`,
ntpStatus,
port + '\n' + connectionType,
share.meta.farmerState.spaceUsed + '\n' +
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "storjshare-daemon",
"version": "3.4.2",
"version": "3.5.0",
"description": "daemon + process manager for sharing space on the storj network",
"main": "index.js",
"bin": {
Expand Down Expand Up @@ -76,7 +76,7 @@
"pretty-ms": "^2.1.0",
"rc": "^1.1.6",
"readable-stream": "^2.2.2",
"storj-lib": "^6.6.0",
"storj-lib": "^6.7.0",
"storj-telemetry-reporter": "^5.0.0",
"strip-json-comments": "^2.0.1",
"tail": "^1.2.1"
Expand Down

0 comments on commit b5aff9f

Please sign in to comment.