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
8ea3b99e
Commit
8ea3b99e
authored
3 years ago
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
changed group creation over bindings so errors are returns as strings as part of the report object
parent
8a77b59a
No related branches found
No related tags found
1 merge request
!67
Release
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bindings/group.go
+26
-7
26 additions, 7 deletions
bindings/group.go
with
26 additions
and
7 deletions
bindings/group.go
+
26
−
7
View file @
8ea3b99e
...
@@ -62,10 +62,13 @@ func NewGroupManager(client *Client, requestFunc GroupRequestFunc,
...
@@ -62,10 +62,13 @@ func NewGroupManager(client *Client, requestFunc GroupRequestFunc,
// MakeGroup creates a new group and sends a group request to all members in the
// MakeGroup creates a new group and sends a group request to all members in the
// group. The ID of the new group, the rounds the requests were sent on, and the
// group. The ID of the new group, the rounds the requests were sent on, and the
// status of the send are contained in NewGroupReport.
// status of the send are contained in NewGroupReport.
func
(
g
*
GroupChat
)
MakeGroup
(
membership
*
IdList
,
name
,
message
[]
byte
)
(
func
(
g
*
GroupChat
)
MakeGroup
(
membership
*
IdList
,
name
,
message
[]
byte
)
*
NewGroupReport
{
*
NewGroupReport
,
error
)
{
grp
,
rounds
,
status
,
err
:=
g
.
m
.
MakeGroup
(
membership
.
list
,
name
,
message
)
grp
,
rounds
,
status
,
err
:=
g
.
m
.
MakeGroup
(
membership
.
list
,
name
,
message
)
return
&
NewGroupReport
{
&
Group
{
grp
},
rounds
,
status
},
err
errStr
:=
""
if
err
!=
nil
{
errStr
=
err
.
Error
()
}
return
&
NewGroupReport
{
&
Group
{
grp
},
rounds
,
status
,
errStr
}
}
}
// ResendRequest resends a group request to all members in the group. The rounds
// ResendRequest resends a group request to all members in the group. The rounds
...
@@ -77,9 +80,18 @@ func (g *GroupChat) ResendRequest(groupIdBytes []byte) (*NewGroupReport, error)
...
@@ -77,9 +80,18 @@ func (g *GroupChat) ResendRequest(groupIdBytes []byte) (*NewGroupReport, error)
errors
.
Errorf
(
"Failed to unmarshal group ID: %+v"
,
err
)
errors
.
Errorf
(
"Failed to unmarshal group ID: %+v"
,
err
)
}
}
grp
,
exists
:=
g
.
m
.
GetGroup
(
groupID
)
if
!
exists
{
return
nil
,
errors
.
Errorf
(
"Failed to find group %s"
,
groupID
)
}
rounds
,
status
,
err
:=
g
.
m
.
ResendRequest
(
groupID
)
rounds
,
status
,
err
:=
g
.
m
.
ResendRequest
(
groupID
)
return
&
NewGroupReport
{
&
Group
{},
rounds
,
status
},
nil
errStr
:=
""
if
err
!=
nil
{
errStr
=
err
.
Error
()
}
return
&
NewGroupReport
{
&
Group
{
grp
},
rounds
,
status
,
errStr
},
nil
}
}
// JoinGroup allows a user to join a group when they receive a request. The
// JoinGroup allows a user to join a group when they receive a request. The
...
@@ -152,6 +164,7 @@ type NewGroupReport struct {
...
@@ -152,6 +164,7 @@ type NewGroupReport struct {
group
*
Group
group
*
Group
rounds
[]
id
.
Round
rounds
[]
id
.
Round
status
gc
.
RequestStatus
status
gc
.
RequestStatus
err
string
}
}
// GetGroup returns the Group.
// GetGroup returns the Group.
...
@@ -167,13 +180,19 @@ func (ngr *NewGroupReport) GetRoundList() *RoundList {
...
@@ -167,13 +180,19 @@ func (ngr *NewGroupReport) GetRoundList() *RoundList {
// GetStatus returns the status of the requests sent when creating a new group.
// GetStatus returns the status of the requests sent when creating a new group.
// status = 0 an error occurred before any requests could be sent
// status = 0 an error occurred before any requests could be sent
// 1 all requests failed to send
// 1 all requests failed to send
(call Resend Group)
// 2 some request failed and some succeeded
// 2 some request failed and some succeeded
(call Resend Group)
// 3, all requests sent successfully
// 3, all requests sent successfully
(call Resend Group)
func
(
ngr
*
NewGroupReport
)
GetStatus
()
int
{
func
(
ngr
*
NewGroupReport
)
GetStatus
()
int
{
return
int
(
ngr
.
status
)
return
int
(
ngr
.
status
)
}
}
// GetError returns the string of an error.
// Will be an empty string if no error occured
func
(
ngr
*
NewGroupReport
)
GetError
()
string
{
return
ngr
.
err
}
////
////
// NewGroupReport Structure
// NewGroupReport Structure
////
////
...
...
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