Skip to content

belfastelixir/DMS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DMS (Dead Man's Switch)

A simple OTP Application (and eventually an HTTP API) which enables short circuiting when a service becomes unavailable.

Used as a learning project for members of Belfast Elixir.

  • Build: mix do deps.get, compile
  • Test: mix test
  • Documentation: mix docs
  • REPL: iex -S mix
  • Observe: :observer.start

API Examples

# Ping will register service with that id as alive
id = "my-svc-id"
DMS.ping(id) # => :pong
DMS.alive?(id) # => true ~ Service with id responds as alive
# After @timeout period and no further pings
DMS.alive?(id) # => false ~ Service with id responds as dead
# An id which has never pinged will also respond as dead
false = DMS.alive?("another-svc-id") #=> false

Checklist

  • (#13) Model a Service as a Process (DMS.Service)
  • (#1) Register Service against an id (DMS.Servce.Registry)
  • (#2) Add a supervisor for Service Process (DMS.Service.Supervisor)
  • (#3) Add ping(id) function which will init Service if doesn't exist
  • (#4) Add alive?(id) function which returns true if service alive otherwise false
  • (#5) Add timer to service process which will terminate the process if it hasn't been pinged within @timeout
  • (#12) Add Documentation with ExDoc
  • (#6) Add Credo & Dialyzer for linting and static analysis.
  • (#7) Add API to set service as down (before timeout).
  • (#8) Enhance DMS.id to contain service id and account token + hash it before use as key in DMS.Servise.Registry.
  • (#9) Add HTTP API.
  • (#10) Add Pub/Sub push based API to notify when service is down.
  • (#11) Publish on HEX package manager.

About

Dead Man's Switch Elixir OTP Application

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages