WorryFree Computers   »   [go: up one dir, main page]

Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The World is a Network (and We Are Just Nodes)

The World is a Network (and We Are Just Nodes)

Slides for my Gig City Elixir 2024 talk.

Andrea Leopardi

May 11, 2024
Tweet

More Decks by Andrea Leopardi

Other Decks in Programming

Transcript

  1. ref = make_ref() send(dest_pid, {ref, self(), msg}) receive do {^ref,

    response} -> # ... end receive do {ref, sender_pid, msg} -> response = act_on_message(msg) send(sender_pid, {ref, response}) end
  2. ref = make_ref() send(dest_pid, {ref, self(), msg}) receive do {^ref,

    response} -> # ... after 1000 -> :timeout end receive do {ref, sender_pid, msg} -> response = act_on_message(msg) send(sender_pid, {ref, response}) end
  3. :gen_tcp.send(socket, "Hello world") {:ok, data} = :gen_tcp.recv(socket, 0, _timeout =

    1000) {:ok, data} = :gen_tcp.recv(socket, 0) response = process_request(data) :gen_tcp.send(socket, response)
  4. :gen_tcp.send(socket, "Hello world") receive do {:tcp, ^socket, response} -> #

    ... after 1000 -> :timeout end receive do {:tcp, socket, data} -> response = process_request(data) :gen_tcp.send(socket, response) end
  5. RESTARTING A PROCESS IS ABOUT BRINGING IT BACK TO A

    STABLE, KNOWN STATE. FROM THERE, THINGS CAN BE RETRIED. WHEN THE INITIALIZATION ISN'T STABLE, SUPERVISION IS WORTH VERY LITTLE.
  6. - ERLANG BLOG POST ABOUT MESSAGE PASSING - MY BLOG

    POST ON TCP CONNECTIONS IN ELIXIR - MY BLOG POST ON GEN_STATEM CONNECTIONS - "IT'S ALL ABOUT THE GUARANTEES" BY FRED HEBERT - THOUSAND ISLANDS ELIXIR LIBRARY - END-TO-END ARGUMENTS IN SYSTEM DESIGN PAPER - BINARY PATTERN MATCHING REFERENCE