InfluxElixir.Client.Local.DatabaseRules (InfluxElixir v0.1.35)

Copy Markdown View Source

InfluxDB 3's rules for database names and counts, as Client.Local applies them to create_database/3, to a write that creates its database and to start/1 (all verified against InfluxDB 3 Core).

A name is checked in the engine's order, each failure a 400 with the engine's JSON body:

  1. empty — db name cannot be empty
  2. not starting with an ASCII letter or digit — db name did not start with a number or letter
  3. any character other than ASCII letters, digits, _, - and / — invalid character in database or rp name: ...
  4. a / that does not split the name into two non-empty parts (<db>/<rp>, InfluxDB 1's retention policy) — db name with invalid retention policy, ...

There is no length limit. InfluxDB 3 Core holds at most 5 databases besides _internal; a sixth is a 422, whether created or written to. The limit is applied to the :v3_core profile only — Enterprise's was not verified.

Summary

Functions

Checks a database that is about to be created — by create_database/3 or by a write — for a store that already holds existing. A database that already exists passes whatever the limit.

Checks the databases Client.Local.start/1 pre-creates, raising ArgumentError with the engine's message for the first one it would refuse: a test that cannot run against the server should not pass against the double.

The engine's own database: listed, never created, written or dropped.

Functions

check_new(name, existing, profile)

@spec check_new(binary(), Enumerable.t(binary()), atom()) :: :ok | {:error, map()}

Checks a database that is about to be created — by create_database/3 or by a write — for a store that already holds existing. A database that already exists passes whatever the limit.

check_start!(names, profile)

@spec check_start!([binary()], atom()) :: :ok

Checks the databases Client.Local.start/1 pre-creates, raising ArgumentError with the engine's message for the first one it would refuse: a test that cannot run against the server should not pass against the double.

internal()

@spec internal() :: binary()

The engine's own database: listed, never created, written or dropped.