@@ -359,18 +359,20 @@ class ARROW_EXPORT FileSystem
359359 bool default_async_is_sync_ = true ;
360360};
361361
362+ using FileSystemFactoryOptions = std::vector<std::pair<std::string, std::any>>;
363+
362364struct FileSystemFactory {
363365 std::function<Result<std::shared_ptr<FileSystem>>(
364- const Uri& uri, const std::vector<std::pair<std::string, std::any>> & options,
366+ const Uri& uri, const FileSystemFactoryOptions & options,
365367 const io::IOContext& io_context, std::string* out_path)>
366368 function;
367369 std::string_view file;
368370 int line;
369371
370372 // / Construct from an options-aware factory function.
371373 FileSystemFactory (std::function<Result<std::shared_ptr<FileSystem>>(
372- const Uri&, const std::vector<std::pair<std::string, std::any>> &,
373- const io::IOContext&, std::string*)>
374+ const Uri&, const FileSystemFactoryOptions&, const io::IOContext &,
375+ std::string*)>
374376 fn,
375377 std::string_view file, int line)
376378 : function(std::move(fn)), file(file), line(line) {}
@@ -382,10 +384,15 @@ struct FileSystemFactory {
382384 fn,
383385 std::string_view file, int line)
384386 : function([fn = std::move(fn)](
385- const Uri& uri,
386- const std::vector<std::pair<std::string, std::any>>& /* ignored*/ ,
387+ const Uri& uri, const FileSystemFactoryOptions& options,
387388 const io::IOContext& ctx,
388- std::string* out_path) { return fn (uri, ctx, out_path); }),
389+ std::string* out_path) -> Result<std::shared_ptr<FileSystem>> {
390+ if (!options.empty ()) {
391+ return Status::NotImplemented (
392+ " This filesystem does not support additional options" );
393+ }
394+ return fn (uri, ctx, out_path);
395+ }),
389396 file (file),
390397 line (line) {}
391398
@@ -593,8 +600,8 @@ Result<std::shared_ptr<FileSystem>> FileSystemFromUri(const std::string& uri,
593600// / \param[out] out_path (optional) Path inside the filesystem.
594601// / \return out_fs FileSystem instance.
595602ARROW_EXPORT
596- Result<std::shared_ptr<FileSystem>> FileSystemFromUri (
597- const std::string& uri, const std::vector<std::pair<std::string, std::any>> & options,
603+ Result<std::shared_ptr<FileSystem>> FileSystemFromUriAndOptions (
604+ const std::string& uri, const FileSystemFactoryOptions & options,
598605 std::string* out_path = NULLPTR );
599606
600607// / \brief Create a new FileSystem by URI with a custom IO context
@@ -635,8 +642,8 @@ Result<std::shared_ptr<FileSystem>> FileSystemFromUri(const std::string& uri,
635642// / \param[out] out_path (optional) Path inside the filesystem.
636643// / \return out_fs FileSystem instance.
637644ARROW_EXPORT
638- Result<std::shared_ptr<FileSystem>> FileSystemFromUri (
639- const std::string& uri, const std::vector<std::pair<std::string, std::any>> & options,
645+ Result<std::shared_ptr<FileSystem>> FileSystemFromUriAndOptions (
646+ const std::string& uri, const FileSystemFactoryOptions & options,
640647 const io::IOContext& io_context, std::string* out_path = NULLPTR );
641648
642649// / \brief Create a new FileSystem by URI
0 commit comments