Skip to content
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

Add probe state machine #111

Merged
merged 2 commits into from
Sep 1, 2023
Merged

Add probe state machine #111

merged 2 commits into from
Sep 1, 2023

Conversation

iand
Copy link
Contributor

@iand iand commented Aug 31, 2023

This adds the initial state machine for running regular connectivity checks against nodes in the routing table. Scoring of useful nodes is not included and is to be added in a later change.

Part of #45

@iand
Copy link
Contributor Author

iand commented Aug 31, 2023

See also iand/zikade#3

routing/probe.go Outdated
Comment on lines 113 to 116
Clock: clock.New(), // use standard time
Concurrency: 3,
Timeout: time.Minute,
CheckInterval: 6 * time.Hour,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Clock: clock.New(), // use standard time
Concurrency: 3,
Timeout: time.Minute,
CheckInterval: 6 * time.Hour,
Clock: clock.New(), // use standard time
Concurrency: 3, // MAGIC
Timeout: time.Minute, // MAGIC
CheckInterval: 6 * time.Hour, // MAGIC

Copy link
Contributor

Choose a reason for hiding this comment

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

Jorropo suggested this to mark values we pulled out of thin air

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

routing/probe.go Outdated
func (u unaddressedNodeInfo[K, A]) ID() kad.NodeID[K] { return u.NodeID }
func (u unaddressedNodeInfo[K, A]) Addresses() []A { return nil }

// ProbeState is the state of a probe.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// ProbeState is the state of a probe.
// ProbeState is the state of the [Probe] state machine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

cfg.CheckInterval = -1
require.Error(t, cfg.Validate())
})
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, all the above require could be assert's


nv2 := &nodeValue[key.Key8]{
NodeID: kadtest.NewID(key.Key8(4)),
NextCheckDue: clk.Now().Add(-time.Minute),
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth enforcing that even if nv2.NextCheckDue is after nv1.NextCheckDue the value will be replaced. So that we're not clever in that regard.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@iand iand merged commit 286ab4c into main Sep 1, 2023
@iand iand deleted the sm-probe branch September 1, 2023 13:09
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