Coverage Report

Created: 2026-03-13 03:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/io/fs/remote_file_system.cpp
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#include "io/fs/remote_file_system.h"
19
20
#include <glog/logging.h>
21
22
#include <algorithm>
23
24
#include "common/config.h"
25
#include "io/cache/cached_remote_file_reader.h"
26
#include "io/fs/file_reader.h"
27
#include "util/async_io.h" // IWYU pragma: keep
28
29
namespace doris::io {
30
31
531
Status RemoteFileSystem::upload(const Path& local_file, const Path& dest_file) {
32
531
    Path dest_path;
33
531
    RETURN_IF_ERROR(absolute_path(dest_file, dest_path));
34
531
    FILESYSTEM_M(upload_impl(local_file, dest_path));
35
0
}
36
37
Status RemoteFileSystem::batch_upload(const std::vector<Path>& local_files,
38
2
                                      const std::vector<Path>& remote_files) {
39
2
    std::vector<Path> remote_paths;
40
2
    for (auto& path : remote_files) {
41
2
        Path abs_path;
42
2
        RETURN_IF_ERROR(absolute_path(path, abs_path));
43
2
        remote_paths.push_back(abs_path);
44
2
    }
45
2
    FILESYSTEM_M(batch_upload_impl(local_files, remote_paths));
46
0
}
47
48
0
Status RemoteFileSystem::download(const Path& remote_file, const Path& local) {
49
0
    Path remote_path;
50
0
    RETURN_IF_ERROR(absolute_path(remote_file, remote_path));
51
0
    FILESYSTEM_M(download_impl(remote_path, local));
52
0
}
53
54
Status RemoteFileSystem::open_file_impl(const Path& path, FileReaderSPtr* reader,
55
174k
                                        const FileReaderOptions* opts) {
56
174k
    FileReaderSPtr raw_reader;
57
174k
    if (!opts) {
58
0
        opts = &FileReaderOptions::DEFAULT;
59
0
    }
60
174k
    RETURN_IF_ERROR(open_file_internal(path, &raw_reader, *opts));
61
174k
    *reader = DORIS_TRY(create_cached_file_reader(raw_reader, *opts));
62
174k
    return Status::OK();
63
174k
}
64
65
} // namespace doris::io