core/source/logic/transfer/_factory.ts

61 lines
1.3 KiB
TypeScript
Raw Permalink Normal View History

2025-09-24 12:39:22 +02:00
/*
This file is part of »mimir«.
Copyright 2025 kcf <fenris@folksprak.org>
»mimir« is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
»mimir« is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with »mimir«. If not, see <http://www.gnu.org/licenses/>.
*/
2025-03-26 07:35:59 +01:00
namespace _mimir.transfer
{
/**
*/
export function get_logic(
target : _mimir.conf.type_target
) : type_logic
{
2025-09-24 12:39:22 +02:00
switch (target.kind)
{
default:
{
2025-03-26 07:35:59 +01:00
throw (new Error("unhandled transfer kind: " + target["kind"]));
break;
}
2025-09-24 12:39:22 +02:00
case "local":
{
return _mimir.transfer.local.logic(
{
"directory": target.parameters.directory,
}
);
2025-03-26 07:35:59 +01:00
break;
}
2025-09-24 12:39:22 +02:00
case "borg":
{
return _mimir.transfer.borg.logic(
{
"repository": target.parameters.repository,
"compression": target.parameters.compression,
"pruning": target.parameters.pruning,
}
);
2025-03-26 07:35:59 +01:00
break;
}
}
}
}