fixes for storage managament

This commit is contained in:
onysd 2026-09-03 08:33:06 +03:00
parent e6bfe2d444
commit 8ef2b58bf9
29 changed files with 1768 additions and 63 deletions

View file

@ -112,6 +112,10 @@ type Service struct {
// EvictOldestMediaOverBudget as the active-eviction trigger threshold
// (<=0 disables eviction regardless of TELESRV_STORAGE_EVICTION_ENABLE).
storageMaxTotalBytes int64
// secretChatDeleteFileAfterDownload is
// TELESRV_SECRET_CHAT_DELETE_FILE_AFTER_DOWNLOAD -- see
// DeleteEncryptedFileBlob's doc comment.
secretChatDeleteFileAfterDownload bool
// retentionNotifyMu guards retentionMessages/retentionChannels: they are
// set post-construction (see SetRetentionPurgeNotifier) from
@ -242,6 +246,18 @@ func WithStorageMaxTotalBytes(maxBytes int64) Option {
}
}
// WithSecretChatDeleteFileAfterDownload enables DeleteEncryptedFileBlob's
// actual deletion (TELESRV_SECRET_CHAT_DELETE_FILE_AFTER_DOWNLOAD). Default
// true -- see that env var's doc comment in internal/config/config.go for
// why (secret-chat blobs have no other cleanup path at all otherwise).
// Passing false opts back out for a self-hoster who wants the ciphertext
// kept around regardless.
func WithSecretChatDeleteFileAfterDownload(enabled bool) Option {
return func(s *Service) {
s.secretChatDeleteFileAfterDownload = enabled
}
}
// WithGifSeedDir records the gif seed directory (cfg.GifSeedDir) so
// AdminDeleteUncategorizedGifs can remove a seed-imported entry's source
// file alongside its DB row -- see the field's doc comment for why that