Instream v0.20.0 Instream.Connection behaviour View Source
Connection (pool) definition.
All database connections will be made using a user-defined extension of this module.
Example Module
defmodule MyConnection do
use Instream.Connection, otp_app: :my_application
end
Example Configuration
config :my_application, MyConnection,
auth: [ method: :basic, username: "root", password: "root" ]
host: "influxdb.example.com",
http_opts: [ insecure: true, proxy: "http://company.proxy" ],
loggers: [{ LogModule, :log_fun, [ :additional, :args ] }],
pool: [ max_overflow: 10, size: 5 ],
port: 8086,
scheme: "http"
Link to this section Summary
Callbacks
Sends a log entry to all configured loggers.
Returns a supervisable connection child_spec.
Returns the connection configuration.
Executes a query.
Pings a server.
Executes a reading query.
Checks the status of a connection.
Determines the version of an InfluxDB host.
Executes a writing query.
Link to this section Types
log_entry()
View Source
log_entry() ::
Instream.Log.PingEntry.t()
| Instream.Log.QueryEntry.t()
| Instream.Log.StatusEntry.t()
| Instream.Log.WriteEntry.t()
log_entry() :: Instream.Log.PingEntry.t() | Instream.Log.QueryEntry.t() | Instream.Log.StatusEntry.t() | Instream.Log.WriteEntry.t()
query_type()
View Source
query_type() :: Instream.Query.Builder.t() | Instream.Query.t() | String.t()
query_type() :: Instream.Query.Builder.t() | Instream.Query.t() | String.t()
Link to this section Callbacks
__log__(log_entry) View Source
Sends a log entry to all configured loggers.
child_spec(_ignored)
View Source
child_spec(_ignored :: term()) :: Supervisor.Spec.spec()
child_spec(_ignored :: term()) :: Supervisor.Spec.spec()
Returns a supervisable connection child_spec.
config(keys) View Source
Returns the connection configuration.
execute(query, opts)
View Source
execute(query :: query_type(), opts :: Keyword.t()) :: any()
execute(query :: query_type(), opts :: Keyword.t()) :: any()
Executes a query.
Passing [async: true]
in the options always returns :ok.
The command will be executed asynchronously.
ping(host, opts) View Source
Pings a server.
By default the first server in your connection configuration will be pinged.
The server passed does not necessarily need to belong to your connection. Only the connection details (scheme, port, ...) will be used to determine the exact url to send the ping request to.
query(query, opts) View Source
Executes a reading query.
Options:
method
: whether to use a "GET" or "POST" request (as atom)precision
: seeInstream.Encoder.Precision
for available values
See Instream.Connection.execute/2
for additional generic options.
status(opts)
View Source
status(opts :: Keyword.t()) :: :ok | :error
status(opts :: Keyword.t()) :: :ok | :error
Checks the status of a connection.
version(host, opts) View Source
Determines the version of an InfluxDB host.
The version will be retrieved using a :ping
query and extract the returned
X-Influxdb-Version
header. If the header is missing the version will be
returned as "unknown"
.
write(payload, opts) View Source
Executes a writing query.
See Instream.Connection.execute/2
for additional generic options.