ISwapAssistant Class Reference

Defines the general interface for a class that manages a list of resident RowBlocks (i.e., RowBlocks held in memory). More...

List of all members.

Public Member Functions

virtual void AddBlock (Simba::DSI::RowBlock *in_block)=0
 Add the given block to this swap assistant instance.
virtual bool CanAllocNewBlock (const Simba::DSI::RowBlockProperties &in_blockProperties) const =0
 Tell whether a new RowBlock can be allocated in memory.
virtual AutoPtr< ISwapAssistantClone () const =0
 Creates a clone of this object.
virtual Simba::DSI::RowBlockGetResidentBlock (simba_uint64 in_rowNumber)=0
 Find the resident block that contains the input row number.
virtual simba_uint64 GetResidentBlockCount () const =0
 Return the number of blocks held in memory.
virtual AutoPtr
< Simba::DSI::IResidentBlockIterator
GetResidentBlocks ()=0
 Return an iterator that iterates through all the resident RowBlocks held by this swap assistant instance.
virtual void OnFinishAppending (Simba::DSI::RowBlock *in_block)=0
 Inform this swap assistant that the SwapManager has finished performing AppendRow() on the given RowBlock.
virtual void OnFinishRetrieving (Simba::DSI::RowBlock *in_block)=0
 Informs this swap assistant object that the SwapManager has finished retrieving data on the given RowBlock.
virtual Simba::DSI::RowBlockReleaseBlock ()=0
 Find a RowBlock whose content will be swapped out onto the disk.
virtual void Reset ()=0
 Resets all resident blocks to empty state.
virtual ~ISwapAssistant ()
 Destructor.

Protected Member Functions

 ISwapAssistant ()
 Constructor.

Detailed Description

Defines the general interface for a class that manages a list of resident RowBlocks (i.e., RowBlocks held in memory).

ISwapAssistant is designed to cooperate with the SwapManager. An ISwapAssistant implementation's main responsibilities are the following,

ISwapAssistant is NOT responsible for how a RowBlock is read into and written out onto the disk or how a RowBlock is created. That's the responsibility of the SwapManager. In other words, an ISwapAssistant implementation *DOES NOT* own any of the RowBlocks that it manages whether it is resident or not. This design leaves it to only focus on state management of RowBlocks.


Constructor & Destructor Documentation

virtual ~ISwapAssistant (  )  [inline, virtual]

Destructor.

ISwapAssistant (  )  [inline, protected]

Constructor.


Member Function Documentation

virtual void AddBlock ( Simba::DSI::RowBlock in_block  )  [pure virtual]

Add the given block to this swap assistant instance.

The block adding is either newly created or released by ReleaseBlock().

Parameters:
in_block The block that will be added. (NOT OWN)
virtual bool CanAllocNewBlock ( const Simba::DSI::RowBlockProperties in_blockProperties  )  const [pure virtual]

Tell whether a new RowBlock can be allocated in memory.

Parameters:
in_blockProperties The RowBlockProperties for RowBlock being requested
Returns:
true if a new RowBlock can be allocated in memory, false otherwise.
virtual AutoPtr<ISwapAssistant> Clone (  )  const [pure virtual]

Creates a clone of this object.

The newly cloned object *MUST NOT* have any resident blocks initially.

Returns:
A clone of this object. (OWN)
virtual Simba::DSI::RowBlock* GetResidentBlock ( simba_uint64  in_rowNumber  )  [pure virtual]

Find the resident block that contains the input row number.

NOTE: This is probably the most often called method. It should be efficiently implemented. The caller continues to own the returned RowBlock object since an ISwapAssistant implementation should not own any of the RowBlock objects whether its resident or not.

Parameters:
in_rowNumber The row number that the output block should contain.
Returns:
the resident block that bears the given block number, NULL otherwise.
virtual simba_uint64 GetResidentBlockCount (  )  const [pure virtual]

Return the number of blocks held in memory.

Returns:
the number of blocks held in memory.
virtual AutoPtr<Simba::DSI::IResidentBlockIterator> GetResidentBlocks (  )  [pure virtual]

Return an iterator that iterates through all the resident RowBlocks held by this swap assistant instance.

Returns:
an iterator that iterates through all the RowBlocks. (OWN)
virtual void OnFinishAppending ( Simba::DSI::RowBlock in_block  )  [pure virtual]

Inform this swap assistant that the SwapManager has finished performing AppendRow() on the given RowBlock.

This gives the swap assistant an opportunity to optimize a series of ApppendRow() operations on the SwapManager.

This method is called in one of the following situations,

  • MoveToRow() is called on the SwapManager. The reason that the SwapManager does this is to make sure the appending RowBlock can be swapped if the swap assistant thinks so.
  • The user of the SwapManager explicitly calls MarkFinishAppending().
Parameters:
in_block The block that is about to be switched off. (NOT OWN)
virtual void OnFinishRetrieving ( Simba::DSI::RowBlock in_block  )  [pure virtual]

Informs this swap assistant object that the SwapManager has finished retrieving data on the given RowBlock.

This gives the swap assistant an opportunity to optimize a series of MoveToRow() operations on the SwapManager.

This method is called in one of the following situations,

  • AppendRow() is called on the SwapManager. The reason that the SwapManager does this is to make sure the last RowBlock that contains the last requested row can be swapped if the swap assistant thinks so.
  • The user of the SwapManager explicitly calls MarkFinishRetrieving().
Parameters:
in_block The block that is about to be switched off. (NOT OWN)
virtual Simba::DSI::RowBlock* ReleaseBlock (  )  [pure virtual]

Find a RowBlock whose content will be swapped out onto the disk.

This method cannot be called if CanAllocNewBlock() return true. Otherwise, the behaviour is undefined and is left to the implementation.

The caller must flush the contents of the block that is returned. After flushing, the caller needs to "return" the block back to this object by calling AddBlock().

NOTE: The caller should still owns the returned RowBlock object since an ISwapAssistant implementation does not actually own any of the RowBlock objects that it manages.

Returns:
a RowBlock whose content will be swapped out onto the disk. (OWN)
virtual void Reset (  )  [pure virtual]

Resets all resident blocks to empty state.

Once reset, the content of all resident blocks (if any) are effectively gone. There MUST NOT* be any resident blocks left. That is, GetResidentBlockCount() should return 0 and CanAllocNewBlock() should return true.


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

Generated on Wed May 17 14:21:16 2017 for SimbaEngine 10.1.3.1011 by simba