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
d0367733
Commit
d0367733
authored
2 years ago
by
benjamin
Browse files
Options
Downloads
Patches
Plain Diff
changed the event model to always pass over message type numbers
parent
8251db7e
No related branches found
No related tags found
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
channels/eventModel.go
+17
-6
17 additions, 6 deletions
channels/eventModel.go
channels/eventModel_test.go
+3
-3
3 additions, 3 deletions
channels/eventModel_test.go
channels/joinedChannel_test.go
+3
-3
3 additions, 3 deletions
channels/joinedChannel_test.go
with
23 additions
and
12 deletions
channels/eventModel.go
+
17
−
6
View file @
d0367733
...
@@ -58,10 +58,13 @@ type EventModel interface {
...
@@ -58,10 +58,13 @@ type EventModel interface {
//
//
// Nickname may be empty, in which case the UI is expected to display
// Nickname may be empty, in which case the UI is expected to display
// the codename
// the codename
//
// Message type is included in the call, it will always be Text (1)
// for this call, but it may be required in downstream databases
ReceiveMessage
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
ReceiveMessage
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
nickname
,
text
string
,
identity
cryptoChannel
.
Identity
,
nickname
,
text
string
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
status
SentStatus
)
uint64
mType
MessageType
,
status
SentStatus
)
uint64
// ReceiveReply is called whenever a message is received that is a reply on
// ReceiveReply is called whenever a message is received that is a reply on
// a given channel. It may be called multiple times on the same message. It
// a given channel. It may be called multiple times on the same message. It
...
@@ -79,10 +82,14 @@ type EventModel interface {
...
@@ -79,10 +82,14 @@ type EventModel interface {
//
//
// Nickname may be empty, in which case the UI is expected to display
// Nickname may be empty, in which case the UI is expected to display
// the codename
// the codename
//
// Message type is included in the call, it will always be Text (1) for
// this call, but it may be required in downstream databases
ReceiveReply
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
ReceiveReply
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
reactionTo
cryptoChannel
.
MessageID
,
nickname
,
text
string
,
reactionTo
cryptoChannel
.
MessageID
,
nickname
,
text
string
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
status
SentStatus
)
uint64
lease
time
.
Duration
,
round
rounds
.
Round
,
mType
MessageType
,
status
SentStatus
)
uint64
// ReceiveReaction is called whenever a reaction to a message is received
// ReceiveReaction is called whenever a reaction to a message is received
// on a given channel. It may be called multiple times on the same reaction.
// on a given channel. It may be called multiple times on the same reaction.
...
@@ -102,10 +109,14 @@ type EventModel interface {
...
@@ -102,10 +109,14 @@ type EventModel interface {
//
//
// Nickname may be empty, in which case the UI is expected to display
// Nickname may be empty, in which case the UI is expected to display
// the codename
// the codename
//
// Message type is included in the call, it will always be Reaction (3) for
// this call, but it may be required in downstream databases
ReceiveReaction
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
ReceiveReaction
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
reactionTo
cryptoChannel
.
MessageID
,
nickname
,
reaction
string
,
reactionTo
cryptoChannel
.
MessageID
,
nickname
,
reaction
string
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
status
SentStatus
)
uint64
lease
time
.
Duration
,
round
rounds
.
Round
,
mType
MessageType
,
status
SentStatus
)
uint64
// UpdateSentStatus is called whenever the sent status of a message has
// UpdateSentStatus is called whenever the sent status of a message has
// changed.
// changed.
...
@@ -283,7 +294,7 @@ func (e *events) receiveTextMessage(channelID *id.ID,
...
@@ -283,7 +294,7 @@ func (e *events) receiveTextMessage(channelID *id.ID,
var
replyTo
cryptoChannel
.
MessageID
var
replyTo
cryptoChannel
.
MessageID
copy
(
replyTo
[
:
],
txt
.
ReplyMessageID
)
copy
(
replyTo
[
:
],
txt
.
ReplyMessageID
)
return
e
.
model
.
ReceiveReply
(
channelID
,
messageID
,
replyTo
,
return
e
.
model
.
ReceiveReply
(
channelID
,
messageID
,
replyTo
,
nickname
,
txt
.
Text
,
identity
,
timestamp
,
lease
,
round
,
status
)
nickname
,
txt
.
Text
,
identity
,
timestamp
,
lease
,
round
,
Text
,
status
)
}
else
{
}
else
{
jww
.
ERROR
.
Printf
(
"Failed process reply to for message %s from %s on "
+
jww
.
ERROR
.
Printf
(
"Failed process reply to for message %s from %s on "
+
...
@@ -297,7 +308,7 @@ func (e *events) receiveTextMessage(channelID *id.ID,
...
@@ -297,7 +308,7 @@ func (e *events) receiveTextMessage(channelID *id.ID,
}
}
return
e
.
model
.
ReceiveMessage
(
channelID
,
messageID
,
nickname
,
txt
.
Text
,
identity
,
return
e
.
model
.
ReceiveMessage
(
channelID
,
messageID
,
nickname
,
txt
.
Text
,
identity
,
timestamp
,
lease
,
round
,
status
)
timestamp
,
lease
,
round
,
Text
,
status
)
}
}
// receiveReaction is the internal function that handles the reception of
// receiveReaction is the internal function that handles the reception of
...
@@ -335,7 +346,7 @@ func (e *events) receiveReaction(channelID *id.ID,
...
@@ -335,7 +346,7 @@ func (e *events) receiveReaction(channelID *id.ID,
var
reactTo
cryptoChannel
.
MessageID
var
reactTo
cryptoChannel
.
MessageID
copy
(
reactTo
[
:
],
react
.
ReactionMessageID
)
copy
(
reactTo
[
:
],
react
.
ReactionMessageID
)
return
e
.
model
.
ReceiveReaction
(
channelID
,
messageID
,
reactTo
,
nickname
,
return
e
.
model
.
ReceiveReaction
(
channelID
,
messageID
,
reactTo
,
nickname
,
react
.
Reaction
,
identity
,
timestamp
,
lease
,
round
,
status
)
react
.
Reaction
,
identity
,
timestamp
,
lease
,
round
,
Reaction
,
status
)
}
else
{
}
else
{
jww
.
ERROR
.
Printf
(
"Failed process reaction %s from %s on channel "
+
jww
.
ERROR
.
Printf
(
"Failed process reaction %s from %s on channel "
+
"%s, type %s, ts: %s, lease: %s, round: %d, reacting to "
+
"%s, type %s, ts: %s, lease: %s, round: %d, reacting to "
+
...
...
This diff is collapsed.
Click to expand it.
channels/eventModel_test.go
+
3
−
3
View file @
d0367733
...
@@ -57,7 +57,7 @@ func (*MockEvent) LeaveChannel(channelID *id.ID) {}
...
@@ -57,7 +57,7 @@ func (*MockEvent) LeaveChannel(channelID *id.ID) {}
func
(
m
*
MockEvent
)
ReceiveMessage
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
func
(
m
*
MockEvent
)
ReceiveMessage
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
nickname
,
text
string
,
identity
cryptoChannel
.
Identity
,
nickname
,
text
string
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
status
SentStatus
)
uint64
{
mType
MessageType
,
status
SentStatus
)
uint64
{
m
.
eventReceive
=
eventReceive
{
m
.
eventReceive
=
eventReceive
{
channelID
:
channelID
,
channelID
:
channelID
,
messageID
:
messageID
,
messageID
:
messageID
,
...
@@ -73,7 +73,7 @@ func (m *MockEvent) ReceiveMessage(channelID *id.ID, messageID cryptoChannel.Mes
...
@@ -73,7 +73,7 @@ func (m *MockEvent) ReceiveMessage(channelID *id.ID, messageID cryptoChannel.Mes
func
(
m
*
MockEvent
)
ReceiveReply
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
func
(
m
*
MockEvent
)
ReceiveReply
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
reactionTo
cryptoChannel
.
MessageID
,
nickname
,
text
string
,
reactionTo
cryptoChannel
.
MessageID
,
nickname
,
text
string
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
status
SentStatus
)
uint64
{
lease
time
.
Duration
,
round
rounds
.
Round
,
mType
MessageType
,
status
SentStatus
)
uint64
{
fmt
.
Println
(
reactionTo
)
fmt
.
Println
(
reactionTo
)
m
.
eventReceive
=
eventReceive
{
m
.
eventReceive
=
eventReceive
{
channelID
:
channelID
,
channelID
:
channelID
,
...
@@ -90,7 +90,7 @@ func (m *MockEvent) ReceiveReply(channelID *id.ID, messageID cryptoChannel.Messa
...
@@ -90,7 +90,7 @@ func (m *MockEvent) ReceiveReply(channelID *id.ID, messageID cryptoChannel.Messa
func
(
m
*
MockEvent
)
ReceiveReaction
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
func
(
m
*
MockEvent
)
ReceiveReaction
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
reactionTo
cryptoChannel
.
MessageID
,
nickname
,
reaction
string
,
reactionTo
cryptoChannel
.
MessageID
,
nickname
,
reaction
string
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
status
SentStatus
)
uint64
{
lease
time
.
Duration
,
round
rounds
.
Round
,
mType
MessageType
,
status
SentStatus
)
uint64
{
m
.
eventReceive
=
eventReceive
{
m
.
eventReceive
=
eventReceive
{
channelID
:
channelID
,
channelID
:
channelID
,
messageID
:
messageID
,
messageID
:
messageID
,
...
...
This diff is collapsed.
Click to expand it.
channels/joinedChannel_test.go
+
3
−
3
View file @
d0367733
...
@@ -626,18 +626,18 @@ func (m *mockEventModel) LeaveChannel(c *id.ID) {
...
@@ -626,18 +626,18 @@ func (m *mockEventModel) LeaveChannel(c *id.ID) {
func
(
m
*
mockEventModel
)
ReceiveMessage
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
func
(
m
*
mockEventModel
)
ReceiveMessage
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
nickname
,
text
string
,
identity
cryptoChannel
.
Identity
,
nickname
,
text
string
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
status
SentStatus
)
uint64
{
mType
MessageType
,
status
SentStatus
)
uint64
{
return
0
return
0
}
}
func
(
m
*
mockEventModel
)
ReceiveReply
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
func
(
m
*
mockEventModel
)
ReceiveReply
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
reactionTo
cryptoChannel
.
MessageID
,
nickname
,
text
string
,
reactionTo
cryptoChannel
.
MessageID
,
nickname
,
text
string
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
status
SentStatus
)
uint64
{
lease
time
.
Duration
,
round
rounds
.
Round
,
mType
MessageType
,
status
SentStatus
)
uint64
{
return
0
return
0
}
}
func
(
m
*
mockEventModel
)
ReceiveReaction
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
func
(
m
*
mockEventModel
)
ReceiveReaction
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
reactionTo
cryptoChannel
.
MessageID
,
nickname
,
reaction
string
,
reactionTo
cryptoChannel
.
MessageID
,
nickname
,
reaction
string
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
status
SentStatus
)
uint64
{
lease
time
.
Duration
,
round
rounds
.
Round
,
mType
MessageType
,
status
SentStatus
)
uint64
{
return
0
return
0
}
}
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