Public Member Functions | Protected Member Functions | Private Attributes

df_Writer Class Reference
[IVD Data format.]

#include <df.h>

Inheritance diagram for df_Writer:
Inheritance graph
[legend]
Collaboration diagram for df_Writer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 df_Writer (UInt32_t a_blkType, bbt_BufType_t a_bufType, UInt32_t a_blkSize)
virtual ~df_Writer ()
virtual void EndOfData ()
void WaitAllReaders () const
void NewFRIBuffer (const string &a_id, bool a_createNew=false, bool a_createOnTmp=false, bool a_createInto=false, cmn_Path a_intoPath="", const string a_extension="")
void NewFRIBuffer (const string &a_id, ivd_MigrationID_t a_migrationID, UInt32_t a_copyNumber, UInt32_t a_mediumKey, UInt32_t a_medVolNum, i_FSC_ptr a_fsc)
virtual void NewDiskBuffer (const string &a_id, const string &a_diskBufferFS, const ivd_FileSize_t a_dbFileSize, bool a_append=false)
virtual void NewNetBuffer (i_UploadAgent_ptr a_uploadAgt)
virtual void NewStdIOBuffer (const string &a_id)
virtual void Go ()

Protected Member Functions

virtual void GetNewBlock ()
virtual void FlushBlock ()

Private Attributes

 log_CLASSID_m
auto_ptr< df_BlockManagerm_manager
auto_ptr< df_MgrWriterm_mgrWriter

Detailed Description

Definition at line 683 of file df.h.


Constructor & Destructor Documentation

df_Writer::df_Writer ( UInt32_t  a_blkType,
bbt_BufType_t  a_bufType,
UInt32_t  a_blkSize 
)
df_Writer::~df_Writer (  )  [virtual]

Definition at line 72 of file df_writer.cpp.

References log_FUNC_m.


Member Function Documentation

void df_Writer::EndOfData (  )  [virtual]

Reimplemented from df_BlockProxyWriter.

Definition at line 76 of file df_writer.cpp.

References log_FUNC_m, and m_mgrWriter.

Referenced by df_FRI::MediumVolumeEnd().

                          {
    log_FUNC_m(EndOfData);

    // flush current block - there is probably some data there
    df_BlockProxyWriter::EndOfData();

    // Just destroy the MgrWriter. It will set end of data.
    if (m_mgrWriter.get() != NULL) {
        m_mgrWriter.reset();
    };
}

Here is the caller graph for this function:

void df_Writer::FlushBlock (  )  [protected, virtual]

Reimplemented from df_BlockProxyWriter.

Definition at line 108 of file df_writer.cpp.

References df_DataBlock::GetUsedSize(), hton(), ie_DF_INV_BLK, log_FUNC_INT_m, log_FUNC_m, log_WRN_m, df_BlockProxyWriter::m_blkHdr_p, df_BlockProxyWriter::m_curBlk_p, m_manager, m_mgrWriter, NULL, and df_BlockHeader_t::used.

                           {
    log_FUNC_INT_m(FlushBlock);

    df_BlockProxyWriter::FlushBlock();

    if (m_blkHdr_p != NULL) {
        UInt32_t blkUsed = m_curBlk_p->GetUsedSize();
        if (blkUsed < sizeof(df_BlockHeader_t)) {
            log_FUNC_m(FlushBlock);
            throw ivd_InternalError(
                ie_DF_INV_BLK,
                "BUG: m_hasBlkHdr set but block probably doesn't contain header.");
        }

        if (m_manager->GetBlocksWritten() > 0) {
            if (blkUsed == sizeof(df_BlockHeader_t)) {
                log_FUNC_m(FlushBlock);
                // TODO: should we really just ignore? - maybe only for last block?
                log_WRN_m("CHECK THIS: FlushBlock: no records in block - ignored");
            }
        }

        m_blkHdr_p->used = hton(blkUsed);
    }
    m_mgrWriter->Flush();
    m_curBlk_p = NULL;
}

Here is the call graph for this function:

void df_Writer::GetNewBlock (  )  [protected, virtual]

Reimplemented from df_BlockProxyWriter.

Definition at line 94 of file df_writer.cpp.

References ie_IMPOSSIBLE, df_DataBlock::IsClosed(), log_FUNC_INT_m, df_BlockProxyWriter::m_curBlk_p, and m_mgrWriter.

                            {
    log_FUNC_INT_m(GetNewBlock);

    df_BlockProxyWriter::GetNewBlock();

    // Blocks if all blocks in df_BlockManager are used (closed)
    m_curBlk_p = m_mgrWriter->GetFree();

    if (m_curBlk_p->IsClosed()) {
        throw ivd_InternalError(ie_IMPOSSIBLE, "Got closed block in GetNewBlock().");
    }
}

Here is the call graph for this function:

void df_Writer::Go (  )  [virtual]

Reimplemented from df_BlockProxyWriter.

Definition at line 215 of file df_writer.cpp.

References log_FUNC_m, m_manager, and m_mgrWriter.

Referenced by df_FRI::MediumVolumeStart().

Here is the caller graph for this function:

void df_Writer::NewDiskBuffer ( const string &  a_id,
const string &  a_diskBufferFS,
const ivd_FileSize_t  a_dbFileSize,
bool  a_append = false 
) [virtual]

Implements df_BlockProxyWriter.

Definition at line 186 of file df_writer.cpp.

References log_FUNC_A_m, m_manager, and cmn_Thread::Start().

                                              {
                                
    log_FUNC_A_m(NewDiskBuffer, "file: " << a_diskBufferFS << a_id);

    blk_DiskBufferWriter *db_p =
        new blk_DiskBufferWriter(*m_manager.get(), a_id, a_diskBufferFS, a_diskBufferSize, a_append);
    db_p->Start();
}

Here is the call graph for this function:

void df_Writer::NewFRIBuffer ( const string &  a_id,
ivd_MigrationID_t  a_migrationID,
UInt32_t  a_copyNumber,
UInt32_t  a_mediumKey,
UInt32_t  a_medVolNum,
i_FSC_ptr  a_fsc 
)

Definition at line 159 of file df_writer.cpp.

References log_FUNC_A_m, m_manager, NewFRIBuffer(), and cmn_Thread::Start().

                               {

    log_FUNC_A_m(NewFRIBuffer,
        "id: " << a_id <<
        "migID: " << a_migrationID <<
        "copy: " << a_copyNumber);

    blk_DiskFRIWriter *fri_p =
        new blk_DiskFRIWriter(
            *m_manager.get(),
            a_id,
            a_migrationID,
            a_copyNumber,
            a_mediumKey,
            a_medVolNum,
            a_fsc);

    fri_p->Start();
}

Here is the call graph for this function:

void df_Writer::NewFRIBuffer ( const string &  a_id,
bool  a_createNew = false,
bool  a_createOnTmp = false,
bool  a_createInto = false,
cmn_Path  a_intoPath = "",
const string  a_extension = "" 
)

Definition at line 138 of file df_writer.cpp.

References log_FUNC_A_m, m_manager, and cmn_Thread::Start().

Referenced by df_FRI::MediumVolumeStart(), and NewFRIBuffer().

                                 {

    log_FUNC_A_m(NewFRIBuffer, "id: " << a_id);

    blk_DiskFRIWriter *fri_p =
        new blk_DiskFRIWriter( *m_manager.get(), 
                                a_id,
                                a_createOnTmp, 
                                a_createNew, 
                                a_createInto, 
                                a_intoPath, 
                                a_extension);
    fri_p->Start();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void df_Writer::NewNetBuffer ( i_UploadAgent_ptr  a_uploadAgt  )  [virtual]

Reimplemented from df_BlockProxyWriter.

Definition at line 199 of file df_writer.cpp.

References log_FUNC_A_m, m_manager, and cmn_Thread::Start().

                                                          {
    log_FUNC_A_m(NewNetBuffer, "uloadAgt: " << a_uploadAgt);

    blk_NetWriter *nw_p =
        new blk_NetWriter(*m_manager.get(), a_uploadAgt);
    nw_p->Start();
}

Here is the call graph for this function:

void df_Writer::NewStdIOBuffer ( const string &  a_id  )  [virtual]

Reimplemented from df_BlockProxyWriter.

Definition at line 207 of file df_writer.cpp.

References log_FUNC_m, m_manager, and cmn_Thread::Start().

                                                    {
    log_FUNC_m(NewStdIOBuffer);

    blk_StdIOWriter *db_p =
        new blk_StdIOWriter(*m_manager.get(), a_fName);
    db_p->Start();
}

Here is the call graph for this function:

void df_Writer::WaitAllReaders (  )  const

Definition at line 88 of file df_writer.cpp.

References log_FUNC_m, and m_manager.

Referenced by df_FRI::MediumVolumeEnd().

                                     {
    log_FUNC_m(WaitAllReaders);

    m_manager->WaitAllReaders();
}

Here is the caller graph for this function:


Member Data Documentation

Reimplemented from df_BlockProxyWriter.

Definition at line 730 of file df.h.

auto_ptr<df_MgrWriter> df_Writer::m_mgrWriter [private]

Definition at line 733 of file df.h.

Referenced by EndOfData(), FlushBlock(), GetNewBlock(), and Go().


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