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
42b9b27f
Commit
42b9b27f
authored
2 years ago
by
Jonah Husson
Browse files
Options
Downloads
Patches
Plain Diff
Add failedIdsList
parent
0d2555ea
No related branches found
No related tags found
2 merge requests
!510
Release
,
!382
Xx 4184/multilookup
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bindings/ud.go
+19
-4
19 additions, 4 deletions
bindings/ud.go
with
19 additions
and
4 deletions
bindings/ud.go
+
19
−
4
View file @
42b9b27f
...
...
@@ -438,9 +438,10 @@ func LookupUD(e2eID int, udContact []byte, cb UdLookupCallback,
// "<xxc(2)eMhAi/pYkW5jCmvKE5ZaTglQb+fTo1D8NxVitr5CCFADEgB7Ugdw/BAr6RoCABkWAFV1c2VybmFtZTE7fElAa7z3IcrYrrkwNjMS2w==xxc>",
// "<xxc(2)d7RJTu61Vy1lDThDMn8rYIiKSe1uXA/RCvvcIhq5Yg4DEgB7Ugdw/BAr6RsCABkWAFV1c2VybmFtZTI7N3XWrxIUpR29atpFMkcR6A==xxc>"
// }
// - failedIDs - JSON marshalled list of []*id.ID objects which failed lookup
// - err - any errors that occurred in the multilookup.
type
UdMultiLookupCallback
interface
{
Callback
(
contactListJSON
[]
byte
,
err
error
)
Callback
(
contactListJSON
[]
byte
,
failedIDs
[]
byte
,
err
error
)
}
type
lookupResp
struct
{
...
...
@@ -514,21 +515,35 @@ func MultiLookupUD(e2eID int, udContact []byte, cb UdMultiLookupCallback,
go
func
()
{
var
contactList
[]
contact
.
Contact
var
failedIDs
[]
*
id
.
ID
var
errorString
string
for
numReturned
:=
0
;
numReturned
<
len
(
idList
);
numReturned
++
{
response
:=
<-
respCh
if
response
.
err
!=
nil
{
failedIDs
=
append
(
failedIDs
,
response
.
id
)
contactList
=
append
(
contactList
,
response
.
contact
)
}
else
{
errorString
=
errorString
+
fmt
.
Sprintf
(
"Failed to lookup id %s: %+v"
,
response
.
id
,
response
.
err
)
errorString
=
errorString
+
fmt
.
Sprintf
(
"Failed to lookup id %s: %+v"
,
response
.
id
,
response
.
err
)
}
}
marshalledFailedIds
,
err
:=
json
.
Marshal
(
failedIDs
)
if
err
!=
nil
{
cb
.
Callback
(
nil
,
nil
,
errors
.
WithMessage
(
err
,
"Failed to marshal failed IDs"
))
}
marshalled
,
err
:=
json
.
Marshal
(
contactList
)
if
err
!=
nil
{
cb
.
Callback
(
nil
,
err
)
cb
.
Callback
(
nil
,
nil
,
errors
.
WithMessage
(
err
,
"Failed to marshal contact list"
))
}
else
{
cb
.
Callback
(
marshalled
,
errors
.
New
(
errorString
))
cb
.
Callback
(
marshalled
,
marshalledFailedIds
,
errors
.
New
(
errorString
))
}
}()
...
...
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