Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
7ba07788
Commit
7ba07788
authored
4 years ago
by
Jono Wenger
Browse files
Options
Downloads
Patches
Plain Diff
XX-2066 / Force usage of historical rounds
parent
1ffe1e06
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+2
-0
2 additions, 0 deletions
README.md
cmd/root.go
+13
-2
13 additions, 2 deletions
cmd/root.go
interfaces/params/rounds.go
+11
-7
11 additions, 7 deletions
interfaces/params/rounds.go
network/rounds/check.go
+6
-2
6 additions, 2 deletions
network/rounds/check.go
with
32 additions
and
11 deletions
README.md
+
2
−
0
View file @
7ba07788
...
...
@@ -158,6 +158,8 @@ Flags:
-d, --destid string ID to send message to (if below 40, will be
precanned. Use '0x' or 'b64:' for hex and
base64 representations) (default "0")
--forceHistoricalRounds Force all rounds to be sent to historical
round retrieval
-h, --help help for client
-l, --log string Path to the log output path (- is stdout)
(default "-")
...
...
This diff is collapsed.
Click to expand it.
cmd/root.go
+
13
−
2
View file @
7ba07788
...
...
@@ -212,7 +212,10 @@ func createClient() *api.Client {
}
}
client
,
err
:=
api
.
OpenClient
(
storeDir
,
[]
byte
(
pass
),
params
.
GetDefaultNetwork
())
netParams
:=
params
.
GetDefaultNetwork
()
netParams
.
ForceHistoricalRounds
=
viper
.
GetBool
(
"forceHistoricalRounds"
)
client
,
err
:=
api
.
OpenClient
(
storeDir
,
[]
byte
(
pass
),
netParams
)
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
...
...
@@ -225,8 +228,11 @@ func initClient() *api.Client {
pass
:=
viper
.
GetString
(
"password"
)
storeDir
:=
viper
.
GetString
(
"session"
)
netParams
:=
params
.
GetDefaultNetwork
()
netParams
.
ForceHistoricalRounds
=
viper
.
GetBool
(
"forceHistoricalRounds"
)
//load the client
client
,
err
:=
api
.
Login
(
storeDir
,
[]
byte
(
pass
),
p
arams
.
GetDefaultNetwork
()
)
client
,
err
:=
api
.
Login
(
storeDir
,
[]
byte
(
pass
),
netP
arams
)
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
...
...
@@ -613,6 +619,11 @@ func init() {
"Accept the channel request for the corresponding recipient ID"
)
viper
.
BindPFlag
(
"accept-channel"
,
rootCmd
.
Flags
()
.
Lookup
(
"accept-channel"
))
rootCmd
.
Flags
()
.
BoolP
(
"forceHistoricalRounds"
,
""
,
false
,
"Force all rounds to be sent to historical round retrieval"
)
viper
.
BindPFlag
(
"forceHistoricalRounds"
,
rootCmd
.
Flags
()
.
Lookup
(
"forceHistoricalRounds"
))
}
// initConfig reads in config file and ENV variables if set.
...
...
This diff is collapsed.
Click to expand it.
interfaces/params/rounds.go
+
11
−
7
View file @
7ba07788
...
...
@@ -12,22 +12,25 @@ import (
)
type
Rounds
struct
{
//
m
aximum number of times to attempt to retrieve a round from a gateway
//
M
aximum number of times to attempt to retrieve a round from a gateway
// before giving up on it
MaxAttemptsCheckingARound
uint
//
n
umber of historical rounds required to automatically send a historical
//
N
umber of historical rounds required to automatically send a historical
// rounds query
MaxHistoricalRounds
uint
//
m
aximum period of time a pending historical round query will wait before
// it
s
i transmitted
//
M
aximum period of time a pending historical round query will wait before
// it i
s
transmitted
HistoricalRoundsPeriod
time
.
Duration
//
n
umber of worker threads for retr
e
iving messages from gateways
//
N
umber of worker threads for retri
e
ving messages from gateways
NumMessageRetrievalWorkers
uint
//Length of historical rounds channel buffer
//
Length of historical rounds channel buffer
HistoricalRoundsBufferLen
uint
//Length of round lookup channel buffer
//
Length of round lookup channel buffer
LookupRoundsBufferLen
uint
// Toggles if historical rounds should always be used
ForceHistoricalRounds
bool
}
func
GetDefaultRounds
()
Rounds
{
...
...
@@ -39,5 +42,6 @@ func GetDefaultRounds() Rounds {
HistoricalRoundsBufferLen
:
1000
,
LookupRoundsBufferLen
:
2000
,
ForceHistoricalRounds
:
false
,
}
}
This diff is collapsed.
Click to expand it.
network/rounds/check.go
+
6
−
2
View file @
7ba07788
...
...
@@ -63,13 +63,17 @@ func (m *Manager) Checker(roundID id.Round, filters []*bloom.Ring) bool {
// Go get the round from the round infos, if it exists
ri
,
err
:=
m
.
Instance
.
GetRound
(
roundID
)
if
err
!=
nil
{
if
err
!=
nil
||
m
.
params
.
ForceHistoricalRounds
{
if
m
.
params
.
ForceHistoricalRounds
{
jww
.
WARN
.
Printf
(
"Forcing use of historical rounds for round ID %d."
,
roundID
)
}
jww
.
DEBUG
.
Printf
(
"HistoricalRound <- %d"
,
roundID
)
// If we didn't find it, send to Historical Rounds Retrieval
m
.
historicalRounds
<-
roundID
}
else
{
jww
.
DEBUG
.
Printf
(
"lookupRoundMessages <- %d"
,
roundID
)
// I
F
found, send to Message Retrieval Workers
// I
f
found, send to Message Retrieval Workers
m
.
lookupRoundMessages
<-
ri
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment