@@ -81,22 +81,25 @@ struct ObjectMetadata
81
81
ObjectAttributes attributes;
82
82
};
83
83
84
- struct RelativePathWithMetadata
84
+ struct PathWithMetadata
85
85
{
86
86
String relative_path;
87
87
std::optional<ObjectMetadata> metadata;
88
+ String absolute_path;
88
89
89
- RelativePathWithMetadata () = default ;
90
+ PathWithMetadata () = default ;
90
91
91
- explicit RelativePathWithMetadata (String relative_path_, std::optional<ObjectMetadata> metadata_ = std::nullopt)
92
+ explicit PathWithMetadata (String relative_path_, std::optional<ObjectMetadata> metadata_ = std::nullopt, String absolute_path_ = " " )
92
93
: relative_path(std::move(relative_path_))
93
94
, metadata(std::move(metadata_))
95
+ , absolute_path(std::move(absolute_path_))
94
96
{}
95
97
96
- virtual ~RelativePathWithMetadata () = default ;
98
+ virtual ~PathWithMetadata () = default ;
97
99
98
100
virtual std::string getFileName () const { return std::filesystem::path (relative_path).filename (); }
99
101
virtual std::string getPath () const { return relative_path; }
102
+ virtual std::string getAbsolutePath () const { return absolute_path; }
100
103
virtual bool isArchive () const { return false ; }
101
104
virtual std::string getPathToArchive () const { throw Exception (ErrorCodes::LOGICAL_ERROR, " Not an archive" ); }
102
105
virtual size_t fileSizeInArchive () const { throw Exception (ErrorCodes::LOGICAL_ERROR, " Not an archive" ); }
@@ -115,8 +118,8 @@ struct ObjectKeyWithMetadata
115
118
{}
116
119
};
117
120
118
- using RelativePathWithMetadataPtr = std::shared_ptr<RelativePathWithMetadata >;
119
- using RelativePathsWithMetadata = std::vector<RelativePathWithMetadataPtr >;
121
+ using PathWithMetadataPtr = std::shared_ptr<PathWithMetadata >;
122
+ using PathsWithMetadata = std::vector<PathWithMetadataPtr >;
120
123
using ObjectKeysWithMetadata = std::vector<ObjectKeyWithMetadata>;
121
124
122
125
class IObjectStorageIterator ;
@@ -157,7 +160,7 @@ class IObjectStorage
157
160
virtual bool existsOrHasAnyChild (const std::string & path) const ;
158
161
159
162
// / List objects recursively by certain prefix.
160
- virtual void listObjects (const std::string & path, RelativePathsWithMetadata & children, size_t max_keys) const ;
163
+ virtual void listObjects (const std::string & path, PathsWithMetadata & children, size_t max_keys) const ;
161
164
162
165
// / List objects recursively by certain prefix. Use it instead of listObjects, if you want to list objects lazily.
163
166
virtual ObjectStorageIteratorPtr iterate(const std::string & path_prefix, size_t max_keys) const ;
0 commit comments