Seely.Session (Seely v0.1.0) View Source
Sessions can be started as registered GenServer
s and can execute commands
via execute/2
and execute/4
or batch/2
.
The concept of sessions is rudimentary implemented. In further versions it will enable us to have more named and authorized sessions on a single server. Just like a web-server handles different sessions for authorized users/connections.
But for now, scaling isn't a topic.
Link to this section Summary
Functions
Execute a list of commands in a Stream
. Returns a list of ok/error Tuples.
One for each command.
Returns a specification to start this module under a supervisor.
Execute a (string) command in the given Seely.Session
identified by
the pid
.
Execute a function
in a controller
with the given params
in the
given Seely.Session
(pid
)
Start a session. Returns a Tuple of either {:ok, pid}
or {:error, reason}
Link to this section Functions
Execute a list of commands in a Stream
. Returns a list of ok/error Tuples.
One for each command.
Example
iex> {:ok, session} = start_session("test")
...> batch(session, ["echo hallo world", "echo --upper elixir rocks", "eh?"])
[
{:ok, "hello world"},
{:ok, "ELIXIR ROCKS"},
{:error, "no route found"}
]
Returns a specification to start this module under a supervisor.
See Supervisor
.
Execute a (string) command in the given Seely.Session
identified by
the pid
.
Execute a function
in a controller
with the given params
in the
given Seely.Session
(pid
)
Start a session. Returns a Tuple of either {:ok, pid}
or {:error, reason}