@@ -106,7 +106,7 @@ struct DataFileInfo;
106
106
class DataFileMetaInfo ;
107
107
using DataFileMetaInfoPtr = std::shared_ptr<DataFileMetaInfo>;
108
108
109
- struct RelativePathWithMetadata
109
+ struct PathWithMetadata
110
110
{
111
111
class CommandInTaskResponse
112
112
{
@@ -138,18 +138,30 @@ struct RelativePathWithMetadata
138
138
std::optional<ObjectMetadata> metadata;
139
139
CommandInTaskResponse command;
140
140
std::optional<DataFileMetaInfoPtr> file_meta_info;
141
+ std::optional<String> absolute_path;
142
+ std::optional<ObjectStoragePtr> object_storage_to_use = std::nullopt ;
141
143
142
- RelativePathWithMetadata () = default ;
144
+ PathWithMetadata () = default ;
143
145
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 );
146
151
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 ;
148
159
149
160
virtual std::string getFileName () const { return std::filesystem::path (relative_path).filename (); }
150
161
virtual std::string getFileNameWithoutExtension () const { return std::filesystem::path (relative_path).stem (); }
151
162
152
163
virtual std::string getPath () const { return relative_path; }
164
+ virtual std::optional<std::string> getAbsolutePath () const { return absolute_path; }
153
165
virtual bool isArchive () const { return false ; }
154
166
virtual std::string getPathToArchive () const { throw Exception (ErrorCodes::LOGICAL_ERROR, " Not an archive" ); }
155
167
virtual size_t fileSizeInArchive () const { throw Exception (ErrorCodes::LOGICAL_ERROR, " Not an archive" ); }
@@ -160,6 +172,8 @@ struct RelativePathWithMetadata
160
172
161
173
void loadMetadata (ObjectStoragePtr object_storage, bool ignore_non_existent_file);
162
174
const CommandInTaskResponse & getCommand () const { return command; }
175
+
176
+ std::optional<ObjectStoragePtr> getObjectStorage () const { return object_storage_to_use; }
163
177
};
164
178
165
179
struct ObjectKeyWithMetadata
@@ -175,8 +189,8 @@ struct ObjectKeyWithMetadata
175
189
{}
176
190
};
177
191
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 >;
180
194
using ObjectKeysWithMetadata = std::vector<ObjectKeyWithMetadata>;
181
195
182
196
class IObjectStorageIterator ;
@@ -217,7 +231,7 @@ class IObjectStorage
217
231
virtual bool existsOrHasAnyChild (const std::string & path) const ;
218
232
219
233
// / 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 ;
221
235
222
236
// / List objects recursively by certain prefix. Use it instead of listObjects, if you want to list objects lazily.
223
237
virtual ObjectStorageIteratorPtr iterate(const std::string & path_prefix, size_t max_keys) const ;
0 commit comments