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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
fe87f3ae
Commit
fe87f3ae
authored
Sep 28, 2022
by
Jono Wenger
Browse files
Options
Downloads
Patches
Plain Diff
Add error return to EventModelBuilder type and update tests and bindings
parent
068c27f5
Branches
Branches containing commit
Tags
Tags containing commit
4 merge requests
!510
Release
,
!419
rewrote the health tracker to both consider if there are waiting rounds and...
,
!397
Fully Decentralized channels
,
!340
Project/channels
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
bindings/channels.go
+4
-4
4 additions, 4 deletions
bindings/channels.go
channels/joinedChannel_test.go
+2
-2
2 additions, 2 deletions
channels/joinedChannel_test.go
channels/manager.go
+18
-8
18 additions, 8 deletions
channels/manager.go
with
24 additions
and
14 deletions
bindings/channels.go
+
4
−
4
View file @
fe87f3ae
...
...
@@ -259,8 +259,8 @@ func NewChannelsManager(cmixID int, privateIdentity []byte,
return
nil
,
err
}
eb
:=
func
(
path
string
)
channels
.
EventModel
{
return
NewEventModel
(
eventBuilder
.
Build
(
path
))
eb
:=
func
(
path
string
)
(
channels
.
EventModel
,
error
)
{
return
NewEventModel
(
eventBuilder
.
Build
(
path
))
,
nil
}
// Construct new channels manager
...
...
@@ -297,8 +297,8 @@ func LoadChannelsManager(cmixID int, storageTag string,
return
nil
,
err
}
eb
:=
func
(
path
string
)
channels
.
EventModel
{
return
NewEventModel
(
eventBuilder
.
Build
(
path
))
eb
:=
func
(
path
string
)
(
channels
.
EventModel
,
error
)
{
return
NewEventModel
(
eventBuilder
.
Build
(
path
))
,
nil
}
// Construct new channels manager
...
...
This diff is collapsed.
Click to expand it.
channels/joinedChannel_test.go
+
2
−
2
View file @
fe87f3ae
...
...
@@ -601,8 +601,8 @@ func (m *mockBroadcastClient) RemoveHealthCallback(uint64) {}
// Mock EventModel //
////////////////////////////////////////////////////////////////////////////////
func
mockEventModelBuilder
(
string
)
EventModel
{
return
&
mockEventModel
{}
func
mockEventModelBuilder
(
string
)
(
EventModel
,
error
)
{
return
&
mockEventModel
{}
,
nil
}
// mockEventModel adheres to the EventModel interface.
...
...
This diff is collapsed.
Click to expand it.
channels/manager.go
+
18
−
8
View file @
fe87f3ae
...
...
@@ -14,6 +14,7 @@ import (
"crypto/ed25519"
"encoding/base64"
"fmt"
"github.com/pkg/errors"
"gitlab.com/elixxir/client/broadcast"
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/cmix/message"
...
...
@@ -46,10 +47,10 @@ type manager struct {
// Events model
*
events
//
n
icknames
//
N
icknames
*
nicknameManager
//
s
end tracker
//
S
end tracker
st
*
sendTracker
// Makes the function that is used to create broadcasts be a pointer so that
...
...
@@ -76,7 +77,7 @@ type Client interface {
}
// EventModelBuilder initialises the event model using the given path.
type
EventModelBuilder
func
(
path
string
)
EventModel
type
EventModelBuilder
func
(
path
string
)
(
EventModel
,
error
)
// NewManager creates a new channel Manager from a [channel.PrivateIdentity]. It
// prefixes the KV with a tag derived from the public key that can be retried
...
...
@@ -92,7 +93,13 @@ func NewManager(identity cryptoChannel.PrivateIdentity, kv *versioned.KV,
if
err
:=
storeIdentity
(
kv
,
identity
);
err
!=
nil
{
return
nil
,
err
}
m
:=
setupManager
(
identity
,
kv
,
net
,
rng
,
modelBuilder
(
storageTag
))
model
,
err
:=
modelBuilder
(
storageTag
)
if
err
!=
nil
{
return
nil
,
errors
.
Errorf
(
"Failed to build event model: %+v"
,
err
)
}
m
:=
setupManager
(
identity
,
kv
,
net
,
rng
,
model
)
return
m
,
nil
}
...
...
@@ -111,7 +118,10 @@ func LoadManager(storageTag string, kv *versioned.KV, net Client,
return
nil
,
err
}
model
:=
modelBuilder
(
storageTag
)
model
,
err
:=
modelBuilder
(
storageTag
)
if
err
!=
nil
{
return
nil
,
errors
.
Errorf
(
"Failed to build event model: %+v"
,
err
)
}
m
:=
setupManager
(
identity
,
kv
,
net
,
rng
,
model
)
...
...
@@ -199,11 +209,11 @@ func (m *manager) ReplayChannel(chID *id.ID) error {
c
:=
jc
.
broadcast
.
Get
()
//
s
top the broadcast
which
will completely wipe it from the underlying
//
cmix
object
//
S
top the broadcast
that
will completely wipe it from the underlying
cmix
// object
jc
.
broadcast
.
Stop
()
//
r
e-instantiate the broadcast, re-registering it from scratch
//
R
e-instantiate the broadcast, re-registering it from scratch
b
,
err
:=
initBroadcast
(
c
,
m
.
events
,
m
.
net
,
m
.
broadcastMaker
,
m
.
rng
,
m
.
st
.
MessageReceive
)
if
err
!=
nil
{
...
...
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