mirror of
https://github.com/usatiuk/backup.git
synced 2025-10-26 17:37:47 +01:00
speedup tests, fix includes
This commit is contained in:
@@ -4,4 +4,4 @@ add_library(change_detectors srcs/ChangeDetector.cpp srcs/ChangeDetectorContaine
|
|||||||
|
|
||||||
target_include_directories(change_detectors PUBLIC includes)
|
target_include_directories(change_detectors PUBLIC includes)
|
||||||
|
|
||||||
target_link_libraries(change_detectors utils)
|
target_link_libraries(change_detectors utils repo)
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
|
|
||||||
#include "../../repo/includes/Repository.h"
|
#include "Repository.h"
|
||||||
#include "../../repo/includes/objects/File.h"
|
#include "objects/File.h"
|
||||||
|
|
||||||
/// Helper class to allow comparing files from different sources
|
/// Helper class to allow comparing files from different sources
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
// Created by Stepan Usatiuk on 16.04.2023.
|
// Created by Stepan Usatiuk on 16.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/ChangeDetector.h"
|
#include "ChangeDetector.h"
|
||||||
|
|
||||||
ChangeDetector::~ChangeDetector() = default;
|
ChangeDetector::~ChangeDetector() = default;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 04.05.2023.
|
// Created by Stepan Usatiuk on 04.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/ChangeDetectorContainer.h"
|
#include "ChangeDetectorContainer.h"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,15 @@
|
|||||||
// Created by Stepan Usatiuk on 16.04.2023.
|
// Created by Stepan Usatiuk on 16.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/ChangeDetectorFactory.h"
|
#include "ChangeDetectorFactory.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "../includes/ContentsChangeDetector.h"
|
#include "ContentsChangeDetector.h"
|
||||||
#include "../includes/EditTimeChangeDetector.h"
|
#include "EditTimeChangeDetector.h"
|
||||||
#include "../includes/SizeChangeDetector.h"
|
|
||||||
#include "../includes/TypeChangeDetector.h"
|
|
||||||
#include "Exception.h"
|
#include "Exception.h"
|
||||||
|
#include "SizeChangeDetector.h"
|
||||||
|
#include "TypeChangeDetector.h"
|
||||||
|
|
||||||
std::unique_ptr<ChangeDetector> ChangeDetectorFactory::getChangeDetector(const std::string &type) {
|
std::unique_ptr<ChangeDetector> ChangeDetectorFactory::getChangeDetector(const std::string &type) {
|
||||||
if (type == "etime") {
|
if (type == "etime") {
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#include "../includes/ComparableFile.h"
|
#include "ComparableFile.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "../../repo/includes/objects/FileBuffer.h"
|
#include "Exception.h"
|
||||||
#include "../../utils/includes/Exception.h"
|
#include "objects/FileBuffer.h"
|
||||||
|
|
||||||
ComparableFile::ComparableFile(const File &file, const Repository *repo)
|
ComparableFile::ComparableFile(const File &file, const Repository *repo)
|
||||||
: path(file.name),
|
: path(file.name),
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 05.05.2023.
|
// Created by Stepan Usatiuk on 05.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/ContentsChangeDetector.h"
|
#include "ContentsChangeDetector.h"
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 16.04.2023.
|
// Created by Stepan Usatiuk on 16.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/EditTimeChangeDetector.h"
|
#include "EditTimeChangeDetector.h"
|
||||||
|
|
||||||
bool EditTimeChangeDetector::check(const ComparableFile &f1, const ComparableFile &f2) const {
|
bool EditTimeChangeDetector::check(const ComparableFile &f1, const ComparableFile &f2) const {
|
||||||
return f1.mtime != f2.mtime;
|
return f1.mtime != f2.mtime;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 16.04.2023.
|
// Created by Stepan Usatiuk on 16.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/SizeChangeDetector.h"
|
#include "SizeChangeDetector.h"
|
||||||
|
|
||||||
bool SizeChangeDetector::check(const ComparableFile &f1, const ComparableFile &f2) const {
|
bool SizeChangeDetector::check(const ComparableFile &f1, const ComparableFile &f2) const {
|
||||||
return f1.bytes != f2.bytes;
|
return f1.bytes != f2.bytes;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 12.05.2023.
|
// Created by Stepan Usatiuk on 12.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/TypeChangeDetector.h"
|
#include "TypeChangeDetector.h"
|
||||||
|
|
||||||
bool TypeChangeDetector::check(const ComparableFile &f1, const ComparableFile &f2) const {
|
bool TypeChangeDetector::check(const ComparableFile &f1, const ComparableFile &f2) const {
|
||||||
return f1.type != f2.type;
|
return f1.type != f2.type;
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
|
|
||||||
#include "../../utils/includes/Config.h"
|
|
||||||
#include "Chunker.h"
|
#include "Chunker.h"
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
/// Factory for Chunker%s
|
/// Factory for Chunker%s
|
||||||
class ChunkerFactory {
|
class ChunkerFactory {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 26.04.2023.
|
// Created by Stepan Usatiuk on 26.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/Buzhash.h"
|
#include "Buzhash.h"
|
||||||
|
|
||||||
Buzhash::Buzhash(uint32_t blockSize) : blockSize(blockSize), history() {}
|
Buzhash::Buzhash(uint32_t blockSize) : blockSize(blockSize), history() {}
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
// Created by Stepan Usatiuk on 26.04.2023.
|
// Created by Stepan Usatiuk on 26.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/BuzhashChunker.h"
|
#include "BuzhashChunker.h"
|
||||||
|
|
||||||
#include "../../crypto/includes/SHA.h"
|
#include "Exception.h"
|
||||||
#include "../../utils/includes/Exception.h"
|
#include "SHA.h"
|
||||||
|
|
||||||
BuzhashChunker::BuzhashChunker(std::streambuf *buf, unsigned long long minBytes, unsigned long long maxBytes, unsigned long long mask, uint32_t window) : Chunker(buf, maxBytes), window(window), minBytes(minBytes), mask(mask), buzhash(window) {}
|
BuzhashChunker::BuzhashChunker(std::streambuf *buf, unsigned long long minBytes, unsigned long long maxBytes, unsigned long long mask, uint32_t window) : Chunker(buf, maxBytes), window(window), minBytes(minBytes), mask(mask), buzhash(window) {}
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
// Created by Stepan Usatiuk on 15.04.2023.
|
// Created by Stepan Usatiuk on 15.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/Chunker.h"
|
#include "Chunker.h"
|
||||||
|
|
||||||
#include "../../utils/includes/Exception.h"
|
#include "Exception.h"
|
||||||
|
|
||||||
Chunker::Chunker(std::streambuf *buf, unsigned long long maxBytes) : buf(buf), maxBytes(maxBytes) {}
|
Chunker::Chunker(std::streambuf *buf, unsigned long long maxBytes) : buf(buf), maxBytes(maxBytes) {}
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
// Created by Stepan Usatiuk on 30.04.2023.
|
// Created by Stepan Usatiuk on 30.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/ChunkerFactory.h"
|
#include "ChunkerFactory.h"
|
||||||
|
|
||||||
#include "../../utils/includes/Exception.h"
|
#include "BuzhashChunker.h"
|
||||||
#include "../includes/BuzhashChunker.h"
|
#include "ConstChunker.h"
|
||||||
#include "../includes/ConstChunker.h"
|
#include "Exception.h"
|
||||||
|
|
||||||
std::unique_ptr<Chunker> ChunkerFactory::getChunker(const Config &config, std::streambuf *buf) {
|
std::unique_ptr<Chunker> ChunkerFactory::getChunker(const Config &config, std::streambuf *buf) {
|
||||||
if (config.getStr("chunker") == "const") {
|
if (config.getStr("chunker") == "const") {
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
// Created by Stepan Usatiuk on 15.04.2023.
|
// Created by Stepan Usatiuk on 15.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/ConstChunker.h"
|
#include "ConstChunker.h"
|
||||||
|
|
||||||
#include "../../crypto/includes/SHA.h"
|
#include "Exception.h"
|
||||||
#include "../../utils/includes/Exception.h"
|
#include "SHA.h"
|
||||||
|
|
||||||
ConstChunker::ConstChunker(std::streambuf *buf, unsigned long long maxBytes) : Chunker(buf, maxBytes) {}
|
ConstChunker::ConstChunker(std::streambuf *buf, unsigned long long maxBytes) : Chunker(buf, maxBytes) {}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "Command.h"
|
#include "Command.h"
|
||||||
|
|
||||||
#include "../../repo/includes/objects/File.h"
|
#include "objects/File.h"
|
||||||
|
|
||||||
#include "CommandsCommon.h"
|
#include "CommandsCommon.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
#ifndef SEMBACKUP_CONTEXT_H
|
#ifndef SEMBACKUP_CONTEXT_H
|
||||||
#define SEMBACKUP_CONTEXT_H
|
#define SEMBACKUP_CONTEXT_H
|
||||||
|
|
||||||
#include "../../repo/includes/Repository.h"
|
#include "Config.h"
|
||||||
#include "../../utils/includes/Config.h"
|
#include "Logger.h"
|
||||||
#include "../../utils/includes/Logger.h"
|
#include "Repository.h"
|
||||||
|
|
||||||
struct Context {
|
struct Context {
|
||||||
Logger *logger;
|
Logger *logger;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "../../change_detectors/includes/ComparableFile.h"
|
#include "ComparableFile.h"
|
||||||
|
|
||||||
/// Utility class to compute difference between two ComparableFile%s
|
/// Utility class to compute difference between two ComparableFile%s
|
||||||
class Diff {
|
class Diff {
|
||||||
|
|||||||
@@ -2,20 +2,20 @@
|
|||||||
// Created by Stepan Usatiuk on 23.05.2023.
|
// Created by Stepan Usatiuk on 23.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/CommandDiff.h"
|
#include "CommandDiff.h"
|
||||||
|
|
||||||
#include "../../change_detectors/includes/ChangeDetectorFactory.h"
|
#include "BytesFormatter.h"
|
||||||
#include "../../chunkers/includes/ChunkerFactory.h"
|
#include "ChangeDetectorFactory.h"
|
||||||
#include "../../repo/includes/Serialize.h"
|
#include "ChunkerFactory.h"
|
||||||
#include "../../repo/includes/objects/Archive.h"
|
#include "Diff.h"
|
||||||
#include "../../repo/includes/objects/Chunk.h"
|
#include "Exception.h"
|
||||||
#include "../../utils/includes/BytesFormatter.h"
|
#include "Progress.h"
|
||||||
#include "../../utils/includes/Exception.h"
|
#include "RunningDiffAverage.h"
|
||||||
#include "../../utils/includes/Progress.h"
|
#include "Serialize.h"
|
||||||
#include "../../utils/includes/RunningDiffAverage.h"
|
#include "Signals.h"
|
||||||
#include "../../utils/includes/Signals.h"
|
#include "ThreadPool.h"
|
||||||
#include "../../utils/includes/ThreadPool.h"
|
#include "objects/Archive.h"
|
||||||
#include "../includes/Diff.h"
|
#include "objects/Chunk.h"
|
||||||
|
|
||||||
using namespace CommandsCommon;
|
using namespace CommandsCommon;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 23.05.2023.
|
// Created by Stepan Usatiuk on 23.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/CommandList.h"
|
#include "CommandList.h"
|
||||||
|
|
||||||
CommandList::CommandList() : Command() {
|
CommandList::CommandList() : Command() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
// Created by Stepan Usatiuk on 23.05.2023.
|
// Created by Stepan Usatiuk on 23.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/CommandListFiles.h"
|
#include "CommandListFiles.h"
|
||||||
|
|
||||||
#include "../../repo/includes/Serialize.h"
|
#include "BytesFormatter.h"
|
||||||
#include "../../repo/includes/objects/Archive.h"
|
#include "Serialize.h"
|
||||||
#include "../../repo/includes/objects/Chunk.h"
|
#include "objects/Archive.h"
|
||||||
#include "../../repo/includes/objects/File.h"
|
#include "objects/Chunk.h"
|
||||||
#include "../../utils/includes/BytesFormatter.h"
|
#include "objects/File.h"
|
||||||
|
|
||||||
CommandListFiles::CommandListFiles() : Command() {
|
CommandListFiles::CommandListFiles() : Command() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 07.06.2023.
|
// Created by Stepan Usatiuk on 07.06.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/CommandMount.h"
|
#include "CommandMount.h"
|
||||||
#include "RepoFS.h"
|
#include "RepoFS.h"
|
||||||
|
|
||||||
CommandMount::CommandMount() : Command() {
|
CommandMount::CommandMount() : Command() {
|
||||||
|
|||||||
@@ -2,21 +2,21 @@
|
|||||||
// Created by Stepan Usatiuk on 23.05.2023.
|
// Created by Stepan Usatiuk on 23.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/CommandRestore.h"
|
#include "CommandRestore.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "../../chunkers/includes/ChunkerFactory.h"
|
#include "BytesFormatter.h"
|
||||||
#include "../../repo/includes/Serialize.h"
|
#include "ChunkerFactory.h"
|
||||||
#include "../../repo/includes/objects/Archive.h"
|
#include "Exception.h"
|
||||||
#include "../../repo/includes/objects/Chunk.h"
|
#include "Progress.h"
|
||||||
#include "../../utils/includes/BytesFormatter.h"
|
#include "RunningDiffAverage.h"
|
||||||
#include "../../utils/includes/Exception.h"
|
#include "Serialize.h"
|
||||||
#include "../../utils/includes/Progress.h"
|
#include "Signals.h"
|
||||||
#include "../../utils/includes/RunningDiffAverage.h"
|
#include "ThreadPool.h"
|
||||||
#include "../../utils/includes/Signals.h"
|
#include "objects/Archive.h"
|
||||||
#include "../../utils/includes/ThreadPool.h"
|
#include "objects/Chunk.h"
|
||||||
|
|
||||||
using namespace CommandsCommon;
|
using namespace CommandsCommon;
|
||||||
|
|
||||||
|
|||||||
@@ -2,27 +2,27 @@
|
|||||||
// Created by Stepan Usatiuk on 23.05.2023.
|
// Created by Stepan Usatiuk on 23.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/CommandRun.h"
|
#include "CommandRun.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "../../change_detectors/includes/ChangeDetectorFactory.h"
|
#include "BytesFormatter.h"
|
||||||
#include "../../chunkers/includes/ChunkerFactory.h"
|
#include "ChangeDetectorFactory.h"
|
||||||
#include "../../crypto/includes/SHA.h"
|
#include "ChunkerFactory.h"
|
||||||
#include "../../repo/includes/Serialize.h"
|
#include "Exception.h"
|
||||||
#include "../../repo/includes/objects/Archive.h"
|
#include "Progress.h"
|
||||||
#include "../../repo/includes/objects/Chunk.h"
|
#include "RunningDiffAverage.h"
|
||||||
#include "../../repo/includes/objects/File.h"
|
#include "SHA.h"
|
||||||
#include "../../utils/includes/BytesFormatter.h"
|
#include "Serialize.h"
|
||||||
#include "../../utils/includes/Exception.h"
|
#include "Signals.h"
|
||||||
#include "../../utils/includes/Progress.h"
|
#include "ThreadPool.h"
|
||||||
#include "../../utils/includes/RunningDiffAverage.h"
|
#include "objects/Archive.h"
|
||||||
#include "../../utils/includes/Signals.h"
|
#include "objects/Chunk.h"
|
||||||
#include "../../utils/includes/ThreadPool.h"
|
#include "objects/File.h"
|
||||||
|
|
||||||
#include "../includes/CommandsCommon.h"
|
#include "CommandsCommon.h"
|
||||||
|
|
||||||
using namespace CommandsCommon;
|
using namespace CommandsCommon;
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
// Created by Stepan Usatiuk on 23.05.2023.
|
// Created by Stepan Usatiuk on 23.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/CommandsCommon.h"
|
#include "CommandsCommon.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
#include "../../utils/includes/Exception.h"
|
#include "Exception.h"
|
||||||
#include "../../utils/includes/Signals.h"
|
#include "Signals.h"
|
||||||
|
|
||||||
void CommandsCommon::workerCallback(unsigned long long int bytesWritten, unsigned long long int bytesSkipped, unsigned long long int filesWritten, WorkerStats &to) {
|
void CommandsCommon::workerCallback(unsigned long long int bytesWritten, unsigned long long int bytesSkipped, unsigned long long int filesWritten, WorkerStats &to) {
|
||||||
to.bytesWritten += bytesWritten;
|
to.bytesWritten += bytesWritten;
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
// Created by Stepan Usatiuk on 06.05.2023.
|
// Created by Stepan Usatiuk on 06.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/Diff.h"
|
#include "Diff.h"
|
||||||
|
|
||||||
#include "../../chunkers/includes/BuzhashChunker.h"
|
#include "BuzhashChunker.h"
|
||||||
#include "../../utils/includes/BytesFormatter.h"
|
#include "BytesFormatter.h"
|
||||||
#include "../../utils/includes/Exception.h"
|
#include "Exception.h"
|
||||||
#include "../../utils/includes/Signals.h"
|
#include "Signals.h"
|
||||||
|
|
||||||
bool Diff::isBinary(const ComparableFile &c) {
|
bool Diff::isBinary(const ComparableFile &c) {
|
||||||
auto b = c.contents();
|
auto b = c.contents();
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
// Created by Stepan Usatiuk on 30.04.2023.
|
// Created by Stepan Usatiuk on 30.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/AES.h"
|
#include "AES.h"
|
||||||
|
|
||||||
#include <openssl/aes.h>
|
#include <openssl/aes.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
|
|
||||||
#include "../../utils/includes/Exception.h"
|
#include "Exception.h"
|
||||||
|
|
||||||
std::vector<char> AES::encrypt(const std::vector<char> &in, const std::string &password, const std::string &salt) {
|
std::vector<char> AES::encrypt(const std::vector<char> &in, const std::string &password, const std::string &salt) {
|
||||||
return AES::encrypt(in, AES::deriveKey(password, salt));
|
return AES::encrypt(in, AES::deriveKey(password, salt));
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 12.05.2023.
|
// Created by Stepan Usatiuk on 12.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/CRC32.h"
|
#include "CRC32.h"
|
||||||
|
|
||||||
CRC32::crcType CRC32::calculate(const std::vector<char> &in) {
|
CRC32::crcType CRC32::calculate(const std::vector<char> &in) {
|
||||||
crcType res = crc32(0L, nullptr, 0);
|
crcType res = crc32(0L, nullptr, 0);
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
// Created by Stepan Usatiuk on 15.04.2023.
|
// Created by Stepan Usatiuk on 15.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/SHA.h"
|
#include "SHA.h"
|
||||||
|
|
||||||
#include "../../utils/includes/Exception.h"
|
#include "Exception.h"
|
||||||
|
|
||||||
std::string SHA::calculate(const std::vector<char> &in) {
|
std::string SHA::calculate(const std::vector<char> &in) {
|
||||||
SHA hasher;
|
SHA hasher;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "../../utils/includes/Config.h"
|
#include "Config.h"
|
||||||
#include "Filter.h"
|
#include "Filter.h"
|
||||||
|
|
||||||
/// Utility factory class for Filter%s
|
/// Utility factory class for Filter%s
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
// Created by Stepan Usatiuk on 12.05.2023.
|
// Created by Stepan Usatiuk on 12.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/CheckFilter.h"
|
#include "CheckFilter.h"
|
||||||
#include "../../crypto/includes/CRC32.h"
|
#include "CRC32.h"
|
||||||
#include "../../repo/includes/Serialize.h"
|
#include "Serialize.h"
|
||||||
|
|
||||||
std::vector<char> CheckFilter::filterWrite(std::vector<char> from) const {
|
std::vector<char> CheckFilter::filterWrite(std::vector<char> from) const {
|
||||||
return filterWriteStatic(std::move(from));
|
return filterWriteStatic(std::move(from));
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
// Created by Stepan Usatiuk on 22.04.2023.
|
// Created by Stepan Usatiuk on 22.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/Filter.h"
|
#include "Filter.h"
|
||||||
Filter::~Filter() = default;
|
Filter::~Filter() = default;
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
// Created by Stepan Usatiuk on 23.04.2023.
|
// Created by Stepan Usatiuk on 23.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/FilterAES.h"
|
#include "FilterAES.h"
|
||||||
|
|
||||||
#include "../../crypto/includes/AES.h"
|
#include "AES.h"
|
||||||
|
|
||||||
std::vector<char> FilterAES::filterWrite(std::vector<char> from) const {
|
std::vector<char> FilterAES::filterWrite(std::vector<char> from) const {
|
||||||
return AES::encrypt(from, key);
|
return AES::encrypt(from, key);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 22.04.2023.
|
// Created by Stepan Usatiuk on 22.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/FilterContainer.h"
|
#include "FilterContainer.h"
|
||||||
|
|
||||||
FilterContainer::FilterContainer() = default;
|
FilterContainer::FilterContainer() = default;
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
// Created by Stepan Usatiuk on 22.04.2023.
|
// Created by Stepan Usatiuk on 22.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/FilterFactory.h"
|
#include "FilterFactory.h"
|
||||||
|
|
||||||
#include "../../utils/includes/Exception.h"
|
#include "CheckFilter.h"
|
||||||
#include "../includes/CheckFilter.h"
|
#include "Exception.h"
|
||||||
#include "../includes/FilterAES.h"
|
#include "FilterAES.h"
|
||||||
#include "../includes/FilterShift.h"
|
#include "FilterShift.h"
|
||||||
#include "../includes/FilterShiftSecret.h"
|
#include "FilterShiftSecret.h"
|
||||||
#include "../includes/FilterZlib.h"
|
#include "FilterZlib.h"
|
||||||
|
|
||||||
std::unique_ptr<Filter> FilterFactory::makeFilter(const std::string &type, const Config &config) {
|
std::unique_ptr<Filter> FilterFactory::makeFilter(const std::string &type, const Config &config) {
|
||||||
if (type == "none") throw Exception("Trying to make a \"none\" filter!");
|
if (type == "none") throw Exception("Trying to make a \"none\" filter!");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Created by Stepan Usatiuk on 22.04.2023.
|
// Created by Stepan Usatiuk on 22.04.2023.
|
||||||
//
|
//
|
||||||
#include "../includes/FilterShift.h"
|
#include "FilterShift.h"
|
||||||
|
|
||||||
std::vector<char> FilterShift::filterWrite(std::vector<char> from) const {
|
std::vector<char> FilterShift::filterWrite(std::vector<char> from) const {
|
||||||
for (auto &c: from) c += shiftVal;
|
for (auto &c: from) c += shiftVal;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 23.04.2023.
|
// Created by Stepan Usatiuk on 23.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/FilterShiftSecret.h"
|
#include "FilterShiftSecret.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
// Created by Stepan Usatiuk on 23.04.2023.
|
// Created by Stepan Usatiuk on 23.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/FilterZlib.h"
|
#include "FilterZlib.h"
|
||||||
|
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#include "../../repo/includes/Serialize.h"
|
#include "Serialize.h"
|
||||||
|
|
||||||
std::vector<char> FilterZlib::filterWrite(std::vector<char> from) const {
|
std::vector<char> FilterZlib::filterWrite(std::vector<char> from) const {
|
||||||
uLongf outSize = compressBound(from.size());
|
uLongf outSize = compressBound(from.size());
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#include "../includes/RepoFS.h"
|
#include "RepoFS.h"
|
||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|||||||
34
src/main.cpp
34
src/main.cpp
@@ -1,24 +1,24 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "BytesFormatter.h"
|
||||||
|
#include "Command.h"
|
||||||
|
#include "CommandDiff.h"
|
||||||
|
#include "CommandList.h"
|
||||||
|
#include "CommandListFiles.h"
|
||||||
#include "CommandMount.h"
|
#include "CommandMount.h"
|
||||||
#include "commands/includes/Command.h"
|
#include "CommandRestore.h"
|
||||||
#include "commands/includes/CommandDiff.h"
|
#include "CommandRun.h"
|
||||||
#include "commands/includes/CommandList.h"
|
#include "Config.h"
|
||||||
#include "commands/includes/CommandListFiles.h"
|
#include "Context.h"
|
||||||
#include "commands/includes/CommandRestore.h"
|
#include "Exception.h"
|
||||||
#include "commands/includes/CommandRun.h"
|
#include "FileRepository.h"
|
||||||
#include "commands/includes/Context.h"
|
#include "Logger.h"
|
||||||
#include "repo/includes/FileRepository.h"
|
#include "Repository.h"
|
||||||
#include "repo/includes/Repository.h"
|
#include "Serialize.h"
|
||||||
#include "repo/includes/Serialize.h"
|
#include "Signals.h"
|
||||||
#include "repo/includes/objects/Archive.h"
|
#include "objects/Archive.h"
|
||||||
#include "repo/includes/objects/File.h"
|
#include "objects/File.h"
|
||||||
#include "utils/includes/BytesFormatter.h"
|
|
||||||
#include "utils/includes/Config.h"
|
|
||||||
#include "utils/includes/Exception.h"
|
|
||||||
#include "utils/includes/Logger.h"
|
|
||||||
#include "utils/includes/Signals.h"
|
|
||||||
|
|
||||||
Config getConf(int argc, char *argv[]) {
|
Config getConf(int argc, char *argv[]) {
|
||||||
Config out;
|
Config out;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include "../../filters/includes/FilterContainer.h"
|
#include "Config.h"
|
||||||
#include "../../utils/includes/Config.h"
|
#include "FilterContainer.h"
|
||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
|
|
||||||
/// Abstract base class for an Object Repository
|
/// Abstract base class for an Object Repository
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
// Created by Stepan Usatiuk on 14.04.2023.
|
// Created by Stepan Usatiuk on 14.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/FileRepository.h"
|
#include "FileRepository.h"
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include "../../filters/includes/CheckFilter.h"
|
#include "CheckFilter.h"
|
||||||
#include "../../filters/includes/FilterFactory.h"
|
#include "FilterFactory.h"
|
||||||
#include "../includes/Object.h"
|
#include "Object.h"
|
||||||
#include "../includes/Serialize.h"
|
#include "Serialize.h"
|
||||||
|
|
||||||
FileRepository::FileRepository(Config config) : Repository(std::move(config)), root(std::filesystem::path(this->config.getStr("repo"))), writeCacheMax(config.getInt("repo-target") * 1024 * 1024) {}
|
FileRepository::FileRepository(Config config) : Repository(std::move(config)), root(std::filesystem::path(this->config.getStr("repo"))), writeCacheMax(config.getInt("repo-target") * 1024 * 1024) {}
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
// Created by Stepan Usatiuk on 14.04.2023.
|
// Created by Stepan Usatiuk on 14.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/Object.h"
|
#include "Object.h"
|
||||||
|
|
||||||
#include "../includes/Serialize.h"
|
#include "Serialize.h"
|
||||||
|
|
||||||
Object::Object(idType id, ObjectType type) : id(id), type(type) {}
|
Object::Object(idType id, ObjectType type) : id(id), type(type) {}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 14.04.2023.
|
// Created by Stepan Usatiuk on 14.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/Repository.h"
|
#include "Repository.h"
|
||||||
Repository::~Repository() = default;
|
Repository::~Repository() = default;
|
||||||
|
|
||||||
Repository::Repository(Config config) : config(std::move(config)) {}
|
Repository::Repository(Config config) : config(std::move(config)) {}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
// Created by Stepan Usatiuk on 14.04.2023.
|
// Created by Stepan Usatiuk on 14.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../../includes/objects/Archive.h"
|
#include "objects/Archive.h"
|
||||||
|
|
||||||
#include "../../../utils/includes/Exception.h"
|
#include "Exception.h"
|
||||||
#include "../../includes/Serialize.h"
|
#include "Serialize.h"
|
||||||
|
|
||||||
Archive::Archive(Object::idType id, std::string name, unsigned long long mtime, std::vector<idType> files)
|
Archive::Archive(Object::idType id, std::string name, unsigned long long mtime, std::vector<idType> files)
|
||||||
: Object(id, ObjectType::Archive), name(name), mtime(mtime), files(files) {}
|
: Object(id, ObjectType::Archive), name(name), mtime(mtime), files(files) {}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
// Created by Stepan Usatiuk on 14.04.2023.
|
// Created by Stepan Usatiuk on 14.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../../includes/objects/Chunk.h"
|
#include "objects/Chunk.h"
|
||||||
|
|
||||||
#include "../../../utils/includes/Exception.h"
|
#include "Exception.h"
|
||||||
#include "../../includes/Serialize.h"
|
#include "Serialize.h"
|
||||||
|
|
||||||
Chunk::Chunk(idType id, std::string SHA, std::vector<char> data) : Object(id, ObjectType::Chunk), data(std::move(data)), SHA(std::move(SHA)), length(this->data.size()) {}
|
Chunk::Chunk(idType id, std::string SHA, std::vector<char> data) : Object(id, ObjectType::Chunk), data(std::move(data)), SHA(std::move(SHA)), length(this->data.size()) {}
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
// Created by Stepan Usatiuk on 14.04.2023.
|
// Created by Stepan Usatiuk on 14.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../../includes/objects/File.h"
|
#include "objects/File.h"
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "../../../utils/includes/Exception.h"
|
#include "Exception.h"
|
||||||
#include "../../includes/Serialize.h"
|
#include "Serialize.h"
|
||||||
|
|
||||||
File::File(Object::idType id, std::string name, unsigned long long bytes, unsigned long long mtime, std::string SHA, std::map<size_t, idType> chunks, Type fileType)
|
File::File(Object::idType id, std::string name, unsigned long long bytes, unsigned long long mtime, std::string SHA, std::map<size_t, idType> chunks, Type fileType)
|
||||||
: Object(id, ObjectType::File), name(name), bytes(bytes), mtime(mtime), SHA(SHA), fileType(fileType), chunks(std::move(chunks)) {}
|
: Object(id, ObjectType::File), name(name), bytes(bytes), mtime(mtime), SHA(SHA), fileType(fileType), chunks(std::move(chunks)) {}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
// Created by Stepan Usatiuk on 23.04.2023.
|
// Created by Stepan Usatiuk on 23.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../../includes/objects/FileBuffer.h"
|
#include "objects/FileBuffer.h"
|
||||||
|
|
||||||
#include "../../includes/Serialize.h"
|
#include "Serialize.h"
|
||||||
|
|
||||||
FileBuffer::FileBuffer(const Repository *repo, Object::idType fileId) : repo(repo), file(Serialize::deserialize<File>(repo->getObject(fileId))), chunksQueue() {
|
FileBuffer::FileBuffer(const Repository *repo, Object::idType fileId) : repo(repo), file(Serialize::deserialize<File>(repo->getObject(fileId))), chunksQueue() {
|
||||||
for (auto const &id: file.chunks) chunksQueue.emplace(id.second);
|
for (auto const &id: file.chunks) chunksQueue.emplace(id.second);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../../utils/includes/Exception.h"
|
#include "Exception.h"
|
||||||
|
|
||||||
/// Serialization library
|
/// Serialization library
|
||||||
/**
|
/**
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 13.05.2023.
|
// Created by Stepan Usatiuk on 13.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/BytesFormatter.h"
|
#include "BytesFormatter.h"
|
||||||
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
// Created by Stepan Usatiuk on 01.05.2023.
|
// Created by Stepan Usatiuk on 01.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/Config.h"
|
#include "Config.h"
|
||||||
#include "../../repo/includes/Serialize.h"
|
#include "Exception.h"
|
||||||
#include "../includes/Exception.h"
|
#include "Serialize.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
Config &Config::add(const std::string &k, const std::string &v) {
|
Config &Config::add(const std::string &k, const std::string &v) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 01.05.2023.
|
// Created by Stepan Usatiuk on 01.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/Exception.h"
|
#include "Exception.h"
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 23.05.2023.
|
// Created by Stepan Usatiuk on 23.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/Logger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
Logger::Logger(int level, std::ostream &out) : loglevel(level), out(out) {
|
Logger::Logger(int level, std::ostream &out) : loglevel(level), out(out) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 05.05.2023.
|
// Created by Stepan Usatiuk on 05.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/Progress.h"
|
#include "Progress.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 05.05.2023.
|
// Created by Stepan Usatiuk on 05.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/RunningAverage.h"
|
#include "RunningAverage.h"
|
||||||
|
|
||||||
RunningAverage::RunningAverage(std::function<unsigned long long int()> getFunc, int max, int ms)
|
RunningAverage::RunningAverage(std::function<unsigned long long int()> getFunc, int max, int ms)
|
||||||
: getFunc(std::move(getFunc)), max(max), ms(ms), thread(&RunningAverage::loop, this) {
|
: getFunc(std::move(getFunc)), max(max), ms(ms), thread(&RunningAverage::loop, this) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 12.05.2023.
|
// Created by Stepan Usatiuk on 12.05.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/RunningDiffAverage.h"
|
#include "RunningDiffAverage.h"
|
||||||
|
|
||||||
RunningDiffAverage::RunningDiffAverage(std::function<unsigned long long int()> getFunc, int max, int ms)
|
RunningDiffAverage::RunningDiffAverage(std::function<unsigned long long int()> getFunc, int max, int ms)
|
||||||
: runningAverage(
|
: runningAverage(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Created by Stepan Usatiuk on 16.04.2023.
|
// Created by Stepan Usatiuk on 16.04.2023.
|
||||||
//
|
//
|
||||||
#include "../includes/Signals.h"
|
#include "Signals.h"
|
||||||
|
|
||||||
void Signals::setup() {
|
void Signals::setup() {
|
||||||
signal(SIGINT, handle);
|
signal(SIGINT, handle);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "../includes/Signals.h"
|
#include "Signals.h"
|
||||||
#include "../includes/ThreadPool.h"
|
#include "ThreadPool.h"
|
||||||
|
|
||||||
ThreadPool::ThreadPool(std::function<void(std::string)> onError, std::size_t workersNum) : onError(std::move(onError)) {
|
ThreadPool::ThreadPool(std::function<void(std::string)> onError, std::size_t workersNum) : onError(std::move(onError)) {
|
||||||
for (int i = 0; i < workersNum; i++) threads.emplace_back(&ThreadPool::loop, this);
|
for (int i = 0; i < workersNum; i++) threads.emplace_back(&ThreadPool::loop, this);
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
TESTSIZE=16
|
TESTSIZE=4
|
||||||
|
|
||||||
# TODO: Don't hardcode this
|
# TODO: Don't hardcode this
|
||||||
CMD="../../src/backup"
|
CMD="../../src/backup"
|
||||||
|
|
||||||
|
CHUNKEROPTS=" --chunker-min 64 --chunker-max 1024 --chunker-mask 17 --repo-target 2 "
|
||||||
|
|
||||||
TESTDATADIR=backup
|
TESTDATADIR=backup
|
||||||
|
|
||||||
rm -rf "$TESTDATADIR"
|
rm -rf "$TESTDATADIR"
|
||||||
@@ -50,7 +52,7 @@ cat "$TESTDATADIR"/testdata/7/b >> "$TESTDATADIR"/testdata/8/b
|
|||||||
|
|
||||||
echo "Data created"
|
echo "Data created"
|
||||||
|
|
||||||
if ! $CMD init --repo "$TESTDATADIR"/testdir/to1 --compression zlib --compression-level 4 --encryption aes --password asdff --salt e; then
|
if ! $CMD init $CHUNKEROPTS --repo "$TESTDATADIR"/testdir/to1 --compression zlib --compression-level 4 --encryption aes --password asdff --salt e; then
|
||||||
echo "Error creating repo!"
|
echo "Error creating repo!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -204,101 +206,6 @@ if ! ( ! ( echo "$OUT" | grep -q 'b is different' ) && ( echo "$OUT" | grep -q '
|
|||||||
fi
|
fi
|
||||||
echo "OK comparing archive last and current"
|
echo "OK comparing archive last and current"
|
||||||
|
|
||||||
|
|
||||||
if ! $CMD init --repo "$TESTDATADIR"/testdir/to2 --compression zlib --compression-level 4 --encryption aes --password asdff --salt e; then
|
|
||||||
echo "Error creating repo!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Repo created"
|
|
||||||
|
|
||||||
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
|
||||||
echo "$OUT"
|
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Copied: a' ) && ( echo "$OUT" | grep -q 'Copied: aa' ) && ( echo "$OUT" | grep -q 'Copied: b' ) && ( echo "$OUT" | grep -q 'Copied: c' ) ); then
|
|
||||||
echo "Error backing up 1 dir!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Backup 1 ok"
|
|
||||||
|
|
||||||
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
|
||||||
echo "$OUT"
|
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' )); then
|
|
||||||
echo "Error backing up 2 dir!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Backup 2 ok"
|
|
||||||
|
|
||||||
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
|
||||||
echo "$OUT"
|
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
|
||||||
echo "Error backing up 3 dir!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Backup 3 ok"
|
|
||||||
|
|
||||||
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
|
||||||
echo "$OUT"
|
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' )); then
|
|
||||||
echo "Error backing up 4 dir!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Backup 4 ok"
|
|
||||||
|
|
||||||
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
|
||||||
echo "$OUT"
|
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
|
||||||
echo "Error backing up 5 dir!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Backup 5 ok"
|
|
||||||
|
|
||||||
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
|
||||||
echo "$OUT"
|
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
|
||||||
echo "Error backing up 6 dir!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Backup 6 ok"
|
|
||||||
|
|
||||||
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
|
||||||
echo "$OUT"
|
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
|
||||||
echo "Error backing up 7 dir!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Backup 7 ok"
|
|
||||||
|
|
||||||
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
|
||||||
echo "$OUT"
|
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' )); then
|
|
||||||
echo "Error backing up 8 dir!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Backup 8 ok"
|
|
||||||
|
|
||||||
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
|
||||||
echo "$OUT"
|
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
|
||||||
echo "Error backing up 9 dir!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Backup 9 ok"
|
|
||||||
|
|
||||||
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
|
||||||
echo "$OUT"
|
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
|
||||||
echo "Error backing up 10 dir!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Backup 10 ok"
|
|
||||||
|
|
||||||
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
|
||||||
echo "$OUT"
|
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
|
||||||
echo "Error backing up 11 dir!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Backup 11 ok"
|
|
||||||
|
|
||||||
rm -rf "$TESTDATADIR"
|
rm -rf "$TESTDATADIR"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Stepan Usatiuk on 14.04.2023.
|
// Created by Stepan Usatiuk on 14.04.2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../includes/Cleaner.h"
|
#include "Cleaner.h"
|
||||||
|
|
||||||
Cleaner::Cleaner(std::vector<std::filesystem::path> toClean) : toClean(std::move(toClean)) {
|
Cleaner::Cleaner(std::vector<std::filesystem::path> toClean) : toClean(std::move(toClean)) {
|
||||||
for (const auto &p: this->toClean) {
|
for (const auto &p: this->toClean) {
|
||||||
|
|||||||
Reference in New Issue
Block a user