API Reference electric v#1.2.4
View SourceModules
Simple admission control using ETS-based counters to limit concurrent requests per stack.
A GenServer that batches file/directory deletions by first moving them into a
per-stack trash directory and then, after a configurable interval, removing
the trash directory contents in one rm -rf operation.
Custom initialisation and reconnection logic for database connections.
A connection pool for managing multiple connections to a PostgreSQL database.
Intermediate supervisor that supervises the Connection.Manager and ConnectionResolver processes.
Gen server responsible for shutting down and restarting the connection subsystem.
The main connection supervisor that looks after Connection.Manager.
A supervisor that starts the core components of the Electric system. This is divided into two subsystems
Defines the structure and how to create the items in the log that the electric client reads.
A supervisor that starts and monitors the core components of the Electric system. It needs to be a separate supervisor from the CoreSupervisor because of the way the StatusMonitor works (see the rest_for_one comments below).
An implementation of PersistentKV that writes values serialised as JSON to the kv backend.
A plug that assists debugging by labelling processes that handle requests with details about the request.
A plug that extracts trace context from incoming HTTP headers and sets it as the parent span.
Utility functions for Electric endpoints, e.g. for parsing and validating path and query parameters.
Module for functions that configure Postgres in some way using a provided connection.
Utility module for splitting strings on a schema delimiter
This serves as a write-through cache for caching the namespace and tablename as they occur in PG.
A Postgres connection that is used to break an abandoned lock.
Encoding, decoding and helper functions for the pg_lsn type.
A client module for Postgres logical replication.
Conversion of incoming Postgres logical replication messages to internal change representation.
This module encapsulates the initial setup of a replication connection opened by
Electric.Postgres.ReplicationClient.
This module contains structs that are intermediate representation of Postgres and Satellite transactions.
Evaluation environment for parsing PostgreSQL expressions.
This module describes basic types, their categories, and if they are preferred within said category.
Information here is gathered from a system catalog pg_type, as described in
PG docs.
Postgres has explicit casts, achievable via ::type calls.
This module defines implementations for a subset of known ones.
"function name" column here is a function name in this module.
List of all implicit casts in (raw) PostgreSQL. Does not account for custom casts, which
are discouraged anyway. If needed, this list can be extended in Electric.Replication.Eval.Env.new/1
Parsed expression, available for evaluation using the runner
Special module to be use-d to define translation of PostgreSQL
operators and functions into Elixir calls.
Uniquely identifies an operation inside the shape log. Combines a transaction ID with operation ID.
Manages a PostgreSQL publication for a given Electric stack, tracking shapes and ensuring that the publication configuration matches the required set of relations that need to be published for the shapes to function correctly.
Configures and maintains a PostgreSQL publication on behalf of Electric.Replication.PublicationManager.RelationTracker.
Provides interface for shapes to register and deregister themselves from a publication, and tracks the overall set of relations that need to be published using reference counting.
Supervisor for the PublicationManager components.
Takes care of periodically reconciling the schema of the database with the inspector caches and active shapes.
When any txn comes from postgres, we need to store it into the log for this shape if and only if it has txid >= xmin of the snapshot.
A thing wrapper module around PureFileStorage that can be configured to raise an error after a certain number of writes.
Removes a shape (consumer, status entry, on-disk data and publication entry) on demand.
Keeps track of shape state.
Behaviour defining the ShapeStatus functions to be used in mocks
Owns the ETS table and the ShapeStatus state.
Behaviour defining the ShapeCache functions to be used in mocks
Responsible for managing shape consumer processes
Responsible for knowing which shapes are affected by a change.
Efficiently finds shapes that are affected by a change, specifically for a particular operation in where clause.
Efficiently finds shapes that are affected by a change when the shape's where clause has field = const in it.
Efficiently finds shapes that are affected by a change when the shape's where clause has array_field @> const_array in it.
Responsible for knowing which shapes are affected by a change to a specific table.
Tracks active uses of shapes, the number of readers (and their pids) and the active writer.
Keeps track of shapes defined on partitioned tables and re-writes transactions to send an equivalent change on the root partitioned table for every change to a partition of that table.
Struct describing the requested shape
Supervisor responsible for the entire shape subsystem.
Root supervisor that starts a stack of processes to serve shapes.
Times intervals between calls to start_interval/2. This is useful if you
want to find out which part of a process took the longest time. It works
out simpler than wrapping each part of the process in a timer, and
guarentees no gaps in the timings.
This module implements an API to cover parts of the code with tracing spans that are then exported using the OpenTelemetry protocol.
Decides which spans should be included and how often.
Application-wide process that initializes Erlang's system monitor and consumes monitoring events.
Module exporting functions for handling Postgres timelines. Verifies the Postgres ID and its timeline.
PostgreSQL interval representation.
This module parses alternative ISO-8601 duration strings into Interval structs.
This module parses ISO-8601 duration strings into Interval structs.
This module parses Postgres classic and SQL strings