Raxol.System.DeltaUpdaterSystemAdapterBehaviour behaviour (Raxol v0.4.0)
View SourceBehaviour for a system adapter used by DeltaUpdater.
This module defines the contract for functions that interact with the system, allowing for different implementations (e.g., a real one and a mock for tests).
Summary
Callbacks
Changes the mode of a file.
Mirrors File.chmod!/2
or File.chmod/2
.
Creates a directory, including any necessary parent directories.
Mirrors File.mkdir_p!/1
or File.mkdir_p/1
.
Removes a file or directory recursively.
Mirrors File.rm_rf!/1
or File.rm_rf/1
.
Performs an HTTP request.
Mirrors :httpc.request/4
or similar functionality.
method
is an atom e.g. :get
, :post
.
url_with_headers
is typically {charlist_url, list_of_headers}
.
http_options
and stream_options
are keyword lists or lists of tuples.
Gets the operating system type.
Mirrors :os.type/0
.
Gets the command-line arguments passed to the program.
Mirrors System.argv/0
.
Executes a system command.
Mirrors System.cmd/3
.
Options can include e.g. :stderr_to_stdout
.
Gets the value of an environment variable.
Mirrors System.get_env/1
.
Gets the path to the system's temporary directory.
Mirrors System.tmp_dir!/0
or System.tmp_dir/0
.
Replaces the current executable with a new one.
This abstracts the call to Raxol.System.Updater.do_replace_executable/3
.
Callbacks
Changes the mode of a file.
Mirrors File.chmod!/2
or File.chmod/2
.
Creates a directory, including any necessary parent directories.
Mirrors File.mkdir_p!/1
or File.mkdir_p/1
.
Removes a file or directory recursively.
Mirrors File.rm_rf!/1
or File.rm_rf/1
.
@callback httpc_request( method :: atom(), url_with_headers :: {charlist(), list()}, http_options :: Keyword.t() | list(), stream_options :: Keyword.t() | list() ) :: {:ok, {{http_version :: tuple(), status_code :: integer(), reason_phrase :: charlist()}, headers :: list(), body :: charlist() | binary()}} | {:ok, :saved_to_file} | {:error, reason :: any()}
Performs an HTTP request.
Mirrors :httpc.request/4
or similar functionality.
method
is an atom e.g. :get
, :post
.
url_with_headers
is typically {charlist_url, list_of_headers}
.
http_options
and stream_options
are keyword lists or lists of tuples.
Gets the operating system type.
Mirrors :os.type/0
.
@callback system_argv() :: [String.t()]
Gets the command-line arguments passed to the program.
Mirrors System.argv/0
.
@callback system_cmd( command :: String.t(), args :: [String.t()], options :: Keyword.t() ) :: {output :: String.t(), exit_status :: integer()}
Executes a system command.
Mirrors System.cmd/3
.
Options can include e.g. :stderr_to_stdout
.
Gets the value of an environment variable.
Mirrors System.get_env/1
.
Gets the path to the system's temporary directory.
Mirrors System.tmp_dir!/0
or System.tmp_dir/0
.
@callback updater_do_replace_executable( current_exe :: String.t(), new_exe :: String.t(), platform :: String.t() ) :: :ok | {:error, reason :: any()}
Replaces the current executable with a new one.
This abstracts the call to Raxol.System.Updater.do_replace_executable/3
.