MCPcopy Create free account
hub / github.com/apache/arrow / GetFileInfoGenerator

Method GetFileInfoGenerator

cpp/src/arrow/filesystem/s3fs.cc:2908–2939  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2906 }
2907
2908 FileInfoGenerator GetFileInfoGenerator(const FileSelector& select) {
2909 auto maybe_base_path = S3Path::FromString(select.base_dir);
2910 if (!maybe_base_path.ok()) {
2911 return MakeFailingGenerator<FileInfoVector>(maybe_base_path.status());
2912 }
2913 auto base_path = *std::move(maybe_base_path);
2914
2915 PushGenerator<std::vector<FileInfo>> generator;
2916 Future<> scheduler_fut = RunInScheduler(
2917 [select, base_path, sink = generator.producer()](
2918 util::AsyncTaskScheduler* scheduler, S3FileSystem::Impl* self) {
2919 if (base_path.empty()) {
2920 bool should_recurse = select.recursive && select.max_recursion > 0;
2921 self->FullListAsync(/*include_implicit_dirs=*/true, scheduler, sink,
2922 should_recurse);
2923 } else {
2924 self->ListAsync(select, base_path.bucket, base_path.key,
2925 /*include_implicit_dirs=*/true, scheduler, sink);
2926 }
2927 return Status::OK();
2928 });
2929
2930 // Mark the generator done once all tasks are finished
2931 scheduler_fut.AddCallback([sink = generator.producer()](const Status& st) mutable {
2932 if (!st.ok()) {
2933 sink.Push(st);
2934 }
2935 sink.Close();
2936 });
2937
2938 return generator;
2939 }
2940
2941 Status EnsureDirectoryExists(const S3Path& path) {
2942 if (!path.key.empty()) {

Callers 1

Calls 11

FullListAsyncMethod · 0.95
ListAsyncMethod · 0.95
FromStringFunction · 0.85
OKFunction · 0.50
okMethod · 0.45
statusMethod · 0.45
producerMethod · 0.45
emptyMethod · 0.45
AddCallbackMethod · 0.45
PushMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected