-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from zvkemp/readme-update
Readme update
- Loading branch information
Showing
36 changed files
with
81 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
sudo: false | ||
language: ruby | ||
services: docker | ||
rvm: | ||
- 2.3.3 | ||
before_install: gem install bundler -v 1.14.6 | ||
- 2.4.1 | ||
before_install: | ||
- gem install bundler | ||
- docker-compose up --build -d | ||
env: | ||
- PHOENIX_HOST=localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ set -vx | |
bundle install | ||
|
||
# Do any other automated setup that you need to do here | ||
docker-compose build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
phoenix: | ||
build: spec_example | ||
build: phoenix_example | ||
ports: | ||
- "4000:4000" | ||
command: mix phx.server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
require 'mutex_m' | ||
module Phoenix | ||
class Inbox | ||
# Read it or forget it | ||
|
||
include Mutex_m | ||
attr_reader :ttl, :data | ||
def initialize(ttl:) | ||
@ttl = ttl | ||
@bucket = Time.now.to_i / ttl | ||
@data = Hash.new { |h, k| h[k] = {} } | ||
super() | ||
end | ||
|
||
def push(key, val) | ||
synchronize do | ||
ts = current_timestamp | ||
(data[ts][key] = val).tap do | ||
if data.keys.size >= 3 | ||
data.delete_if { |key, _| key < (ts - 1) } | ||
end | ||
end | ||
end | ||
end | ||
|
||
alias_method :[]=, :push | ||
|
||
def pop(key) | ||
synchronize do | ||
ts = current_timestamp | ||
data[ts - 1].delete(key) { data[ts].delete(key) { yield }} | ||
end | ||
end | ||
|
||
alias_method :delete, :pop | ||
|
||
def key?(key) | ||
data.values.any? { |v| v.key?(key) } | ||
end | ||
|
||
def current_timestamp | ||
Time.now.to_i / ttl | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
defmodule SpecExampleWeb.Endpoint do | ||
use Phoenix.Endpoint, otp_app: :spec_example | ||
|
||
socket "/socket", SpecExampleWeb.UserSocket | ||
end |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.