Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
37f6a1bb
Commit
37f6a1bb
authored
Sep 18, 2017
by
Kevin Atkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"repo stat": Make special value to represent NoLimit a constant.
License: MIT Signed-off-by:
Kevin Atkinson
<
k@kevina.org
>
parent
f156f63e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
core/commands/repo.go
core/commands/repo.go
+1
-2
core/corerepo/stat.go
core/corerepo/stat.go
+4
-1
No files found.
core/commands/repo.go
View file @
37f6a1bb
...
...
@@ -4,7 +4,6 @@ import (
"bytes"
"fmt"
"io"
"math"
"os"
"path/filepath"
"strings"
...
...
@@ -192,7 +191,7 @@ Version string The repo version.
}
else
{
fmt
.
Fprintf
(
wtr
,
"RepoSize:
\t
%d
\n
"
,
stat
.
RepoSize
)
}
if
stat
.
StorageMax
!=
math
.
MaxUint64
{
if
stat
.
StorageMax
!=
corerepo
.
NoLimit
{
maxSizeInMiB
:=
stat
.
StorageMax
/
(
1024
*
1024
)
if
human
&&
maxSizeInMiB
>
0
{
fmt
.
Fprintf
(
wtr
,
"StorageMax (MiB):
\t
%d
\n
"
,
maxSizeInMiB
)
...
...
core/corerepo/stat.go
View file @
37f6a1bb
...
...
@@ -19,6 +19,9 @@ type Stat struct {
StorageMax
uint64
// size in bytes
}
// NoLimit represents the value for unlimited storage
const
NoLimit
uint64
=
math
.
MaxUint64
func
RepoStat
(
n
*
core
.
IpfsNode
,
ctx
context
.
Context
)
(
*
Stat
,
error
)
{
r
:=
n
.
Repo
...
...
@@ -47,7 +50,7 @@ func RepoStat(n *core.IpfsNode, ctx context.Context) (*Stat, error) {
return
nil
,
err
}
var
storageMax
uint64
=
math
.
MaxUint64
storageMax
:=
NoLimit
if
cfg
.
Datastore
.
StorageMax
!=
""
{
storageMax
,
err
=
humanize
.
ParseBytes
(
cfg
.
Datastore
.
StorageMax
)
if
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment