feat(revisions): add pruning estimate and cleanup endpoints
CI / changes (push) Successful in 8s
CI / commitlint (push) Has been skipped
CI / openapi (push) Successful in 25s
CI / web (push) Successful in 32s
CI / go (push) Successful in 57s
CI / bird2 (push) Successful in 15s
CI / release (push) Successful in 3m18s
CI / changes (push) Successful in 8s
CI / commitlint (push) Has been skipped
CI / openapi (push) Successful in 25s
CI / web (push) Successful in 32s
CI / go (push) Successful in 57s
CI / bird2 (push) Successful in 15s
CI / release (push) Successful in 3m18s
Implemented new endpoints for estimating and pruning revisions, including detailed schemas for requests and responses. The `RevisionPruneEstimate` and `RevisionPruneResult` components were added to the OpenAPI documentation, enhancing the API's functionality for managing revision retention. Updated the backend to support these operations and integrated them into the tenant settings UI for improved user interaction.
This commit is contained in:
@@ -1212,6 +1212,70 @@ components:
|
||||
format: date-time
|
||||
additionalProperties: true
|
||||
|
||||
RevisionPruneEstimate:
|
||||
type: object
|
||||
required:
|
||||
- retention_minutes
|
||||
- cutoff_at
|
||||
- revision_count
|
||||
- prefix_row_count
|
||||
- orphan_snapshot_count
|
||||
- bytes_estimate
|
||||
properties:
|
||||
retention_minutes:
|
||||
type: integer
|
||||
minimum: 15
|
||||
maximum: 43200
|
||||
cutoff_at:
|
||||
type: string
|
||||
format: date-time
|
||||
revision_count:
|
||||
type: integer
|
||||
minimum: 0
|
||||
prefix_row_count:
|
||||
type: integer
|
||||
minimum: 0
|
||||
description: Строки prefix_snapshot_row в освобождаемых снимках.
|
||||
orphan_snapshot_count:
|
||||
type: integer
|
||||
minimum: 0
|
||||
bytes_estimate:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
description: Ориентировочный логический объём данных (байты).
|
||||
|
||||
RevisionPruneResult:
|
||||
type: object
|
||||
required:
|
||||
- deleted_revisions
|
||||
- deleted_prefix_snapshots
|
||||
- deleted_prefix_rows
|
||||
- bytes_estimate
|
||||
properties:
|
||||
deleted_revisions:
|
||||
type: integer
|
||||
minimum: 0
|
||||
deleted_prefix_snapshots:
|
||||
type: integer
|
||||
minimum: 0
|
||||
deleted_prefix_rows:
|
||||
type: integer
|
||||
minimum: 0
|
||||
bytes_estimate:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
|
||||
RevisionPruneRequest:
|
||||
type: object
|
||||
properties:
|
||||
retention_minutes:
|
||||
type: integer
|
||||
minimum: 15
|
||||
maximum: 43200
|
||||
description: TTL в минутах; если не задан — из revision_retention_minutes tenant settings.
|
||||
|
||||
PrefixSnapshotItem:
|
||||
type: object
|
||||
description: >
|
||||
@@ -2823,6 +2887,66 @@ paths:
|
||||
default:
|
||||
$ref: "#/components/responses/DefaultProblem"
|
||||
|
||||
/v1/revisions/prune-estimate:
|
||||
get:
|
||||
tags: [Revisions]
|
||||
summary: Оценка очистки ревизий по retention
|
||||
description: >
|
||||
Считает ревизии и ориентировочный объём данных, которые будут удалены при prune
|
||||
(те же правила, что applyRevisionRetention: последняя ревизия tenant и раскатанные на спикерах сохраняются).
|
||||
operationId: getRevisionPruneEstimate
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TenantId"
|
||||
- name: retention_minutes
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
minimum: 15
|
||||
maximum: 43200
|
||||
description: TTL в минутах; если не задан — из tenant settings (default 30d).
|
||||
responses:
|
||||
"200":
|
||||
description: Оценка.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/RevisionPruneEstimate"
|
||||
"422":
|
||||
$ref: "#/components/responses/UnprocessableEntity"
|
||||
default:
|
||||
$ref: "#/components/responses/DefaultProblem"
|
||||
|
||||
/v1/revisions/prune:
|
||||
post:
|
||||
tags: [Revisions]
|
||||
summary: Очистить старые ревизии (синхронно)
|
||||
description: >
|
||||
Удаляет ревизии старше cutoff по retention и GC неиспользуемых prefix_snapshot.
|
||||
Operator-only.
|
||||
operationId: pruneRevisions
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TenantId"
|
||||
requestBody:
|
||||
required: false
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/RevisionPruneRequest"
|
||||
responses:
|
||||
"200":
|
||||
description: Результат очистки.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/RevisionPruneResult"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
"422":
|
||||
$ref: "#/components/responses/UnprocessableEntity"
|
||||
default:
|
||||
$ref: "#/components/responses/DefaultProblem"
|
||||
|
||||
/v1/revisions/{revision_id}:
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TenantId"
|
||||
|
||||
Reference in New Issue
Block a user