Lens AI Profiler Cpp
objectuploader.h
1 
6 #ifndef IMAGE_UPLOADER_H
7 #define IMAGE_UPLOADER_H
8 
9 #ifdef AWS
10 #include <aws/core/utils/threading/Executor.h>
11 #include <aws/transfer/TransferManager.h>
12 #include <aws/core/auth/AWSCredentials.h>
13 #endif
14 
15 #include <chrono>
16 #include <mutex>
17 #include <atomic>
18 
19 #include "http_uploader.h"
20 
21 typedef struct {
22 #ifdef AWS
23  Aws::Auth::AWSCredentials credentials;
24  Aws::String region;
25 #else
26  int dummy;
27 #endif
29 
35 public:
42  ImageUploader(int uploadtype, const std::string& endpointUrl, const std::string& token,
43  s3_client_config_t &s3_client_config);
52  bool startUploadThread(const std::string& imagePath, const std::string& bucketName,
53  const std::string& objectKey, const std::chrono::milliseconds& interval);
54 
59 
60 private:
61  int type;
62  s3_client_config_t s3_client_config_;
63  std::atomic<bool> stopFlag_;
64  std::mutex uploadMutex_;
65  HttpUploader * _HttpUploader;
66  // Function to run the upload thread (implementation in ImageUploader.cpp)
67  void uploadThread(const std::string& imagePath, const std::string& bucketName,
68  const std::string& objectKey, const std::chrono::milliseconds& interval);
69 };
70 
71 #endif // IMAGE_UPLOADER_H
72 
The HttpUploader class handles uploading files to an HTTP server.
Definition: http_uploader.h:36
Class for uploading images to AWS S3 in a separate thread.
Definition: objectuploader.h:34
bool startUploadThread(const std::string &imagePath, const std::string &bucketName, const std::string &objectKey, const std::chrono::milliseconds &interval)
Starts a thread that uploads the image to S3 in a loop at a specified interval.
ImageUploader(int uploadtype, const std::string &endpointUrl, const std::string &token, s3_client_config_t &s3_client_config)
Constructor to initialize the ImageUploader object.
void stopUploadThread()
Stops the running upload thread.
Defines the HttpUploader class for managing file uploads over HTTP.
Definition: objectuploader.h:21