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
7c1ce2b1
Commit
7c1ce2b1
authored
2 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Have search return JSON of already marshaled contacts
parent
9e2fe243
No related branches found
No related tags found
2 merge requests
!510
Release
,
!346
Have search return JSON of already marshaled contacts
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bindings/single.go
+2
-2
2 additions, 2 deletions
bindings/single.go
bindings/ud.go
+24
-4
24 additions, 4 deletions
bindings/ud.go
with
26 additions
and
6 deletions
bindings/single.go
+
2
−
2
View file @
7c1ce2b1
...
...
@@ -166,7 +166,7 @@ type Stopper interface {
// Parameters:
// - callbackReport - the JSON marshalled bytes of the SingleUseCallbackReport
// object, which can be passed into Cmix.WaitForRoundResult to see if the
// send succeeded.
// send
operation
succeeded.
type
SingleUseCallback
interface
{
Callback
(
callbackReport
[]
byte
,
err
error
)
}
...
...
@@ -177,7 +177,7 @@ type SingleUseCallback interface {
// Parameters:
// - callbackReport - the JSON marshalled bytes of the SingleUseResponseReport
// object, which can be passed into Cmix.WaitForRoundResult to see if the
// send succeeded.
// send
operation
succeeded.
type
SingleUseResponse
interface
{
Callback
(
responseReport
[]
byte
,
err
error
)
}
...
...
This diff is collapsed.
Click to expand it.
bindings/ud.go
+
24
−
4
View file @
7c1ce2b1
...
...
@@ -429,8 +429,15 @@ func LookupUD(e2eID int, udContact []byte, cb UdLookupCallback,
//
// Parameters:
// - contactListJSON - the JSON marshalled bytes of []contact.Contact, or nil
// if an error occurs
// - err - any errors that occurred in the search
// if an error occurs.
//
// JSON Example:
// {
// "<xxc(2)F8dL9EC6gy+RMJuk3R+Au6eGExo02Wfio5cacjBcJRwDEgB7Ugdw/BAr6RkCABkWAFV1c2VybmFtZTA7c4LzV05sG+DMt+rFB0NIJg==xxc>",
// "<xxc(2)eMhAi/pYkW5jCmvKE5ZaTglQb+fTo1D8NxVitr5CCFADEgB7Ugdw/BAr6RoCABkWAFV1c2VybmFtZTE7fElAa7z3IcrYrrkwNjMS2w==xxc>",
// "<xxc(2)d7RJTu61Vy1lDThDMn8rYIiKSe1uXA/RCvvcIhq5Yg4DEgB7Ugdw/BAr6RsCABkWAFV1c2VybmFtZTI7N3XWrxIUpR29atpFMkcR6A==xxc>"
// }
// - err - any errors that occurred in the search.
type
UdSearchCallback
interface
{
Callback
(
contactListJSON
[]
byte
,
err
error
)
}
...
...
@@ -451,7 +458,7 @@ type UdSearchCallback interface {
// Returns:
// - []byte - the JSON marshalled bytes of the SingleUseSendReport object,
// which can be passed into Cmix.WaitForRoundResult to see if the send
// succeeded.
//
operation
succeeded.
func
SearchUD
(
e2eID
int
,
udContact
[]
byte
,
cb
UdSearchCallback
,
factListJSON
,
singleRequestParamsJSON
[]
byte
)
([]
byte
,
error
)
{
...
...
@@ -479,7 +486,20 @@ func SearchUD(e2eID int, udContact []byte, cb UdSearchCallback,
}
callback
:=
func
(
contactList
[]
contact
.
Contact
,
err
error
)
{
contactListJSON
,
err2
:=
json
.
Marshal
(
contactList
)
marshaledContactList
:=
make
([][]
byte
,
0
)
// fixme: it may be wiser to change this callback interface
// to simply do the work below when parsing the response from UD.
// that would change ud/search.go in two places:
// - searchCallback
// - parseContacts
// I avoid doing that as it changes interfaces w/o approval
for
i
:=
range
contactList
{
con
:=
contactList
[
i
]
marshaledContactList
=
append
(
marshaledContactList
,
con
.
Marshal
())
}
contactListJSON
,
err2
:=
json
.
Marshal
(
marshaledContactList
)
if
err2
!=
nil
{
jww
.
FATAL
.
Panicf
(
"Failed to marshal list of contact.Contact: %+v"
,
err2
)
...
...
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