data_chunk_source.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #pragma once
7 
8 #include <cudf/utilities/export.hpp>
10 
11 #include <rmm/cuda_stream_pool.hpp>
12 #include <rmm/device_buffer.hpp>
13 
19 namespace CUDF_EXPORT cudf {
20 namespace io {
21 namespace text {
22 
38  public:
39  virtual ~device_data_chunk() = default;
45  [[nodiscard]] virtual char const* data() const = 0;
51  [[nodiscard]] virtual std::size_t size() const = 0;
57  virtual operator device_span<char const>() const = 0;
58 };
59 
70  public:
71  virtual ~data_chunk_reader() = default;
77  virtual void skip_bytes(std::size_t size) = 0;
78 
93  virtual std::unique_ptr<device_data_chunk> get_next_chunk(std::size_t size,
94  rmm::cuda_stream_view stream) = 0;
95 };
96 
102  public:
103  virtual ~data_chunk_source() = default;
104 
110  [[nodiscard]] virtual std::unique_ptr<data_chunk_reader> create_reader() const = 0;
111 };
112  // end of group
114 
115 } // namespace text
116 } // namespace io
117 } // namespace CUDF_EXPORT cudf
a reader capable of producing views over device memory.
virtual std::unique_ptr< device_data_chunk > get_next_chunk(std::size_t size, rmm::cuda_stream_view stream)=0
Get the next chunk of bytes from the data source.
virtual void skip_bytes(std::size_t size)=0
Skips the specified number of bytes in the data source.
a data source capable of creating a reader which can produce views of the data source in device memor...
virtual std::unique_ptr< data_chunk_reader > create_reader() const =0
Get a reader for the data source.
A contract guaranteeing stream-ordered memory access to the underlying device data.
virtual char const * data() const =0
Returns a pointer to the underlying device data.
virtual std::size_t size() const =0
Returns the size of the underlying device data.
cuda::std::span< T, Extent > device_span
Device span is an alias of cuda::std::span.
Definition: span.hpp:296
cuDF interfaces
Definition: host_udf.hpp:26
APIs for spans.