Flame – rethinking serverless

  @doc false
  def __open__(%File.Stream{path: path, node: node}, modes) when node == node() do
    :file.open(path, modes)
  end

  @doc false
  def __open__(%File.Stream{path: path, node: node}, modes) do
    :erpc.call(node, :file_io_server, :start, [self(), path, List.delete(modes, :raw)])
  end

Alright, the node is stored in the stream struct and the file stream implementation will just ask the right node to do the work.

Indeed this is so simple and Just Works™ :smiley:

6 Likes