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 connection spec draft #247

Merged
merged 19 commits into from
Dec 4, 2023
Merged

Add connection spec draft #247

merged 19 commits into from
Dec 4, 2023

Conversation

Jarema
Copy link
Member

@Jarema Jarema commented Oct 16, 2023

This PR uses the more holistic approach to describe NATS features and server-client interactions.

It is not complete description for Connection, rather a work in progress, focused on tls_first, as this needed spec.

Signed-off-by: Tomasz Pietrek [email protected]

Copy link
Contributor

@ripienaar ripienaar left a comment

Choose a reason for hiding this comment

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

bunch of comments, great to see this doc being made!

spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved

### Error Handling (TODO)

Server can respond with `Authorization Error`.
Copy link
Contributor

Choose a reason for hiding this comment

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

discuss the specific way in which this is handled - if it terminates retries or not

spec/connection.md Outdated Show resolved Hide resolved
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

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

Some typos, etc.. but overall a good start. The section specific to "TLS first" looks good to me.

spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved
### Servers discovery

When Server sends back [INFO][INFO]. It may contain additional URLs to which the client can make connection attempts.
The client should store those URLs and use them in the Reconnection Strategy.
Copy link
Member

Choose a reason for hiding this comment

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

True, but again only if clients are sending "protocol: 1" (or above) in the CONNECT protocol.

spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved
@Jarema
Copy link
Member Author

Jarema commented Oct 17, 2023

@kozlovic addressed / responded to all comments.

Thanks for a thorough review!

@Jarema Jarema requested a review from kozlovic October 17, 2023 08:59
spec/connection.md Outdated Show resolved Hide resolved
spec/connection.md Outdated Show resolved Hide resolved
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

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

Sorry, I was not subscribed and did not receive notifications that the PR was updated. LGTM!

@Jarema Jarema marked this pull request as ready for review November 1, 2023 17:41
Copy link
Contributor

@ripienaar ripienaar left a comment

Choose a reason for hiding this comment

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

some more comments

README.md Show resolved Hide resolved

|Revision|Date|Author|Info|
|--------|----|------|----|
|1 |2023-10-12|@author|Initial draft|
Copy link
Contributor

Choose a reason for hiding this comment

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

formatting and extra spaces here, @author is also wrong

spec/connection.md Outdated Show resolved Hide resolved

When the client detects disconnection, it starts to reconnect attempts with the following rules:
1. Immediate reconnect attempt
The client attempts to reconnect immediately after finding out it has been disconnected.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this really be 2 lines? Or maybe a leading - is missing looking at other lines here

adr/ADR-40.md Outdated
| Date | 2023-10-12 |
| Author | @Jarema |
| Status | Implemented |
| Tags | spec |
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd keep the client, server here, so it shows up in those sections also for people to find. It's not just a spec, its related to multiple things?

Copy link
Contributor

Choose a reason for hiding this comment

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

Think you should also run go run main.go > README.md

Jarema added 17 commits December 4, 2023 14:03
Signed-off-by: Tomasz Pietrek <[email protected]>
Signed-off-by: Tomasz Pietrek <[email protected]>
Signed-off-by: Tomasz Pietrek <[email protected]>
Signed-off-by: Tomasz Pietrek <[email protected]>
Signed-off-by: Tomasz Pietrek <[email protected]>
Signed-off-by: Tomasz Pietrek <[email protected]>
Signed-off-by: Tomasz Pietrek <[email protected]>
Signed-off-by: Tomasz Pietrek <[email protected]>
Signed-off-by: Tomasz Pietrek <[email protected]>
Signed-off-by: Tomasz Pietrek <[email protected]>
Signed-off-by: Tomasz Pietrek <[email protected]>
@Jarema Jarema force-pushed the add-connection-spec branch from 2bc5792 to 1ff325c Compare December 4, 2023 13:10
README.md Outdated
|[ADR-8](adr/ADR-8.md)|jetstream, client, kv, spec|JetStream based Key-Value Stores|
|[ADR-32](adr/ADR-32.md)|client, spec|Service API|
|[ADR-37](adr/ADR-37.md)|jetstream, client, spec|JetStream Simplification|
|[ADR-40](adr/ADR-40.md)|spec|NATS Connection|
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

Copy link
Contributor

@ripienaar ripienaar left a comment

Choose a reason for hiding this comment

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

LGTM

@Jarema Jarema merged commit fa453ea into main Dec 4, 2023
1 check passed
@Kazmirchuk
Copy link

wow ADR-40 is a really valuable addition! if I may chip in with 5c : it would be nice to describe how NATS "Core" requests and higher-level functions like JS Fetch, Consume, KV Get and Watch etc behave in case of:

  • reconnection process started
  • connection lost (terminal)
  • connection closed (by a user)

I managed to find out some of this info from nats.go unit tests, but not everything... so ended up writing my own summary :D

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.

6 participants