Browse Source

Move quickstart to README.

Also, update (C) dates.
Roberto Ostinelli 3 years ago
parent
commit
2b6927d68d

+ 1 - 1
LICENSE.md

@@ -1,6 +1,6 @@
 MIT License
 MIT License
 
 
-Copyright (c) 2015-2021 Roberto Ostinelli and Neato Robotics, Inc.
+Copyright (c) 2015-2022 Roberto Ostinelli and Neato Robotics, Inc.
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 93 - 5
README.md

@@ -64,7 +64,7 @@ Therefore, Availability has been chosen over Consistency and Syn implements
 
 
 ## Installation
 ## Installation
 
 
-### For Elixir
+#### Elixir
 Add it to your deps:
 Add it to your deps:
 
 
 ```elixir
 ```elixir
@@ -73,7 +73,7 @@ defp deps do
 end
 end
 ```
 ```
 
 
-### For Erlang
+#### Erlang
 If you're using [rebar3](https://github.com/erlang/rebar3), add `syn` as a dependency in your project's `rebar.config` file:
 If you're using [rebar3](https://github.com/erlang/rebar3), add `syn` as a dependency in your project's `rebar.config` file:
 
 
 ```erlang
 ```erlang
@@ -105,12 +105,100 @@ Ensure that `syn` is started with your application, for example by adding it in
 ]}.
 ]}.
 ```
 ```
 
 
+## Quickstart
+
+### Registry
+
+#### Elixir
+
+```elixir
+iex> :syn.add_node_to_scopes([:users])
+:ok
+iex> pid = self()
+#PID<0.105.0>
+iex> :syn.register(:users, "hedy", pid)
+:ok
+iex> :syn.lookup(:users, "hedy")
+{#PID<0.105.0>,:undefined}
+iex> :syn.register(:users, "hedy", pid, [city: "Milan"])
+:ok
+iex> :syn.lookup(:users, "hedy")
+{#PID<0.105.0>,[city: "Milan"]}
+iex> :syn.registry_count(:users)
+1
+```
+
+#### Erlang
+
+```erlang
+1> syn:add_node_to_scopes([users]).
+ok
+2> Pid = self().
+<0.93.0>
+3> syn:register(users, "hedy", Pid).
+ok
+4> syn:lookup(users, "hedy").
+{<0.93.0>,undefined}
+5> syn:register(users, "hedy", Pid, [{city, "Milan"}]).
+ok
+6> syn:lookup(users, "hedy").
+{<0.93.0>,[{city, "Milan"}]}
+7> syn:registry_count(users).
+1
+```
+
+### Process Groups
+
+#### Elixir
+
+```elixir
+iex> :syn.add_node_to_scopes([:users])
+:ok
+iex> pid = self()
+#PID<0.88.0>
+iex> :syn.join(:users, {:italy, :lombardy}, pid)
+:ok
+iex> :syn.members(:users, {:italy, :lombardy})
+[{#PID<0.88.0>,:undefined}]
+iex> :syn.is_member(:users, {:italy, :lombardy}, pid)
+true
+iex> :syn.publish(:users, {:italy, :lombardy}, "hello lombardy!")
+{:ok,1}
+iex> flush()
+Shell got "hello lombardy!"
+ok
+```
+
+#### Erlang
+
+```erlang
+1> syn:add_node_to_scopes([users]).
+ok
+2> Pid = self().
+<0.88.0>
+3> syn:join(users, {italy, lombardy}, Pid).
+ok
+4> syn:members(users, {italy, lombardy}).
+[{<0.88.0>,undefined}]
+5> syn:is_member(users, {italy, lombardy}, Pid).
+true
+6> syn:publish(users, {italy, lombardy}, "hello lombardy!").
+{ok,1}
+7> flush().
+Shell got "hello lombardy!"
+ok
+```
+
 ## Contributing
 ## Contributing
 So you want to contribute? That's great! Please follow the guidelines below. It will make it easier to get merged in.
 So you want to contribute? That's great! Please follow the guidelines below. It will make it easier to get merged in.
 
 
-Before implementing a new feature, please submit a ticket to discuss what you intend to do. Your feature might already be in the works, or an alternative implementation might have already been discussed.
+Before implementing a new feature, please submit a ticket to discuss what you intend to do. Your feature might
+already be in the works, or an alternative implementation might have already been discussed.
 
 
-Do not commit to master in your fork. Provide a clean branch without merge commits. Every pull request should have its own topic branch. In this way, every additional adjustments to the original pull request might be done easily, and squashed with `git rebase -i`. The updated branch will be visible in the same pull request, so there will be no need to open new pull requests when there are changes to be applied.
+Do not commit to master in your fork. Provide a clean branch without merge commits. Every pull request should have
+its own topic branch. In this way, every additional adjustments to the original pull request might be done easily,
+and squashed with `git rebase -i`. The updated branch will be visible in the same pull request, so there will be no need
+to open new pull requests when there are changes to be applied.
 
 
 Ensure that proper testing is included. To run Syn tests you simply have to be in the project's root directory and run:
 Ensure that proper testing is included. To run Syn tests you simply have to be in the project's root directory and run:
 
 
@@ -120,7 +208,7 @@ $ make test
 
 
 ## License
 ## License
 
 
-Copyright (c) 2015-2021 Roberto Ostinelli and Neato Robotics, Inc.
+Copyright (c) 2015-2022 Roberto Ostinelli and Neato Robotics, Inc.
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 1 - 75
src/syn.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2015-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2015-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal
@@ -48,80 +48,6 @@
 %% <li>An `error({invalid_remote_scope, Scope, RemoteNode})' if the Pid passed in as variable is running on a
 %% <li>An `error({invalid_remote_scope, Scope, RemoteNode})' if the Pid passed in as variable is running on a
 %% node that has not been added to the specified Scope, or if the remote scope process is temporarily down.</li>
 %% node that has not been added to the specified Scope, or if the remote scope process is temporarily down.</li>
 %% </ul>
 %% </ul>
-%%
-%% <h2>Quickstart</h2>
-%% <h3>Registry</h3>
-%% <h4>Elixir</h4>
-%% ```
-%% iex> :syn.add_node_to_scopes([:users])
-%% :ok
-%% iex> pid = self()
-%% #PID<0.105.0>
-%% iex> :syn.register(:users, "hedy", pid)
-%% :ok
-%% iex> :syn.lookup(:users, "hedy")
-%% {#PID<0.105.0>,:undefined}
-%% iex> :syn.register(:users, "hedy", pid, [city: "Milan"])
-%% :ok
-%% iex> :syn.lookup(:users, "hedy")
-%% {#PID<0.105.0>,[city: "Milan"]}
-%% iex> :syn.registry_count(:users)
-%% 1
-%% '''
-%% <h4>Erlang</h4>
-%% ```
-%% 1> syn:add_node_to_scopes([users]).
-%% ok
-%% 2> Pid = self().
-%% <0.93.0>
-%% 3> syn:register(users, "hedy", Pid).
-%% ok
-%% 4> syn:lookup(users, "hedy").
-%% {<0.93.0>,undefined}
-%% 5> syn:register(users, "hedy", Pid, [{city, "Milan"}]).
-%% ok
-%% 6> syn:lookup(users, "hedy").
-%% {<0.93.0>,[{city, "Milan"}]}
-%% 7> syn:registry_count(users).
-%% 1
-%% '''
-%% <h3>Process Groups</h3>
-%% <h4>Elixir</h4>
-%% ```
-%% iex> :syn.add_node_to_scopes([:users])
-%% :ok
-%% iex> pid = self()
-%% #PID<0.88.0>
-%% iex> :syn.join(:users, {:italy, :lombardy}, pid)
-%% :ok
-%% iex> :syn.members(:users, {:italy, :lombardy})
-%% [{#PID<0.88.0>,:undefined}]
-%% iex> :syn.is_member(:users, {:italy, :lombardy}, pid)
-%% true
-%% iex> :syn.publish(:users, {:italy, :lombardy}, "hello lombardy!")
-%% {:ok,1}
-%% iex> flush()
-%% Shell got "hello lombardy!"
-%% ok
-%% '''
-%% <h4>Erlang</h4>
-%% ```
-%% 1> syn:add_node_to_scopes([users]).
-%% ok
-%% 2> Pid = self().
-%% <0.88.0>
-%% 3> syn:join(users, {italy, lombardy}, Pid).
-%% ok
-%% 4> syn:members(users, {italy, lombardy}).
-%% [{<0.88.0>,undefined}]
-%% 5> syn:is_member(users, {italy, lombardy}, Pid).
-%% true
-%% 6> syn:publish(users, {italy, lombardy}, "hello lombardy!").
-%% {ok,1}
-%% 7> flush().
-%% Shell got "hello lombardy!"
-%% ok
-%% '''
 %% @end
 %% @end
 %% ===================================================================
 %% ===================================================================
 -module(syn).
 -module(syn).

+ 1 - 1
src/syn.hrl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2015-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2015-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
src/syn_app.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2015-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2015-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
src/syn_backbone.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2015-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2015-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
src/syn_event_handler.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2019-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2019-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Portions of code from Ulf Wiger's unsplit server module:
 %% Portions of code from Ulf Wiger's unsplit server module:
 %% <https://github.com/uwiger/unsplit/blob/master/src/unsplit_server.erl>
 %% <https://github.com/uwiger/unsplit/blob/master/src/unsplit_server.erl>

+ 1 - 1
src/syn_gen_scope.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2015-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2015-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
src/syn_pg.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2015-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2015-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
src/syn_registry.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2015-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2015-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
src/syn_scope_sup.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2015-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2015-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
src/syn_sup.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2015-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2015-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
test/syn_benchmark.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2019-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2019-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
test/syn_pg_SUITE.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2015-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2015-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
test/syn_registry_SUITE.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2015-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2015-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
test/syn_test_event_handler_callbacks.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2015-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2015-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
test/syn_test_event_handler_resolution.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2015-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2015-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
test/syn_test_gen_server.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2015-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2015-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
test/syn_test_suite_helper.erl

@@ -3,7 +3,7 @@
 %%
 %%
 %% The MIT License (MIT)
 %% The MIT License (MIT)
 %%
 %%
-%% Copyright (c) 2015-2021 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
+%% Copyright (c) 2015-2022 Roberto Ostinelli <roberto@ostinelli.net> and Neato Robotics, Inc.
 %%
 %%
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% Permission is hereby granted, free of charge, to any person obtaining a copy
 %% of this software and associated documentation files (the "Software"), to deal
 %% of this software and associated documentation files (the "Software"), to deal