2018-12-31 20:04:05 +01:00
|
|
|
//
|
2024-01-01 01:07:21 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
2018-12-31 20:04:05 +01:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "td/telegram/files/FileGcParameters.h"
|
|
|
|
#include "td/telegram/files/FileStats.h"
|
|
|
|
|
2021-09-18 23:47:05 +02:00
|
|
|
#include "td/actor/actor.h"
|
|
|
|
|
2019-05-01 16:15:54 +02:00
|
|
|
#include "td/utils/CancellationToken.h"
|
2018-12-11 21:18:58 +01:00
|
|
|
#include "td/utils/logging.h"
|
2022-06-27 12:30:18 +02:00
|
|
|
#include "td/utils/Promise.h"
|
2018-12-11 21:18:58 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
namespace td {
|
2018-11-15 22:25:08 +01:00
|
|
|
|
|
|
|
extern int VERBOSITY_NAME(file_gc);
|
|
|
|
|
2020-03-02 09:59:47 +01:00
|
|
|
struct FileGcResult {
|
|
|
|
FileStats kept_file_stats_;
|
|
|
|
FileStats removed_file_stats_;
|
|
|
|
};
|
|
|
|
|
2021-07-04 04:58:54 +02:00
|
|
|
class FileGcWorker final : public Actor {
|
2018-12-31 20:04:05 +01:00
|
|
|
public:
|
2019-05-01 16:15:54 +02:00
|
|
|
FileGcWorker(ActorShared<> parent, CancellationToken token) : parent_(std::move(parent)), token_(std::move(token)) {
|
2018-12-31 20:04:05 +01:00
|
|
|
}
|
2020-03-02 09:59:47 +01:00
|
|
|
void run_gc(const FileGcParameters ¶meters, std::vector<FullFileInfo> files, Promise<FileGcResult> promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
ActorShared<> parent_;
|
2019-05-01 16:15:54 +02:00
|
|
|
CancellationToken token_;
|
2018-12-31 20:04:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace td
|