Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::TmpFileMgr::File Class Reference

#include <tmp-file-mgr.h>

Collaboration diagram for impala::TmpFileMgr::File:

Public Member Functions

Status AllocateSpace (int64_t write_size, int64_t *offset)
 
Status Remove ()
 
const std::string & path () const
 
int disk_id () const
 

Private Member Functions

 File (const std::string &path)
 

Private Attributes

std::string path_
 Path of the physical file in the filesystem. More...
 
int disk_id_
 The id of the disk on which the physical file lies. More...
 
int64_t current_offset_
 Offset to which the next block will be written. More...
 
int64_t current_size_
 

Static Private Attributes

static const std::string TMP_SUB_DIR_NAME
 
static const uint64_t AVAILABLE_SPACE_THRESHOLD_MB
 

Friends

class TmpFileMgr
 

Detailed Description

TmpFileMgr::File is a handle to a physical file in a temporary directory. Clients can allocate file space and remove files using AllocateSpace() and Remove(). Creation of the file is deferred until the first call to AllocateSpace().

Definition at line 33 of file tmp-file-mgr.h.

Constructor & Destructor Documentation

impala::TmpFileMgr::File::File ( const std::string &  path)
private

Definition at line 104 of file tmp-file-mgr.cc.

Member Function Documentation

Status impala::TmpFileMgr::File::AllocateSpace ( int64_t  write_size,
int64_t *  offset 
)

Allocates 'write_size' bytes in this file for a new block of data. The file size is increased by a call to truncate() if necessary. The physical file is created on the first call to AllocateSpace().

Definition at line 110 of file tmp-file-mgr.cc.

References impala::FileSystemUtil::CreateFile(), impala::DiskInfo::disk_id(), impala::Status::OK, impala::FileSystemUtil::ResizeFile(), and RETURN_IF_ERROR.

Referenced by impala::BufferedBlockMgr::WriteUnpinnedBlock().

int impala::TmpFileMgr::File::disk_id ( ) const
inline

Definition at line 45 of file tmp-file-mgr.h.

References disk_id_.

Referenced by impala::BufferedBlockMgr::WriteUnpinnedBlock().

const std::string& impala::TmpFileMgr::File::path ( ) const
inline

Definition at line 44 of file tmp-file-mgr.h.

References path_.

Referenced by impala::BufferedBlockMgr::WriteUnpinnedBlock().

Status impala::TmpFileMgr::File::Remove ( )

Delete the physical file on disk, if one was created. It is not valid to read or write to a file after calling Remove().

Definition at line 132 of file tmp-file-mgr.cc.

References impala::Status::OK, and impala::FileSystemUtil::RemovePaths().

Referenced by impala::BufferedBlockMgr::~BufferedBlockMgr().

Friends And Related Function Documentation

friend class TmpFileMgr
friend

Definition at line 48 of file tmp-file-mgr.h.

Member Data Documentation

const uint64_t impala::TmpFileMgr::File::AVAILABLE_SPACE_THRESHOLD_MB
staticprivate

Space (in MB) that must ideally be available for writing on a scratch directory. A warning is issued if available space is less than this threshold.

Definition at line 56 of file tmp-file-mgr.h.

int64_t impala::TmpFileMgr::File::current_offset_
private

Offset to which the next block will be written.

Definition at line 67 of file tmp-file-mgr.h.

int64_t impala::TmpFileMgr::File::current_size_
private

Current file size. Modified by AllocateSpace(). Is always >= current offset. Size is 0 before the file is created.

Definition at line 71 of file tmp-file-mgr.h.

int impala::TmpFileMgr::File::disk_id_
private

The id of the disk on which the physical file lies.

Definition at line 64 of file tmp-file-mgr.h.

Referenced by disk_id().

std::string impala::TmpFileMgr::File::path_
private

Path of the physical file in the filesystem.

Definition at line 61 of file tmp-file-mgr.h.

Referenced by path().

const std::string impala::TmpFileMgr::File::TMP_SUB_DIR_NAME
staticprivate

The name of the sub-directory that Impala created within each configured scratch directory.

Definition at line 52 of file tmp-file-mgr.h.


The documentation for this class was generated from the following files: