Skip to content

Make network endpoint construction all look the same#3

Merged
chiroptical merged 1 commit into
mainfrom
unify_interface
May 28, 2026
Merged

Make network endpoint construction all look the same#3
chiroptical merged 1 commit into
mainfrom
unify_interface

Conversation

@chiroptical
Copy link
Copy Markdown
Owner

No description provided.

Comment thread src/network_endpoint.erl
wire:connect({?MODULE, Endpoint}, Wire).
```
""".
-callback connect(Endpoint :: pid(), Wire :: pid()) -> Reply :: term().
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Maybe connect/2 and on_connect/2 should just be one function?

It is easy to do this in the future if the separation becomes tedious.

Comment thread src/network_endpoint.erl
Comment on lines -28 to +73
-callback recieve(Endpoint :: pid(), Wire :: pid(), Msg :: binary()) -> ok.
-callback on_receive(Endpoint :: pid(), Wire :: pid(), Msg :: binary()) -> ok.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

🤣 spelling is hard

build/0,
connect_to/2,
send/3,
create/0,
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Just went for CRUD naming here.

gen_server:call(Endpoint, {disconnect, Wire}).

recieve(Endpoint, Wire, Msg) ->
gen_server:cast(Endpoint, {recieve, Wire, Msg}).
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Because I spelled this wrong it was fine, but receive is a reserved word in Erlang.

@chiroptical chiroptical merged commit ea49b71 into main May 28, 2026
1 check passed
@chiroptical chiroptical deleted the unify_interface branch May 28, 2026 02:18
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.

1 participant