mirror of
https://github.com/typesense/typesense.git
synced 2025-05-17 04:02:36 +08:00
Some checks are pending
tests / test (push) Waiting to run
* add: basic recommendations endpoint * add: POST `/recommendations/models` recommendations endpoint * add: get specific model endpoint * add: DELETE `/recommendations/models/:id` and GET all models recommendations endpoint * add: ONNX model upload endpoint * add: save the file as a .tar.gz instead of ONNX * add: verify_tar_gz function * add: support for model upload * add: PUT `/recommendations/model/:id` to update the model, name, collection * refactor: recommendations -> personalization * add: personalization tests * add: personalization_model_manager_tests * fix: review comments * fix: review comments
24 lines
862 B
C++
24 lines
862 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <archive.h>
|
|
#include <archive_entry.h>
|
|
#include <fcntl.h>
|
|
#include <sys/stat.h>
|
|
|
|
class ArchiveUtils {
|
|
public:
|
|
static constexpr const char* TAR_GZ_EXTENSION = ".tar.gz";
|
|
static bool extract_tar_gz_from_file(const std::string& archive_path, const std::string& destination_path);
|
|
static bool extract_tar_gz_from_memory(const std::string& archive_content, const std::string& destination_path);
|
|
static bool verify_tar_gz_archive(const std::string& archive_content);
|
|
private:
|
|
static constexpr size_t BUFFER_SIZE = (10 * 1024 * 1024);
|
|
|
|
static int copy_data(struct archive* ar, struct archive* aw);
|
|
static bool create_directory(const std::string& path);
|
|
static std::string create_temp_tar_gz(const std::string& content);
|
|
static void cleanup(const std::string& file_path);
|
|
};
|