-
Notifications
You must be signed in to change notification settings - Fork 22
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
Upgrade to Gun2.0 #58
Conversation
I don't have time to review this right now :(. |
Gun 2.0 is finally out so the original PR #55 can upgrade to it directly. Or I can do this based on #55 if @enjolras1205 don't mind. @zhongwencool Would you merge this and bump a new version on hex.pm? After reviews, off course. |
The original PR introduced some breaking changes. So I will add some changelogs if those changes are acceptable. |
src/eetcd.erl
Outdated
open(Name, Hosts, Transport, TransportOpts) -> | ||
open(Name, Hosts, [], Transport, TransportOpts). | ||
open(Name, Hosts, Transport, TcpOpts, TlsOpts) when is_atom(Transport) -> | ||
open(Name, Hosts, [], Transport, TcpOpts, TlsOpts). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combining TcpOpts
and TlsOpts
into a single function seems somewhat unusual.
TcpOpts
is associated with the transporttcp
TlsOpts
is associated with the transportssl
ortls
I think it is better to put Transport
and TransportOpts
into the eetcd Options
.
-spec open(Name, Hosts, Options) -> {ok, pid()} | {error, any()} when
Name :: name(),
Hosts :: [string()],
Options :: [ {mode, connect_all | random} |
{name, string()} |
{password, string()} |
{retry, non_neg_integer()} |
{retry_timeout, pos_integer()} |
{connect_timeout, timeout()}
{transport, tcp | ssl | tls} |
{tcp_opts, [gen_tcp:connect_option()]} |
{tls_opts, [ssl:tls_client_option()]}
].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regardless, this pull request will introduce a breaking change. I believe we can offer a simpler API in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I have tried to make this change, and it looks good.
These changes break the original API style, replace it with a simpler style: `eetcd:open(Name, Endopoints, Options)`.
Thanks a lot! |
Based on #55.
And fixes some var warnings in test suites.