|
| DUCKDB_API | FileHandle (FileSystem &file_system, string path, FileOpenFlags flags) |
|
| FileHandle (const FileHandle &)=delete |
| DUCKDB_API int64_t | Read (void *buffer, idx_t nr_bytes) |
| DUCKDB_API int64_t | Read (QueryContext context, void *buffer, idx_t nr_bytes) |
| DUCKDB_API int64_t | Write (void *buffer, idx_t nr_bytes) |
| DUCKDB_API int64_t | Write (QueryContext context, void *buffer, idx_t nr_bytes) |
| DUCKDB_API void | Read (void *buffer, idx_t nr_bytes, idx_t location) |
| DUCKDB_API void | Read (QueryContext context, void *buffer, idx_t nr_bytes, idx_t location) |
| DUCKDB_API void | Write (QueryContext context, void *buffer, idx_t nr_bytes, idx_t location) |
| DUCKDB_API void | Seek (idx_t location) |
| DUCKDB_API void | Reset () |
| DUCKDB_API idx_t | SeekPosition () |
| DUCKDB_API void | Sync () |
| DUCKDB_API void | Truncate (int64_t new_size) |
| DUCKDB_API string | ReadLine () |
| DUCKDB_API string | ReadLine (QueryContext context) |
| DUCKDB_API bool | Trim (idx_t offset_bytes, idx_t length_bytes) |
| virtual DUCKDB_API idx_t | GetProgress () |
| virtual DUCKDB_API FileCompressionType | GetFileCompressionType () |
| DUCKDB_API bool | CanSeek () |
| DUCKDB_API bool | IsPipe () |
| DUCKDB_API bool | OnDiskFile () |
| DUCKDB_API idx_t | GetFileSize () |
| DUCKDB_API FileType | GetType () |
| DUCKDB_API FileMetadata | Stats () |
| DUCKDB_API void | TryAddLogger (FileOpener &opener) |
| virtual DUCKDB_API void | Close ()=0 |
| | Closes the file handle.
|
| string | GetPath () const |
| FileOpenFlags | GetFlags () const |
| template<class TARGET> |
| TARGET & | Cast () |
| template<class TARGET> |
| const TARGET & | Cast () const |
◆ FileHandle()
74262 : file_system(file_system), path(std::move(path_p)), flags(flags) {
74263}
◆ ~FileHandle()
| duckdb::FileHandle::~FileHandle |
( |
| ) |
|
|
virtual |
◆ Read() [1/4]
| int64_t duckdb::FileHandle::Read |
( |
void * | buffer, |
|
|
idx_t | nr_bytes ) |
74268 {
74269 return file_system.Read(*this, buffer, UnsafeNumericCast<int64_t>(nr_bytes));
74270}
◆ Read() [2/4]
74272 {
74273 if (context.GetClientContext() != nullptr) {
74274 context.GetClientContext()->client_data->profiler->AddToCounter(MetricType::TOTAL_BYTES_READ, nr_bytes);
74275 }
74276
74277 return file_system.Read(*this, buffer, UnsafeNumericCast<int64_t>(nr_bytes));
74278}
◆ Write() [1/3]
| int64_t duckdb::FileHandle::Write |
( |
void * | buffer, |
|
|
idx_t | nr_bytes ) |
74284 {
74285 return file_system.Write(*this, buffer, UnsafeNumericCast<int64_t>(nr_bytes));
74286}
◆ Write() [2/3]
74288 {
74289 if (context.GetClientContext() != nullptr) {
74290 context.GetClientContext()->client_data->profiler->AddToCounter(MetricType::TOTAL_BYTES_WRITTEN, nr_bytes);
74291 }
74292
74293 return file_system.Write(*this, buffer, UnsafeNumericCast<int64_t>(nr_bytes));
74294}
◆ Read() [3/4]
| void duckdb::FileHandle::Read |
( |
void * | buffer, |
|
|
idx_t | nr_bytes, |
|
|
idx_t | location ) |
74296 {
74297 file_system.Read(*this, buffer, UnsafeNumericCast<int64_t>(nr_bytes), location);
74298}
◆ Read() [4/4]
74300 {
74301 if (context.GetClientContext() != nullptr) {
74302 context.GetClientContext()->client_data->profiler->AddToCounter(MetricType::TOTAL_BYTES_READ, nr_bytes);
74303 }
74304
74305 file_system.Read(*this, buffer, UnsafeNumericCast<int64_t>(nr_bytes), location);
74306}
◆ Write() [3/3]
74308 {
74309 if (context.GetClientContext() != nullptr) {
74310 context.GetClientContext()->client_data->profiler->AddToCounter(MetricType::TOTAL_BYTES_WRITTEN, nr_bytes);
74311 }
74312
74313 file_system.Write(*this, buffer, UnsafeNumericCast<int64_t>(nr_bytes), location);
74314}
◆ Seek()
| void duckdb::FileHandle::Seek |
( |
idx_t | location | ) |
|
74316 {
74317 file_system.Seek(*this, location);
74318}
◆ Reset()
| void duckdb::FileHandle::Reset |
( |
| ) |
|
74320 {
74321 file_system.Reset(*this);
74322}
◆ SeekPosition()
| idx_t duckdb::FileHandle::SeekPosition |
( |
| ) |
|
74324 {
74325 return file_system.SeekPosition(*this);
74326}
◆ Sync()
| void duckdb::FileHandle::Sync |
( |
| ) |
|
74376 {
74377 file_system.FileSync(*this);
74378}
◆ Truncate()
| void duckdb::FileHandle::Truncate |
( |
int64_t | new_size | ) |
|
74380 {
74381 file_system.Truncate(*this, new_size);
74382}
◆ ReadLine() [1/2]
| string duckdb::FileHandle::ReadLine |
( |
| ) |
|
74340 {
74341 string result;
74342 char buffer[1];
74343 while (true) {
74344 auto tuples_read = UnsafeNumericCast<idx_t>(Read(buffer, 1));
74345 if (tuples_read == 0 || buffer[0] == '\n') {
74346 return result;
74347 }
74348 if (buffer[0] != '\r') {
74349 result += buffer[0];
74350 }
74351 }
74352}
◆ ReadLine() [2/2]
74354 {
74355 string result;
74356 char buffer[1];
74357 while (true) {
74358 auto tuples_read = UnsafeNumericCast<idx_t>(Read(context, buffer, 1));
74359 if (tuples_read == 0 || buffer[0] == '\n') {
74360 return result;
74361 }
74362 if (buffer[0] != '\r') {
74363 result += buffer[0];
74364 }
74365 }
74366}
◆ Trim()
| bool duckdb::FileHandle::Trim |
( |
idx_t | offset_bytes, |
|
|
idx_t | length_bytes ) |
74280 {
74281 return file_system.Trim(*this, offset_bytes, length_bytes);
74282}
◆ GetProgress()
| idx_t duckdb::FileHandle::GetProgress |
( |
| ) |
|
|
virtual |
74409 {
74410 throw NotImplementedException("GetProgress is not implemented for this file handle");
74411}
◆ GetFileCompressionType()
| FileCompressionType duckdb::FileHandle::GetFileCompressionType |
( |
| ) |
|
|
virtual |
74332 {
74333 return FileCompressionType::UNCOMPRESSED;
74334}
◆ CanSeek()
| bool duckdb::FileHandle::CanSeek |
( |
| ) |
|
74328 {
74329 return file_system.CanSeek();
74330}
◆ IsPipe()
| bool duckdb::FileHandle::IsPipe |
( |
| ) |
|
74336 {
74337 return file_system.IsPipe(path);
74338}
◆ OnDiskFile()
| bool duckdb::FileHandle::OnDiskFile |
( |
| ) |
|
74368 {
74369 return file_system.OnDiskFile(*this);
74370}
◆ GetFileSize()
| idx_t duckdb::FileHandle::GetFileSize |
( |
| ) |
|
74372 {
74373 return NumericCast<idx_t>(file_system.GetFileSize(*this));
74374}
◆ GetType()
| FileType duckdb::FileHandle::GetType |
( |
| ) |
|
74384 {
74385 return file_system.GetFileType(*this);
74386}
◆ Stats()
74388 {
74389 return file_system.Stats(*this);
74390}
◆ TryAddLogger()
| void duckdb::FileHandle::TryAddLogger |
( |
FileOpener & | opener | ) |
|
74392 {
74393 if (flags.DisableLogging()) {
74394 return;
74395 }
74396
74397 auto context = opener.TryGetClientContext();
74398 if (context && Logger::Get(*context).ShouldLog(FileSystemLogType::NAME, FileSystemLogType::LEVEL)) {
74399 logger = context->logger;
74400 return;
74401 }
74402
74403 auto database = opener.TryGetDatabase();
74404 if (database && Logger::Get(*database).ShouldLog(FileSystemLogType::NAME, FileSystemLogType::LEVEL)) {
74405 logger = database->GetLogManager().GlobalLoggerReference();
74406 }
74407}
◆ Close()
| virtual DUCKDB_API void duckdb::FileHandle::Close |
( |
| ) |
|
|
pure virtual |
◆ GetPath()
| string duckdb::FileHandle::GetPath |
( |
| ) |
const |
|
inline |
8178 {
8179 return path;
8180 }
◆ GetFlags()
8182 {
8183 return flags;
8184 }
◆ Cast() [1/2]
template<class TARGET>
| TARGET & duckdb::FileHandle::Cast |
( |
| ) |
|
|
inline |
8187 {
8188 DynamicCastCheck<TARGET>(this);
8189 return reinterpret_cast<TARGET &>(*this);
8190 }
◆ Cast() [2/2]
template<class TARGET>
| const TARGET & duckdb::FileHandle::Cast |
( |
| ) |
const |
|
inline |
8192 {
8193 DynamicCastCheck<TARGET>(this);
8194 return reinterpret_cast<const TARGET &>(*this);
8195 }
The documentation for this struct was generated from the following files: