@@ -106,7 +106,7 @@ struct DataFileInfo;
106106class DataFileMetaInfo ;
107107using DataFileMetaInfoPtr = std::shared_ptr<DataFileMetaInfo>;
108108
109- struct RelativePathWithMetadata
109+ struct PathWithMetadata
110110{
111111 class CommandInTaskResponse
112112 {
@@ -138,18 +138,30 @@ struct RelativePathWithMetadata
138138 std::optional<ObjectMetadata> metadata;
139139 CommandInTaskResponse command;
140140 std::optional<DataFileMetaInfoPtr> file_meta_info;
141+ std::optional<String> absolute_path;
142+ std::optional<ObjectStoragePtr> object_storage_to_use = std::nullopt ;
141143
142- RelativePathWithMetadata () = default ;
144+ PathWithMetadata () = default ;
143145
144- explicit RelativePathWithMetadata (const String & task_string, std::optional<ObjectMetadata> metadata_ = std::nullopt );
145- explicit RelativePathWithMetadata (const DataFileInfo & info, std::optional<ObjectMetadata> metadata_ = std::nullopt );
146+ explicit PathWithMetadata (
147+ const String & task_string,
148+ std::optional<ObjectMetadata> metadata_ = std::nullopt ,
149+ std::optional<String> absolute_path_ = std::nullopt ,
150+ std::optional<ObjectStoragePtr> object_storage_to_use_ = std::nullopt );
146151
147- virtual ~RelativePathWithMetadata () = default ;
152+ explicit PathWithMetadata (
153+ const DataFileInfo & info,
154+ std::optional<ObjectMetadata> metadata_ = std::nullopt ,
155+ std::optional<String> absolute_path_ = std::nullopt ,
156+ std::optional<ObjectStoragePtr> object_storage_to_use_ = std::nullopt );
157+
158+ virtual ~PathWithMetadata () = default ;
148159
149160 virtual std::string getFileName () const { return std::filesystem::path (relative_path).filename (); }
150161 virtual std::string getFileNameWithoutExtension () const { return std::filesystem::path (relative_path).stem (); }
151162
152163 virtual std::string getPath () const { return relative_path; }
164+ virtual std::optional<std::string> getAbsolutePath () const { return absolute_path; }
153165 virtual bool isArchive () const { return false ; }
154166 virtual std::string getPathToArchive () const { throw Exception (ErrorCodes::LOGICAL_ERROR, " Not an archive" ); }
155167 virtual size_t fileSizeInArchive () const { throw Exception (ErrorCodes::LOGICAL_ERROR, " Not an archive" ); }
@@ -160,6 +172,8 @@ struct RelativePathWithMetadata
160172
161173 void loadMetadata (ObjectStoragePtr object_storage, bool ignore_non_existent_file);
162174 const CommandInTaskResponse & getCommand () const { return command; }
175+
176+ std::optional<ObjectStoragePtr> getObjectStorage () const { return object_storage_to_use; }
163177};
164178
165179struct ObjectKeyWithMetadata
@@ -175,8 +189,8 @@ struct ObjectKeyWithMetadata
175189 {}
176190};
177191
178- using RelativePathWithMetadataPtr = std::shared_ptr<RelativePathWithMetadata >;
179- using RelativePathsWithMetadata = std::vector<RelativePathWithMetadataPtr >;
192+ using PathWithMetadataPtr = std::shared_ptr<PathWithMetadata >;
193+ using PathsWithMetadata = std::vector<PathWithMetadataPtr >;
180194using ObjectKeysWithMetadata = std::vector<ObjectKeyWithMetadata>;
181195
182196class IObjectStorageIterator ;
@@ -217,7 +231,7 @@ class IObjectStorage
217231 virtual bool existsOrHasAnyChild (const std::string & path) const ;
218232
219233 // / List objects recursively by certain prefix.
220- virtual void listObjects (const std::string & path, RelativePathsWithMetadata & children, size_t max_keys) const ;
234+ virtual void listObjects (const std::string & path, PathsWithMetadata & children, size_t max_keys) const ;
221235
222236 // / List objects recursively by certain prefix. Use it instead of listObjects, if you want to list objects lazily.
223237 virtual ObjectStorageIteratorPtr iterate(const std::string & path_prefix, size_t max_keys) const ;
0 commit comments