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

feat(daemon): Add TCP net layer #2060

Merged
merged 4 commits into from
Feb 14, 2024
Merged

feat(daemon): Add TCP net layer #2060

merged 4 commits into from
Feb 14, 2024

Conversation

kumavis
Copy link
Member

@kumavis kumavis commented Feb 13, 2024

  • breaks out SocketPowers from NetworkPowers
  • adds connectPort for tcp net layer to be utilized later

Ref: #1993

@kumavis kumavis force-pushed the daemon-first-net-layer branch from 36d58c0 to cb84421 Compare February 13, 2024 10:07
@kumavis kumavis changed the title Daemon: first net layer Daemon: TCP net layer Feb 13, 2024
@kumavis kumavis marked this pull request as ready for review February 13, 2024 18:59
@kumavis kumavis requested a review from kriskowal February 13, 2024 19:48
Copy link
Contributor

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

LGTM

@rekmarks rekmarks changed the title Daemon: TCP net layer feat(daemon): Add TCP net layer Feb 14, 2024
@rekmarks rekmarks merged commit 7c303a1 into endo Feb 14, 2024
14 checks passed
@rekmarks rekmarks deleted the daemon-first-net-layer branch February 14, 2024 00:26
@dckc
Copy link
Contributor

dckc commented Apr 9, 2024

I gather this is progress on #1828 too.

@dckc
Copy link
Contributor

dckc commented Apr 9, 2024

I'm interested to try this out. How is it used? Are there relevant tests?

@kriskowal
Copy link
Member

Relevant tests

test('read remote value', async t => {
const { locator: locatorA, cancelled: cancelledA } = await prepareLocator(t);
const { locator: locatorB, cancelled: cancelledB } = await prepareLocator(t);
const hostA = await makeHostWithTestNetwork(locatorA, cancelledA);
const hostB = await makeHostWithTestNetwork(locatorB, cancelledB);
// introduce nodes to each other
await E(hostA).addPeerInfo(await E(hostB).getPeerInfo());
await E(hostB).addPeerInfo(await E(hostA).getPeerInfo());
// create value to share
await E(hostB).evaluate('MAIN', '"hello, world!"', [], [], 'salutations');
const hostBValueIdentifier = await E(hostB).identify('salutations');
// insert in hostA out of band
await E(hostA).write(['greetings'], hostBValueIdentifier);
const hostAValue = await E(hostA).lookup('greetings');
t.is(hostAValue, 'hello, world!');
});
test('locate local value', async t => {
const { cancelled, locator } = await prepareLocator(t);
const { host } = await makeHost(locator, cancelled);
const ten = await E(host).evaluate('MAIN', '10', [], [], 'ten');
t.is(ten, 10);
const tenLocator = await E(host).locate('ten');
const parsedLocator = parseLocator(tenLocator);
t.is(parsedLocator.formulaType, 'eval');
});
test('locate local persisted value', async t => {
const { cancelled, locator } = await prepareLocator(t);
{
const { host } = await makeHost(locator, cancelled);
const ten = await E(host).evaluate('MAIN', '10', [], [], 'ten');
t.is(ten, 10);
}
await restart(locator);
{
const { host } = await makeHost(locator, cancelled);
const tenLocator = await E(host).locate('ten');
const parsedLocator = parseLocator(tenLocator);
t.is(parsedLocator.formulaType, 'eval');
}
});
test('locate remote value', async t => {
const { locator: locatorA, cancelled: cancelledA } = await prepareLocator(t);
const { locator: locatorB, cancelled: cancelledB } = await prepareLocator(t);
const hostA = await makeHostWithTestNetwork(locatorA, cancelledA);
const hostB = await makeHostWithTestNetwork(locatorB, cancelledB);
// introduce nodes to each other
await E(hostA).addPeerInfo(await E(hostB).getPeerInfo());
await E(hostB).addPeerInfo(await E(hostA).getPeerInfo());
// create value to share
await E(hostB).evaluate('MAIN', '"hello, world!"', [], [], 'salutations');
const hostBValueIdentifier = await E(hostB).identify('salutations');
// insert in hostA out of band
await E(hostA).write(['greetings'], hostBValueIdentifier);
const greetingsLocator = await E(hostA).locate('greetings');
const parsedGreetingsLocator = parseLocator(greetingsLocator);
t.is(parsedGreetingsLocator.formulaType, 'remote');
});

However, it might be good to wait for my signal. We’ll have a user-level workflow for inviting peers to connect and message delivery between connected peers within a week. I’ll post an update at #1828, maybe even carve out the narrower issue we’ll hit with TCP.

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.

4 participants