iceberg-cpp
Loading...
Searching...
No Matches
file_io_registry.h
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#pragma once
21
22#include <functional>
23#include <memory>
24#include <string>
25#include <string_view>
26#include <unordered_map>
27
28#include "iceberg/file_io.h"
29#include "iceberg/iceberg_export.h"
30#include "iceberg/result.h"
31
32namespace iceberg {
33
39class ICEBERG_EXPORT FileIORegistry {
40 public:
41 static constexpr std::string_view kArrowLocalFileIO = "arrow-fs-local";
42 static constexpr std::string_view kArrowS3FileIO = "arrow-fs-s3";
43
45 using Factory = std::function<Result<std::unique_ptr<FileIO>>(
46 const std::unordered_map<std::string, std::string>& properties)>;
47
52 static void Register(const std::string& name, Factory factory);
53
59 static Result<std::unique_ptr<FileIO>> Load(
60 const std::string& name,
61 const std::unordered_map<std::string, std::string>& properties);
62};
63
64} // namespace iceberg
Registry for FileIO implementations.
Definition file_io_registry.h:39
std::function< Result< std::unique_ptr< FileIO > >(const std::unordered_map< std::string, std::string > &properties)> Factory
Factory function type for creating FileIO instances.
Definition file_io_registry.h:46