Skip to content

Commit d4b9065

Browse files
committed
LCORE-4606: document the period format of the SQLite quota backend
The description of a limiter period points to the PostgreSQL interval syntax only. The SQLite storage takes the period as a modifier of the SQLite function datetime(), which accepts less: "7 days" works and "1 week" does not. The QuotaLimiterConfiguration docstring now says so in one sentence. The checked-in documents that carry the docstring get the same sentence. docs/devel_doc/openapi.json and docs/models/successful_responses.{json,md} are rebuilt by their make targets. docs/devel_doc/openapi.md, the three docs/user_doc/config files and the schema example in test_models_dumper.py are edited by hand, as no make target writes them. Checked: the description in the three JSON documents equals the one in the model schema, the Markdown documents contain it verbatim and the HTML matches its pandoc rendering.
1 parent d830644 commit d4b9065

9 files changed

Lines changed: 20 additions & 9 deletions

File tree

‎docs/devel_doc/openapi.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19416,7 +19416,7 @@
1941619416
"period"
1941719417
],
1941819418
"title": "QuotaLimiterConfiguration",
19419-
"description": "Configuration for one quota limiter.\n\nThere are three configuration options for each limiter:\n\n1. ``period`` is specified in a human-readable form, see\n https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT\n for all possible options. When the end of the period is reached, the\n quota is reset or increased.\n2. ``initial_quota`` is the value set at the beginning of the period.\n3. ``quota_increase`` is the value (if specified) used to increase the\n quota when the period is reached.\n\nThere are two basic use cases:\n\n1. When the quota needs to be reset to a specific value periodically (for\n example on a weekly or monthly basis), set ``initial_quota`` to the\n required value.\n2. When the quota needs to be increased by a specific value periodically\n (for example on a daily basis), set ``quota_increase``."
19419+
"description": "Configuration for one quota limiter.\n\nThere are three configuration options for each limiter:\n\n1. ``period`` is specified in a human-readable form, see\n https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT\n for all possible options. When the end of the period is reached, the\n quota is reset or increased. With the SQLite storage the period must be\n a modifier of the SQLite function ``datetime()`` that moves the time\n forward, for example ``7 days``; ``1 week`` is rejected.\n2. ``initial_quota`` is the value set at the beginning of the period.\n3. ``quota_increase`` is the value (if specified) used to increase the\n quota when the period is reached.\n\nThere are two basic use cases:\n\n1. When the quota needs to be reset to a specific value periodically (for\n example on a weekly or monthly basis), set ``initial_quota`` to the\n required value.\n2. When the quota needs to be increased by a specific value periodically\n (for example on a daily basis), set ``quota_increase``."
1942019420
},
1942119421
"QuotaSchedulerConfiguration": {
1942219422
"properties": {

‎docs/devel_doc/openapi.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8056,7 +8056,9 @@ There are three configuration options for each limiter:
80568056
1. ``period`` is specified in a human-readable form, see
80578057
https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT
80588058
for all possible options. When the end of the period is reached, the
8059-
quota is reset or increased.
8059+
quota is reset or increased. With the SQLite storage the period must be
8060+
a modifier of the SQLite function ``datetime()`` that moves the time
8061+
forward, for example ``7 days``; ``1 week`` is rejected.
80608062
2. ``initial_quota`` is the value set at the beginning of the period.
80618063
3. ``quota_increase`` is the value (if specified) used to increase the
80628064
quota when the period is reached.

‎docs/models/successful_responses.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4756,7 +4756,7 @@
47564756
},
47574757
"QuotaLimiterConfiguration": {
47584758
"additionalProperties": false,
4759-
"description": "Configuration for one quota limiter.\n\nThere are three configuration options for each limiter:\n\n1. ``period`` is specified in a human-readable form, see\n https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT\n for all possible options. When the end of the period is reached, the\n quota is reset or increased.\n2. ``initial_quota`` is the value set at the beginning of the period.\n3. ``quota_increase`` is the value (if specified) used to increase the\n quota when the period is reached.\n\nThere are two basic use cases:\n\n1. When the quota needs to be reset to a specific value periodically (for\n example on a weekly or monthly basis), set ``initial_quota`` to the\n required value.\n2. When the quota needs to be increased by a specific value periodically\n (for example on a daily basis), set ``quota_increase``.",
4759+
"description": "Configuration for one quota limiter.\n\nThere are three configuration options for each limiter:\n\n1. ``period`` is specified in a human-readable form, see\n https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT\n for all possible options. When the end of the period is reached, the\n quota is reset or increased. With the SQLite storage the period must be\n a modifier of the SQLite function ``datetime()`` that moves the time\n forward, for example ``7 days``; ``1 week`` is rejected.\n2. ``initial_quota`` is the value set at the beginning of the period.\n3. ``quota_increase`` is the value (if specified) used to increase the\n quota when the period is reached.\n\nThere are two basic use cases:\n\n1. When the quota needs to be reset to a specific value periodically (for\n example on a weekly or monthly basis), set ``initial_quota`` to the\n required value.\n2. When the quota needs to be increased by a specific value periodically\n (for example on a daily basis), set ``quota_increase``.",
47604760
"properties": {
47614761
"type": {
47624762
"description": "Quota limiter type, either user_limiter or cluster_limiter",

‎docs/models/successful_responses.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2059,7 +2059,9 @@ There are three configuration options for each limiter:
20592059
1. ``period`` is specified in a human-readable form, see
20602060
https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT
20612061
for all possible options. When the end of the period is reached, the
2062-
quota is reset or increased.
2062+
quota is reset or increased. With the SQLite storage the period must be
2063+
a modifier of the SQLite function ``datetime()`` that moves the time
2064+
forward, for example ``7 days``; ``1 week`` is rejected.
20632065
2. ``initial_quota`` is the value set at the beginning of the period.
20642066
3. ``quota_increase`` is the value (if specified) used to increase the
20652067
quota when the period is reached.

‎docs/user_doc/config.html‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,10 @@ <h2 id="quotalimiterconfiguration">QuotaLimiterConfiguration</h2>
18861886
<li><code>period</code> is specified in a human-readable form, see
18871887
https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT
18881888
for all possible options. When the end of the period is reached, the
1889-
quota is reset or increased.</li>
1889+
quota is reset or increased. With the SQLite storage the period must be
1890+
a modifier of the SQLite function <code>datetime()</code> that moves the
1891+
time forward, for example <code>7 days</code>; <code>1 week</code> is
1892+
rejected.</li>
18901893
<li><code>initial_quota</code> is the value set at the beginning of the
18911894
period.</li>
18921895
<li><code>quota_increase</code> is the value (if specified) used to

‎docs/user_doc/config.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1645,7 +1645,7 @@
16451645
},
16461646
"QuotaLimiterConfiguration": {
16471647
"additionalProperties": false,
1648-
"description": "Configuration for one quota limiter.\n\nThere are three configuration options for each limiter:\n\n1. ``period`` is specified in a human-readable form, see\n https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT\n for all possible options. When the end of the period is reached, the\n quota is reset or increased.\n2. ``initial_quota`` is the value set at the beginning of the period.\n3. ``quota_increase`` is the value (if specified) used to increase the\n quota when the period is reached.\n\nThere are two basic use cases:\n\n1. When the quota needs to be reset to a specific value periodically (for\n example on a weekly or monthly basis), set ``initial_quota`` to the\n required value.\n2. When the quota needs to be increased by a specific value periodically\n (for example on a daily basis), set ``quota_increase``.",
1648+
"description": "Configuration for one quota limiter.\n\nThere are three configuration options for each limiter:\n\n1. ``period`` is specified in a human-readable form, see\n https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT\n for all possible options. When the end of the period is reached, the\n quota is reset or increased. With the SQLite storage the period must be\n a modifier of the SQLite function ``datetime()`` that moves the time\n forward, for example ``7 days``; ``1 week`` is rejected.\n2. ``initial_quota`` is the value set at the beginning of the period.\n3. ``quota_increase`` is the value (if specified) used to increase the\n quota when the period is reached.\n\nThere are two basic use cases:\n\n1. When the quota needs to be reset to a specific value periodically (for\n example on a weekly or monthly basis), set ``initial_quota`` to the\n required value.\n2. When the quota needs to be increased by a specific value periodically\n (for example on a daily basis), set ``quota_increase``.",
16491649
"properties": {
16501650
"type": {
16511651
"description": "Quota limiter type, either user_limiter or cluster_limiter",

‎docs/user_doc/config.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,9 @@ There are three configuration options for each limiter:
723723
1. ``period`` is specified in a human-readable form, see
724724
https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT
725725
for all possible options. When the end of the period is reached, the
726-
quota is reset or increased.
726+
quota is reset or increased. With the SQLite storage the period must be
727+
a modifier of the SQLite function ``datetime()`` that moves the time
728+
forward, for example ``7 days``; ``1 week`` is rejected.
727729
2. ``initial_quota`` is the value set at the beginning of the period.
728730
3. ``quota_increase`` is the value (if specified) used to increase the
729731
quota when the period is reached.

‎src/models/config.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2488,7 +2488,9 @@ class QuotaLimiterConfiguration(ConfigurationBase):
24882488
1. ``period`` is specified in a human-readable form, see
24892489
https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT
24902490
for all possible options. When the end of the period is reached, the
2491-
quota is reset or increased.
2491+
quota is reset or increased. With the SQLite storage the period must be
2492+
a modifier of the SQLite function ``datetime()`` that moves the time
2493+
forward, for example ``7 days``; ``1 week`` is rejected.
24922494
2. ``initial_quota`` is the value set at the beginning of the period.
24932495
3. ``quota_increase`` is the value (if specified) used to increase the
24942496
quota when the period is reached.

‎tests/unit/utils/dumpers/test_models_dumper.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6168,7 +6168,7 @@ def test_dump_models(tmpdir: Path) -> None:
61686168
},
61696169
"QuotaLimiterConfiguration": {
61706170
"additionalProperties": false,
6171-
"description": "Configuration for one quota limiter.\n\nThere are three configuration options for each limiter:\n\n1. ``period`` is specified in a human-readable form, see\n https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT\n for all possible options. When the end of the period is reached, the\n quota is reset or increased.\n2. ``initial_quota`` is the value set at the beginning of the period.\n3. ``quota_increase`` is the value (if specified) used to increase the\n quota when the period is reached.\n\nThere are two basic use cases:\n\n1. When the quota needs to be reset to a specific value periodically (for\n example on a weekly or monthly basis), set ``initial_quota`` to the\n required value.\n2. When the quota needs to be increased by a specific value periodically\n (for example on a daily basis), set ``quota_increase``.",
6171+
"description": "Configuration for one quota limiter.\n\nThere are three configuration options for each limiter:\n\n1. ``period`` is specified in a human-readable form, see\n https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT\n for all possible options. When the end of the period is reached, the\n quota is reset or increased. With the SQLite storage the period must be\n a modifier of the SQLite function ``datetime()`` that moves the time\n forward, for example ``7 days``; ``1 week`` is rejected.\n2. ``initial_quota`` is the value set at the beginning of the period.\n3. ``quota_increase`` is the value (if specified) used to increase the\n quota when the period is reached.\n\nThere are two basic use cases:\n\n1. When the quota needs to be reset to a specific value periodically (for\n example on a weekly or monthly basis), set ``initial_quota`` to the\n required value.\n2. When the quota needs to be increased by a specific value periodically\n (for example on a daily basis), set ``quota_increase``.",
61726172
"properties": {
61736173
"type": {
61746174
"description": "Quota limiter type, either user_limiter or cluster_limiter",

0 commit comments

Comments
 (0)