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
7856acdc
Commit
7856acdc
authored
3 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Make Delete Request calls accessible via API and bindings
parent
5e242bb9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!170
Release
,
!147
Implement Delete requests functions for auth store
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/client.go
+17
-2
17 additions, 2 deletions
api/client.go
bindings/client.go
+16
-0
16 additions, 0 deletions
bindings/client.go
with
33 additions
and
2 deletions
api/client.go
+
17
−
2
View file @
7856acdc
...
@@ -684,6 +684,21 @@ func (c *Client) GetNodeRegistrationStatus() (int, int, error) {
...
@@ -684,6 +684,21 @@ func (c *Client) GetNodeRegistrationStatus() (int, int, error) {
return
numRegistered
,
len
(
nodes
)
-
numStale
,
nil
return
numRegistered
,
len
(
nodes
)
-
numStale
,
nil
}
}
// DeleteAllRequests clears all requests from client's auth storage.
func
(
c
*
Client
)
DeleteAllRequests
()
error
{
return
c
.
GetStorage
()
.
Auth
()
.
DeleteAllRequests
()
}
// DeleteSentRequests clears sent requests from client's auth storage.
func
(
c
*
Client
)
DeleteSentRequests
()
error
{
return
c
.
GetStorage
()
.
Auth
()
.
DeleteSentRequests
()
}
// DeleteReceiveRequests clears receive requests from client's auth storage.
func
(
c
*
Client
)
DeleteReceiveRequests
()
error
{
return
c
.
GetStorage
()
.
Auth
()
.
DeleteReceiveRequests
()
}
// DeleteContact is a function which removes a partner from Client's storage
// DeleteContact is a function which removes a partner from Client's storage
func
(
c
*
Client
)
DeleteContact
(
partnerId
*
id
.
ID
)
error
{
func
(
c
*
Client
)
DeleteContact
(
partnerId
*
id
.
ID
)
error
{
jww
.
DEBUG
.
Printf
(
"Deleting contact with ID %s"
,
partnerId
)
jww
.
DEBUG
.
Printf
(
"Deleting contact with ID %s"
,
partnerId
)
...
@@ -742,8 +757,8 @@ func (c *Client) DeleteContact(partnerId *id.ID) error {
...
@@ -742,8 +757,8 @@ func (c *Client) DeleteContact(partnerId *id.ID) error {
//delete conversations
//delete conversations
c
.
storage
.
Conversations
()
.
Delete
(
partnerId
)
c
.
storage
.
Conversations
()
.
Delete
(
partnerId
)
// call delete requests to make sure nothing is lingering.
// call delete requests to make sure nothing is lingering.
// this is for saftey to ensure the contact can be readded
// this is for saftey to ensure the contact can be readded
// in the future
// in the future
_
=
c
.
storage
.
Auth
()
.
Delete
(
partnerId
)
_
=
c
.
storage
.
Auth
()
.
Delete
(
partnerId
)
...
...
This diff is collapsed.
Click to expand it.
bindings/client.go
+
16
−
0
View file @
7856acdc
...
@@ -265,6 +265,7 @@ func (c *Client) WaitForNetwork(timeoutMS int) bool {
...
@@ -265,6 +265,7 @@ func (c *Client) WaitForNetwork(timeoutMS int) bool {
func
(
c
*
Client
)
NetworkFollowerStatus
()
int
{
func
(
c
*
Client
)
NetworkFollowerStatus
()
int
{
return
int
(
c
.
api
.
NetworkFollowerStatus
())
return
int
(
c
.
api
.
NetworkFollowerStatus
())
}
}
// HasRunningProcessies checks if any background threads are running.
// HasRunningProcessies checks if any background threads are running.
// returns true if none are running. This is meant to be
// returns true if none are running. This is meant to be
// used when NetworkFollowerStatus() returns Stopping.
// used when NetworkFollowerStatus() returns Stopping.
...
@@ -449,6 +450,21 @@ func (c *Client) GetNodeRegistrationStatus() (*NodeRegistrationsStatus, error) {
...
@@ -449,6 +450,21 @@ func (c *Client) GetNodeRegistrationStatus() (*NodeRegistrationsStatus, error) {
return
&
NodeRegistrationsStatus
{
registered
,
total
},
err
return
&
NodeRegistrationsStatus
{
registered
,
total
},
err
}
}
// DeleteAllRequests clears all requests from Client's auth storage.
func
(
c
*
Client
)
DeleteAllRequests
()
error
{
return
c
.
api
.
DeleteAllRequests
()
}
// DeleteSentRequests clears sent requests from Client's auth storage.
func
(
c
*
Client
)
DeleteSentRequests
()
error
{
return
c
.
api
.
DeleteSentRequests
()
}
// DeleteReceiveRequests clears receive requests from Client's auth storage.
func
(
c
*
Client
)
DeleteReceiveRequests
()
error
{
return
c
.
api
.
DeleteReceiveRequests
()
}
// DeleteContact is a function which removes a contact from Client's storage
// DeleteContact is a function which removes a contact from Client's storage
func
(
c
*
Client
)
DeleteContact
(
b
[]
byte
)
error
{
func
(
c
*
Client
)
DeleteContact
(
b
[]
byte
)
error
{
contactObj
,
err
:=
UnmarshalContact
(
b
)
contactObj
,
err
:=
UnmarshalContact
(
b
)
...
...
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