dicon v0.2.0 Dicon.Executor behaviour

Behaviour for executors.

This behaviour specifies the callbacks that executors must implement. Look at the documentation for the Dicon module for more information about executors.

Summary

Functions

Connects to authority

Copies the source file on the local machine to the target on the remote machine on the connection in state

Executes the given command on the connection in state

Callbacks

Connects to the given authority, returning a term that identifies the connection

Copies the local file source over to the destination target on the given connection

Executes the given command on the given connection

Functions

connect(authority)

Connects to authority.

The connection happens through the executor configured in the configuration for the :dicon application; see the documentation for the Dicon module for more information.

Examples

%Dicon.Executor{} = Dicon.Executor.connect("meg:secret@example.com")
copy(state, source, target)

Copies the source file on the local machine to the target on the remote machine on the connection in state.

Examples

state = Dicon.Executor.connect("meg:secret@example.com")
Dicon.Executor.copy(state, "hello.txt", "uploaded-hello.txt")
#=> :ok
exec(state, command)

Executes the given command on the connection in state.

Examples

state = Dicon.Executor.connect("meg:secret@example.com")
Dicon.Executor.exec(state, "ls -la")
#=> :ok

Callbacks

connect(authority)

Specs

connect(authority :: binary) ::
  {:ok, identifier} |
  {:error, term}

Connects to the given authority, returning a term that identifies the connection.

copy(identifier, source, target)

Specs

copy(identifier, source :: char_list, target :: char_list) :: :ok

Copies the local file source over to the destination target on the given connection.

exec(identifier, command)

Specs

exec(identifier, command :: char_list) :: :ok

Executes the given command on the given connection.