ЛР7 на 4: HTTPS, mTLS, OpenBao AppRole и ротация leaf.
Skeleton contracts / contracts (pull_request) Blocked by required conditions

Smoke/security/grade4/persistence/failover пройдены; REPORT и DEFENSE.
This commit is contained in:
2026-12-02 23:08:27 +03:00
parent 20afc2c790
commit 2f2047909f
182 changed files with 15169 additions and 90 deletions
+60
View File
@@ -0,0 +1,60 @@
package reconcile
import (
"context"
"errors"
"time"
"github.com/jackc/pgx/v5"
"gavrilenko-sxdees/lab7/internal/db"
s3store "gavrilenko-sxdees/lab7/internal/s3"
)
func (r *Reconciler) cleanupStagingObject(
ctx context.Context,
obj s3store.ObjectInfo,
opts Options,
report *Report,
) error {
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
tx, err := r.pool.Begin(ctx)
if err != nil {
return err
}
defer tx.Rollback(context.Background())
q := r.withTx(tx)
row, err := q.LockAttachmentByStagingKey(ctx, obj.Key)
orphan := errors.Is(err, pgx.ErrNoRows)
if err != nil && !orphan {
return err
}
if !orphan {
if row.Status != db.AttachmentStatusReady && row.Status != db.AttachmentStatusFailed {
report.SkippedInactive++
return nil
}
if r.now().Sub(row.UpdatedAt) < opts.StagingRetention {
report.SkippedFresh++
return nil
}
}
if err := r.store.DeleteAdmin(ctx, obj.Key); err != nil {
return err
}
report.DeletedObjects++
if !orphan {
if err := q.ClearAttachmentStagingKey(ctx, row.ID); err != nil {
return err
}
}
return tx.Commit(ctx)
}