Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
326b50f6
Unverified
Commit
326b50f6
authored
Jun 05, 2020
by
Zahoor Mohamed
Committed by
GitHub
Jun 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add db capacity flag (#250)
* Add db capacity flag
parent
116d95e1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
5 deletions
+21
-5
start.go
cmd/bee/cmd/start.go
+5
-3
localstore.go
pkg/localstore/localstore.go
+1
-0
localstore_test.go
pkg/localstore/localstore_test.go
+10
-0
node.go
pkg/node/node.go
+5
-2
No files found.
cmd/bee/cmd/start.go
View file @
326b50f6
...
...
@@ -16,17 +16,17 @@ import (
"syscall"
"time"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/ethersphere/bee/pkg/logging"
"github.com/ethersphere/bee/pkg/node"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
func
(
c
*
command
)
initStartCmd
()
(
err
error
)
{
const
(
optionNameDataDir
=
"data-dir"
optionNameDBCapacity
=
"db-capacity"
optionNamePassword
=
"password"
optionNamePasswordFile
=
"password-file"
optionNameAPIAddr
=
"api-addr"
...
...
@@ -93,6 +93,7 @@ func (c *command) initStartCmd() (err error) {
b
,
err
:=
node
.
NewBee
(
node
.
Options
{
DataDir
:
c
.
config
.
GetString
(
optionNameDataDir
),
DBCapacity
:
c
.
config
.
GetUint64
(
optionNameDBCapacity
),
Password
:
password
,
APIAddr
:
c
.
config
.
GetString
(
optionNameAPIAddr
),
DebugAPIAddr
:
debugAPIAddr
,
...
...
@@ -150,6 +151,7 @@ func (c *command) initStartCmd() (err error) {
}
cmd
.
Flags
()
.
String
(
optionNameDataDir
,
filepath
.
Join
(
c
.
homeDir
,
".bee"
),
"data directory"
)
cmd
.
Flags
()
.
Uint64
(
optionNameDBCapacity
,
5000000
,
"db capacity in chunks"
)
cmd
.
Flags
()
.
String
(
optionNamePassword
,
""
,
"password for decrypting keys"
)
cmd
.
Flags
()
.
String
(
optionNamePasswordFile
,
""
,
"path to a file that contains password for decrypting keys"
)
cmd
.
Flags
()
.
String
(
optionNameAPIAddr
,
":8080"
,
"HTTP API listen address"
)
...
...
pkg/localstore/localstore.go
View file @
326b50f6
...
...
@@ -177,6 +177,7 @@ func New(path string, baseKey []byte, o *Options, logger logging.Logger) (db *DB
if
db
.
capacity
==
0
{
db
.
capacity
=
defaultCapacity
}
db
.
logger
.
Info
(
"setting db capacity to: %v"
,
db
.
capacity
)
if
maxParallelUpdateGC
>
0
{
db
.
updateGCSem
=
make
(
chan
struct
{},
maxParallelUpdateGC
)
}
...
...
pkg/localstore/localstore_test.go
View file @
326b50f6
...
...
@@ -57,6 +57,16 @@ func init() {
}
}
func
TestDBCapacity
(
t
*
testing
.
T
)
{
lo
:=
Options
{
Capacity
:
500
,
}
db
:=
newTestDB
(
t
,
&
lo
)
if
db
.
capacity
!=
500
{
t
.
Fatal
(
"could not set db capacity"
)
}
}
// TestDB validates if the chunk can be uploaded and
// correctly retrieved.
func
TestDB
(
t
*
testing
.
T
)
{
...
...
pkg/node/node.go
View file @
326b50f6
...
...
@@ -60,6 +60,7 @@ type Bee struct {
type
Options
struct
{
DataDir
string
DBCapacity
uint64
Password
string
APIAddr
string
DebugAPIAddr
string
...
...
@@ -192,8 +193,10 @@ func NewBee(o Options) (*Bee, error) {
if
o
.
DataDir
!=
""
{
path
=
filepath
.
Join
(
o
.
DataDir
,
"localstore"
)
}
storer
,
err
=
localstore
.
New
(
path
,
address
.
Bytes
(),
nil
,
logger
)
lo
:=
&
localstore
.
Options
{
Capacity
:
o
.
DBCapacity
,
}
storer
,
err
=
localstore
.
New
(
path
,
address
.
Bytes
(),
lo
,
logger
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"localstore: %w"
,
err
)
}
...
...
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