Designing for Scalability with Erlang/OTP using Elixir – Part 2

Chapter 4

I am still working my way through this book.

The main difficulty that I am finding with chapter 4 is the scattered nature of the example code. It’s all small snippets, some of which references code in the previous chapter.

This is in addition to the Erlang => Elixir translations:

  • atom => :atom
  • VariableName => variable_name
  • moduleName => ModuleName

Some of the Elixir functions are reordered for consistency.

1> gen_server:start_link({local, timeout}, timeout, [], []).

1> c "Timeout.ex"
2> GenServer.start_link(Timeout, [], name: :timeout)
3>, {:sleep, 100})
4>, {:sleep, 5001})

The GenServer will by default timeout if a message takes more than 5 seconds to respond.

Samples for Chapter 4 have been pushed to with hash: cc8dd44

Chapter 5

The Erlang sys module can be reference from iex using :sys

The the log commands require atoms.

:sys.log(Frequency, :print)

:sys.log(Frequency, :get)

Now at hash: 830c1ea

Chapter 6

This is an odd chapter for Elixir as the Finite State Machine was considered defective and was not adapted as a wrapper. I am going to skip this chapter

Chapter 7

GenEvent has also been Deprecated

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s