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
8f65f1e5
Commit
8f65f1e5
authored
Sep 8, 2022
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
changed the event model
parent
b2a43baf
No related branches found
No related tags found
5 merge requests
!510
Release
,
!419
rewrote the health tracker to both consider if there are waiting rounds and...
,
!372
implemented the send tracker
,
!370
Full round obj
,
!340
Project/channels
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
channels/eventModel.go
+7
-26
7 additions, 26 deletions
channels/eventModel.go
channels/eventModel_test.go
+3
-23
3 additions, 23 deletions
channels/eventModel_test.go
channels/joinedChannel_test.go
+3
-23
3 additions, 23 deletions
channels/joinedChannel_test.go
with
13 additions
and
72 deletions
channels/eventModel.go
+
7
−
26
View file @
8f65f1e5
...
...
@@ -47,8 +47,8 @@ type EventModel interface {
// It may be called multiple times on the same message, it is incumbent on
// the user of the API to filter such called by message ID
ReceiveMessage
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
senderUsername
string
,
text
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
)
senderUsername
string
,
text
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
status
SentStatus
)
// ReceiveReply is called whenever a message is received which is a reply
// on a given channel. It may be called multiple times on the same message,
...
...
@@ -58,7 +58,7 @@ type EventModel interface {
ReceiveReply
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
reactionTo
cryptoChannel
.
MessageID
,
senderUsername
string
,
text
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
)
round
rounds
.
Round
,
status
SentStatus
)
// 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,
...
...
@@ -68,26 +68,7 @@ type EventModel interface {
ReceiveReaction
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
reactionTo
cryptoChannel
.
MessageID
,
senderUsername
string
,
reaction
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
)
// MessageSent is called whenever the user sends a message. It should be
//designated as "sent" and that delivery is unknown.
MessageSent
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
myUsername
string
,
text
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
)
// ReplySent is called whenever the user sends a reply. It should be
// designated as "sent" and that delivery is unknown.
ReplySent
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
replyTo
cryptoChannel
.
MessageID
,
myUsername
string
,
text
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
)
// ReactionSent is called whenever the user sends a reply. It should be
// designated as "sent" and that delivery is unknown.
ReactionSent
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
reactionTo
cryptoChannel
.
MessageID
,
senderUsername
string
,
reaction
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
)
round
rounds
.
Round
,
status
SentStatus
)
// UpdateSentStatus is called whenever the sent status of a message
// has changed
...
...
@@ -242,7 +223,7 @@ func (e *events) receiveTextMessage(channelID *id.ID,
var
replyTo
cryptoChannel
.
MessageID
copy
(
replyTo
[
:
],
txt
.
ReplyMessageID
)
e
.
model
.
ReceiveReply
(
channelID
,
messageID
,
replyTo
,
senderUsername
,
txt
.
Text
,
timestamp
,
lease
,
round
)
senderUsername
,
txt
.
Text
,
timestamp
,
lease
,
round
,
Delivered
)
return
}
else
{
...
...
@@ -259,7 +240,7 @@ func (e *events) receiveTextMessage(channelID *id.ID,
fmt
.
Println
(
channelID
)
e
.
model
.
ReceiveMessage
(
channelID
,
messageID
,
senderUsername
,
txt
.
Text
,
timestamp
,
lease
,
round
)
timestamp
,
lease
,
round
,
Delivered
)
}
// receiveReaction is the internal function which handles the reception of
...
...
@@ -295,7 +276,7 @@ func (e *events) receiveReaction(channelID *id.ID,
var
reactTo
cryptoChannel
.
MessageID
copy
(
reactTo
[
:
],
react
.
ReactionMessageID
)
e
.
model
.
ReceiveReaction
(
channelID
,
messageID
,
reactTo
,
senderUsername
,
react
.
Reaction
,
timestamp
,
lease
,
round
)
react
.
Reaction
,
timestamp
,
lease
,
round
,
Delivered
)
}
else
{
jww
.
ERROR
.
Printf
(
"Failed process reaction %s from %s on channel "
+
"%s, type %s, ts: %s, lease: %s, round: %d, reacting to "
+
...
...
This diff is collapsed.
Click to expand it.
channels/eventModel_test.go
+
3
−
23
View file @
8f65f1e5
...
...
@@ -38,26 +38,6 @@ type MockEvent struct {
eventReceive
}
func
(
m
*
MockEvent
)
MessageSent
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
myUsername
string
,
text
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
)
{
//TODO implement me
panic
(
"implement me"
)
}
func
(
m
*
MockEvent
)
ReplySent
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
replyTo
cryptoChannel
.
MessageID
,
myUsername
string
,
text
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
)
{
//TODO implement me
panic
(
"implement me"
)
}
func
(
m
*
MockEvent
)
ReactionSent
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
reactionTo
cryptoChannel
.
MessageID
,
senderUsername
string
,
reaction
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
)
{
//TODO implement me
panic
(
"implement me"
)
}
func
(
m
*
MockEvent
)
UpdateSentStatus
(
messageID
cryptoChannel
.
MessageID
,
status
SentStatus
)
{
//TODO implement me
...
...
@@ -68,7 +48,7 @@ func (*MockEvent) JoinChannel(channel *cryptoBroadcast.Channel) {}
func
(
*
MockEvent
)
LeaveChannel
(
channelID
*
id
.
ID
)
{}
func
(
m
*
MockEvent
)
ReceiveMessage
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
senderUsername
string
,
text
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
)
{
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
status
SentStatus
)
{
m
.
eventReceive
=
eventReceive
{
channelID
:
channelID
,
messageID
:
messageID
,
...
...
@@ -83,7 +63,7 @@ func (m *MockEvent) ReceiveMessage(channelID *id.ID, messageID cryptoChannel.Mes
func
(
m
*
MockEvent
)
ReceiveReply
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
replyTo
cryptoChannel
.
MessageID
,
senderUsername
string
,
text
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
)
{
round
rounds
.
Round
,
status
SentStatus
)
{
fmt
.
Println
(
replyTo
)
m
.
eventReceive
=
eventReceive
{
channelID
:
channelID
,
...
...
@@ -99,7 +79,7 @@ func (m *MockEvent) ReceiveReply(channelID *id.ID, messageID cryptoChannel.Messa
func
(
m
*
MockEvent
)
ReceiveReaction
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
reactionTo
cryptoChannel
.
MessageID
,
senderUsername
string
,
reaction
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
)
{
round
rounds
.
Round
,
status
SentStatus
)
{
m
.
eventReceive
=
eventReceive
{
channelID
:
channelID
,
messageID
:
messageID
,
...
...
This diff is collapsed.
Click to expand it.
channels/joinedChannel_test.go
+
3
−
23
View file @
8f65f1e5
...
...
@@ -504,26 +504,6 @@ type mockEventModel struct {
leftCh
*
id
.
ID
}
func
(
m
*
mockEventModel
)
MessageSent
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
myUsername
string
,
text
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
)
{
//TODO implement me
panic
(
"implement me"
)
}
func
(
m
*
mockEventModel
)
ReplySent
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
replyTo
cryptoChannel
.
MessageID
,
myUsername
string
,
text
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
)
{
//TODO implement me
panic
(
"implement me"
)
}
func
(
m
*
mockEventModel
)
ReactionSent
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
reactionTo
cryptoChannel
.
MessageID
,
senderUsername
string
,
reaction
string
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
)
{
//TODO implement me
panic
(
"implement me"
)
}
func
(
m
*
mockEventModel
)
UpdateSentStatus
(
messageID
cryptoChannel
.
MessageID
,
status
SentStatus
)
{
//TODO implement me
...
...
@@ -537,13 +517,13 @@ func (m *mockEventModel) LeaveChannel(c *id.ID) {
m
.
leftCh
=
c
}
func
(
m
*
mockEventModel
)
ReceiveMessage
(
*
id
.
ID
,
cryptoChannel
.
MessageID
,
string
,
string
,
time
.
Time
,
time
.
Duration
,
rounds
.
Round
)
{
string
,
time
.
Time
,
time
.
Duration
,
rounds
.
Round
,
SentStatus
)
{
}
func
(
m
*
mockEventModel
)
ReceiveReply
(
*
id
.
ID
,
cryptoChannel
.
MessageID
,
cryptoChannel
.
MessageID
,
string
,
string
,
time
.
Time
,
time
.
Duration
,
rounds
.
Round
)
{
rounds
.
Round
,
SentStatus
)
{
}
func
(
m
*
mockEventModel
)
ReceiveReaction
(
*
id
.
ID
,
cryptoChannel
.
MessageID
,
cryptoChannel
.
MessageID
,
string
,
string
,
time
.
Time
,
time
.
Duration
,
rounds
.
Round
)
{
rounds
.
Round
,
SentStatus
)
{
}
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