From 1169dd916cf134e7da2a3b291a3b5c84ab38a442 Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Tue, 26 Jul 2022 11:34:53 -0700 Subject: [PATCH] Document export size estimation API Signed-off-by: Christopher Ng --- developer_manual/digging_deeper/user_migration.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/developer_manual/digging_deeper/user_migration.rst b/developer_manual/digging_deeper/user_migration.rst index ff4798ddb..4e0b73611 100644 --- a/developer_manual/digging_deeper/user_migration.rst +++ b/developer_manual/digging_deeper/user_migration.rst @@ -30,12 +30,13 @@ whenever a user export or import begins. use OCP\UserMigration\IExportDestination; use OCP\UserMigration\IImportSource; use OCP\UserMigration\IMigrator; + use OCP\UserMigration\ISizeEstimationMigrator; use OCP\UserMigration\TMigratorBasicVersionHandling; use OCP\UserMigration\UserMigrationException; use Symfony\Component\Console\Output\OutputInterface; use Throwable; - class MyAppMigrator implements IMigrator { + class MyAppMigrator implements IMigrator, ISizeEstimationMigrator { use TMigratorBasicVersionHandling; private IMyAppManager $myAppManager; @@ -54,6 +55,17 @@ whenever a user export or import begins. $this->l10n = $l10n; } + /** + * Returns an estimate of the exported data size in KiB. + * Should be fast, favor performance over accuracy. + * + * @since 25.0.0 + */ + public function getEstimatedExportSize(IUser $user): int { + $size = 100; // 100KiB for user data JSON + return $size; + } + /** * Export user data *