Skip to content
This repository was archived by the owner on Jan 29, 2019. It is now read-only.

[WIP] Introduce Firenest.ReplicatedState #21

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e49ceab
Introduce Firenest.PG
michalmuskala May 14, 2018
aac1383
Remove race condition from PG.multicall
michalmuskala May 14, 2018
32ea17f
Implement basic local tracking
michalmuskala May 15, 2018
87ebdc8
More basic functions for local tracker
michalmuskala May 16, 2018
46051ca
All local elements of PG work correctly
michalmuskala May 16, 2018
fb5b530
Fix start_supervised! only in 1.7
michalmuskala May 16, 2018
d5efd6e
formatter
michalmuskala May 16, 2018
6d9ff1a
Add specs to pg
michalmuskala May 16, 2018
e46a07f
Fix bug in SyncedServer where hello was not always sent
michalmuskala Jun 6, 2018
ab0bea3
Add handshake_data callback to SyncedServer
michalmuskala Jun 7, 2018
84dbf51
First implementation of remote data transfer for PG
michalmuskala Jun 11, 2018
c474be8
Remove key from PG
michalmuskala Jun 11, 2018
d9e2b61
Add up/down/up test to PG
michalmuskala Jun 12, 2018
53890e9
Rename PG to ReplicatedState
michalmuskala Jun 12, 2018
0421ca9
Docs for the replicated state server
michalmuskala Jun 12, 2018
ccd107c
Doc updates
michalmuskala Jun 12, 2018
2b333d9
Update docs for ReplicatedState
michalmuskala Jun 13, 2018
6e9b92c
Change how deleyed_update and delete work
michalmuskala Jun 13, 2018
5ff41b7
Local replicated state tests
michalmuskala Aug 7, 2018
94aa7cb
Initial delta returned again in init/1
michalmuskala Aug 8, 2018
cb87326
Move ReplicatedState.Server to its own file
michalmuskala Aug 8, 2018
935373a
wip
michalmuskala Oct 30, 2018
7461cd9
Extract handler code from ReplicatedState.Server
michalmuskala Nov 5, 2018
bfc0218
wip remote replicated state
michalmuskala Nov 5, 2018
0182baf
First remote implementation for replicatedstate
michalmuskala Nov 12, 2018
9352787
Properly handle broadcasts in remote server
michalmuskala Nov 12, 2018
055b900
Fix tests
michalmuskala Nov 12, 2018
b87a6ff
Formatter and remove old code
michalmuskala Nov 13, 2018
906e6d9
Add ReplicatedState.Store tests
michalmuskala Nov 14, 2018
451ef3e
Move remote changes to handler return
michalmuskala Nov 15, 2018
c75d98a
Poor man's bounded queue for last deltas in remote
michalmuskala Nov 15, 2018
61792d4
Some remote unit tests
michalmuskala Nov 16, 2018
3270773
Update replicated state docs
michalmuskala Nov 21, 2018
853e808
Refactor ReplicatedState.multicall
michalmuskala Nov 21, 2018
6741955
Address code review feedback
michalmuskala Nov 21, 2018
37f8df4
More tests for ReplicatedState.Remote
michalmuskala Nov 23, 2018
802bcf9
Distributed tests for ReplicatedState
michalmuskala Nov 23, 2018
445b771
Don't pass funs between processes
michalmuskala Nov 23, 2018
68710f6
Format & minor refactor
michalmuskala Nov 23, 2018
1c8ef25
Documentation typos
michalmuskala Nov 23, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions lib/firenest/pub_sub.ex
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ defmodule Firenest.PubSub do
end

@doc """
Returns a child specifiction for pubsub with the given `options`.
Returns a child specification for pubsub with the given `options`.

The `:name` and `:topology` keys are required as part of `options`.
`:name` refers to the name of the pubsub to be started and `:topology`
Expand Down Expand Up @@ -119,7 +119,7 @@ defmodule Firenest.PubSub do
Broadcasts the given `message` on `topic` in `pubsub`.

Returns `:ok` or `{:error, reason}` in case of failures in
the distributed brodcast.
the distributed broadcast.
"""
@spec broadcast(t, topic | [topic], term) :: :ok | {:error, term}
def broadcast(pubsub, topic, message) when is_atom(pubsub) do
Expand All @@ -135,7 +135,7 @@ defmodule Firenest.PubSub do
Broadcasts the given `message` on `topic` in `pubsub`.

Returns `:ok` or raises `Firenest.PubSub.BroadcastError` in case of
failures in the distributed brodcast.
failures in the distributed broadcast.
"""
@spec broadcast!(t, topic | [topic], term) :: :ok | no_return
def broadcast!(pubsub, topic, message) do
Expand All @@ -153,7 +153,7 @@ defmodule Firenest.PubSub do
are not delivered to the broadcasting process.

Returns `:ok` or `{:error, reason}` in case of failures in
the distributed brodcast.
the distributed broadcast.
"""
@spec broadcast_from(t, pid, topic | [topic], term) :: :ok | {:error, term()}
def broadcast_from(pubsub, pid, topic, message) when is_atom(pubsub) and is_pid(pid) do
Expand All @@ -173,7 +173,7 @@ defmodule Firenest.PubSub do
are not delivered to the broadcasting process.

Returns `:ok` or raises `Firenest.PubSub.BroadcastError` in case of
failures in the distributed brodcast.
failures in the distributed broadcast.
"""
@spec broadcast_from!(t, pid, topic | [topic], term) :: :ok | no_return
def broadcast_from!(pubsub, pid, topic, message) do
Expand Down Expand Up @@ -269,8 +269,7 @@ defmodule Firenest.PubSub.Supervisor do
end

def init({pubsub, topology, options}) do
partitions =
options[:partitions] || System.schedulers_online() |> Kernel./(4) |> Float.ceil() |> trunc()
partitions = options[:partitions] || ceil(System.schedulers_online() / 4)

Choose a reason for hiding this comment

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

Just came across this, cool project! Doesn't look like there has been much movement recently so I figured I'd just point out that the tests are failing due to this line, ceil/1 doesn't exist, perhaps you meant to leave it as Float.ceil/1.


{module, function} = options[:dispatcher] || {Firenest.PubSub.Dispatcher, :dispatch}

Expand Down
Loading