View Source ExTerm.Console.Helpers (ex_term v0.2.0)

Contains macros which help write concise code for ExTerm.Console access.

Link to this section Summary

Functions

creates a function that is tagged as an access function.

creates a function that is tagged as a mutation.

wraps code into a single execution unit that are run on the same node.

Link to this section Functions

Link to this macro

defaccess(arg, list)

View Source (macro)

creates a function that is tagged as an access function.

The associated console must be the first argument in the arguments list. Generally, if you use the ExTerm.Console functions you won't need to use this macro, but if you want to write your own primitives that wrap :ets access functions, you should write the function using this macro.

If the application environment variable :ex_term, :check_transaction is set, and the function is not inside of a transaction, it will raise with an error.

If you're developing exterm backends, you should have this environment variable set at a minimum in dev and test environments.

Link to this macro

defmutate(arg, list)

View Source (macro)

creates a function that is tagged as a mutation.

The associated console must be the first argument in the arguments list. Generally, if you use the ExTerm.Console functions you won't need to use this macro, but if you want to write your own primitives that wrap :ets mutation functions, you should write the function using this macro.

If the application environment variable :ex_term, :check_transaction is set, and the function is not inside of a transaction, it will raise with an error.

If you're developing exterm backends, you should have this environment variable set at a minimum in dev and test environments.

Link to this macro

transaction(console, type, list)

View Source (macro)

wraps code into a single execution unit that are run on the same node.

note that there are two types: :mutate and :access types. all code in :mutate is guaranteed to be truly transactional with respect to the ets table with respect to other code guarded by this transaction macro. code bundled in the :access type is not guaranteed to be transactional with respect to the ets table.

For mutations, this also dispatches the update function based on the lambda stored in the ExTerm.Console table.