LiveDebugger.Services.TraceService (LiveDebugger v0.1.4)
View SourceThis module provides functions that manages traces in the debugged application via ETS. Created table is an ordered_set with non-positive integer keys.
Summary
Functions
Deletes all traces for the given table id and CID or PID.
Returns the ETS table id for the given socket id.
Returns all existing traces for the given table id.
Returns existing traces for the given table id and CID or PID.
It returns up to limit
traces.
Gets a trace from the ETS table by its id.
Inserts a new trace into the ETS table.
Initializes an ETS table with the given id if it doesn't exist.
Creates the id of next tuple based on the first tuple in the ETS table. We need to store traces in this table in descending order. To achieve this table is implemented as ordered_set with non-positive integer keys. Because of that the element with the smallest key is the first element in the table.
Functions
@spec clear_traces(atom(), pid() | LiveDebugger.CommonTypes.cid()) :: true
Deletes all traces for the given table id and CID or PID.
@spec ets_table_id(String.t()) :: :ets.table()
Returns the ETS table id for the given socket id.
@spec existing_traces(atom()) :: [LiveDebugger.Structs.Trace.t()]
Returns all existing traces for the given table id.
@spec existing_traces(atom(), pid() | LiveDebugger.CommonTypes.cid(), pos_integer()) :: [ LiveDebugger.Structs.Trace.t() ]
Returns existing traces for the given table id and CID or PID.
It returns up to limit
traces.
@spec get(:ets.table(), integer()) :: LiveDebugger.Structs.Trace.t() | nil
Gets a trace from the ETS table by its id.
@spec insert(:ets.table(), integer(), LiveDebugger.Structs.Trace.t()) :: true
Inserts a new trace into the ETS table.
@spec maybe_init_ets(:ets.table()) :: :ets.table()
Initializes an ETS table with the given id if it doesn't exist.
@spec next_tuple_id(:ets.table()) :: integer()
Creates the id of next tuple based on the first tuple in the ETS table. We need to store traces in this table in descending order. To achieve this table is implemented as ordered_set with non-positive integer keys. Because of that the element with the smallest key is the first element in the table.