Comments (4)
I added support for this, however, the callback function arguments are reversed as: handle_join(Group :: any(), Pid :: pid()) -> any()
. The other difference is that currently the join and leave callbacks will be called for anything that causes the pid to join or leave. Instead of having separate callbacks for separate reasons, I would rather add a Reason argument to differentiate between: join_local
, join_remote
, leave_local
, leave_remote
, and exit
(I could probably add the reason for the exit too). The additional Reason argument could be optional.
from cpg.
I like the reason argument approach.
from cpg.
I added the reason argument, so that the callback can be either: handle_join(Group :: any(), Pid :: pid()) -> any()
or handle_join(Group :: any(), Pid :: pid(), join_local | join_remote | {exit, any()}) -> any()
as shown in the cpg:callback_join()
type (with the same equivalent for leave). The join_local
or join_remote
difference shows where the join is originating from (so the pid may still be a local pid with a join_remote
if the state is being updated from a remote node and relates to a local pid (not common, but a possible edge-case)). The other thing to keep in-mind is that the callback is called for each instance of the Pid in the Group, so if you join the same pid multiple times, the callback will be called the same number of times.
from cpg.
There was also a bug previously with the node monitoring, but that has been fixed (it was from a feature that was recently added in the v1.3.1.1
tag) and the code has been tagged. The new tag is v1.3.1.3
.
from cpg.
Related Issues (10)
- cpg_data module has get_remote_members() and get_local_members() argument order problem
- Subscribing to callbacks twice? HOT 3
- Does not compile with Elixir 1.7 and OTP 21 HOT 1
- Make GROUP_STORAGE macro an app env setting HOT 1
- Fails to Compile on Elixir 1.1 / Erlang R18.1 HOT 2
- cpg registered processes crash VM when killed. HOT 2
- Cannot get it working? HOT 6
- cpg doesn't gracefully handle upgrading between versions HOT 1
- mix.exs and rebar.config out of sync HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpg.