Skip to content

Use registrar client #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
May 6, 2025
Merged

Use registrar client #11

merged 15 commits into from
May 6, 2025

Conversation

Eslam-Nawara
Copy link
Contributor

Description

update registrar gateway to use the new registrar client

Changes

List of changes this PR includes

Related Issues

Checklist

  • Tests included
  • Build pass
  • Documentation
  • Code format and docstring


r.mu.Lock()
defer r.mu.Unlock()
opts := []client.UpdateNodeOpts{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are those updates required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't understand what you mean by are updates required

}

func (r *registrarGateway) GetTime() (time.Time, error) {
// log.Trace().Str("method", "Time").Msg("method called")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why commenting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not implemented in the registrar yet


nodeID, regErr := registrarGateway.GetNodeByTwinID(ctx, twinID)
node, regErr := registrarGateway.GetNodeByTwinID(ctx, twinID)
nodeID = node.NodeID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how could we retrieve the node ID if there is an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there's an error it would create a node if the error is ErrorNodeNotFound, if not it will fail

if regErr != nil {
if strings.Contains(regErr.Error(), registrargw.ErrorRecordNotFound.Error()) {
nodeID, err = registrarGateway.CreateNode(ctx, req)
if strings.Contains(regErr.Error(), client.ErrorNodeNotFround.Error()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cannot we use errors.As?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tried it and it's not working

}

// if we are on devnet just update we don't need to update the version throught out the registrar
v := "v0.0.0"
v := client.ZosVersion{Version: "v0.0.0", SafeToUpgrade: true}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why setting version to zero?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was already the flow, I just updated how it stored

@Eslam-Nawara Eslam-Nawara marked this pull request as draft April 6, 2025 11:22
@Eslam-Nawara
Copy link
Contributor Author

blocked on threefoldtech/zosbase#16

@Eslam-Nawara Eslam-Nawara force-pushed the use-registrar-client branch 2 times, most recently from 0d23bba to 442bed7 Compare April 9, 2025 14:00
@Eslam-Nawara Eslam-Nawara requested a review from rawdaGastan April 9, 2025 15:39
@Eslam-Nawara Eslam-Nawara force-pushed the use-registrar-client branch 2 times, most recently from c378623 to 345e18c Compare April 10, 2025 14:13
@Eslam-Nawara Eslam-Nawara marked this pull request as ready for review April 10, 2025 14:51
@Eslam-Nawara Eslam-Nawara marked this pull request as draft April 10, 2025 14:51
@Eslam-Nawara Eslam-Nawara force-pushed the use-registrar-client branch from 345e18c to 0a0d2a0 Compare May 1, 2025 12:06
@Eslam-Nawara Eslam-Nawara force-pushed the use-registrar-client branch 2 times, most recently from 2a428a8 to 212bc90 Compare May 5, 2025 17:02
@Eslam-Nawara Eslam-Nawara force-pushed the use-registrar-client branch from 212bc90 to 4942d23 Compare May 5, 2025 17:03
@Eslam-Nawara Eslam-Nawara marked this pull request as ready for review May 6, 2025 08:31
@Eslam-Nawara Eslam-Nawara force-pushed the use-registrar-client branch from 7031a12 to 4725133 Compare May 6, 2025 09:39
@Eslam-Nawara Eslam-Nawara force-pushed the use-registrar-client branch from 4725133 to d813867 Compare May 6, 2025 09:55
@Eslam-Nawara Eslam-Nawara merged commit a07506c into main May 6, 2025
25 checks passed
@Eslam-Nawara Eslam-Nawara deleted the use-registrar-client branch May 6, 2025 10:25
Eslam-Nawara added a commit that referenced this pull request May 6, 2025
Eslam-Nawara added a commit that referenced this pull request May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants