@@ -101,7 +101,7 @@ struct ObjectMetadata
101101 ObjectAttributes attributes;
102102};
103103
104- struct RelativePathWithMetadata
104+ struct PathWithMetadata
105105{
106106 class CommandInTaskResponse
107107 {
@@ -124,23 +124,28 @@ struct RelativePathWithMetadata
124124 String relative_path;
125125 std::optional<ObjectMetadata> metadata;
126126 CommandInTaskResponse command;
127+ String absolute_path;
127128
128- RelativePathWithMetadata () = default ;
129+ PathWithMetadata () = default ;
129130
130- explicit RelativePathWithMetadata (const String & task_string, std::optional<ObjectMetadata> metadata_ = std::nullopt )
131+ explicit PathWithMetadata (const String & task_string, std::optional<ObjectMetadata> metadata_ = std::nullopt , String absolute_path_ = " " )
131132 : metadata(std::move(metadata_))
132133 , command(task_string)
133134 {
135+ absolute_path = absolute_path_;
134136 if (!command.is_parsed ())
137+ {
135138 relative_path = task_string;
139+ }
136140 }
137141
138- virtual ~RelativePathWithMetadata () = default ;
142+ virtual ~PathWithMetadata () = default ;
139143
140144 virtual std::string getFileName () const { return std::filesystem::path (relative_path).filename (); }
141145 virtual std::string getFileNameWithoutExtension () const { return std::filesystem::path (relative_path).stem (); }
142146
143147 virtual std::string getPath () const { return relative_path; }
148+ virtual std::string getAbsolutePath () const { return absolute_path; }
144149 virtual bool isArchive () const { return false ; }
145150 virtual std::string getPathToArchive () const { throw Exception (ErrorCodes::LOGICAL_ERROR, " Not an archive" ); }
146151 virtual size_t fileSizeInArchive () const { throw Exception (ErrorCodes::LOGICAL_ERROR, " Not an archive" ); }
@@ -162,8 +167,8 @@ struct ObjectKeyWithMetadata
162167 {}
163168};
164169
165- using RelativePathWithMetadataPtr = std::shared_ptr<RelativePathWithMetadata >;
166- using RelativePathsWithMetadata = std::vector<RelativePathWithMetadataPtr >;
170+ using PathWithMetadataPtr = std::shared_ptr<PathWithMetadata >;
171+ using PathsWithMetadata = std::vector<PathWithMetadataPtr >;
167172using ObjectKeysWithMetadata = std::vector<ObjectKeyWithMetadata>;
168173
169174class IObjectStorageIterator ;
@@ -204,7 +209,7 @@ class IObjectStorage
204209 virtual bool existsOrHasAnyChild (const std::string & path) const ;
205210
206211 // / List objects recursively by certain prefix.
207- virtual void listObjects (const std::string & path, RelativePathsWithMetadata & children, size_t max_keys) const ;
212+ virtual void listObjects (const std::string & path, PathsWithMetadata & children, size_t max_keys) const ;
208213
209214 // / List objects recursively by certain prefix. Use it instead of listObjects, if you want to list objects lazily.
210215 virtual ObjectStorageIteratorPtr iterate(const std::string & path_prefix, size_t max_keys) const ;
@@ -286,6 +291,14 @@ class IObjectStorage
286291 // / buckets in S3. If object storage doesn't have any namepaces return empty string.
287292 virtual String getObjectsNamespace () const = 0;
288293
294+ virtual std::unique_ptr<IObjectStorage> cloneObjectStorage (
295+ const std::string &,
296+ const Poco::Util::AbstractConfiguration &,
297+ const std::string &, ContextPtr)
298+ {
299+ throw Exception (ErrorCodes::NOT_IMPLEMENTED, " Method 'cloneObjectStorage' is not implemented" );
300+ }
301+
289302 // / Generate blob name for passed absolute local path.
290303 // / Path can be generated either independently or based on `path`.
291304 virtual ObjectStorageKey generateObjectKeyForPath (const std::string & path, const std::optional<std::string> & key_prefix) const = 0;
0 commit comments