net.sf.farrago.namespace
Interface FarragoMedLocalDataServer

All Superinterfaces:
ClosableAllocation, FarragoAllocation, FarragoMedDataServer
All Known Implementing Classes:
FtrsDataServer, LcsDataServer, MedAbstractFennelDataServer, MedAbstractLocalDataServer, MedMockLocalDataServer

public interface FarragoMedLocalDataServer
extends FarragoMedDataServer

FarragoMedLocalDataServer represents a FarragoMedDataServer instance originating from a FarragoMedDataWrapper managing local data. It defines extra methods not relevant in the context of foreign data.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/namespace/FarragoMedLocalDataServer.java#23 $
Author:
John V. Sichi

Field Summary
 
Fields inherited from interface net.sf.farrago.namespace.FarragoMedDataServer
PROP_SERVER_NAME, PROP_SERVER_TYPE, PROP_SERVER_VERSION
 
Method Summary
 FarragoMedLocalIndexStats computeIndexStats(FemLocalIndex index, long rootPageId, boolean estimate, FennelTxnContext txnContext)
          Verifies an index and returns its page count.
 RelNode constructIndexBuildPlan(RelOptTable table, FemLocalIndex index, RelOptCluster cluster)
          Creates a plan for loading existing rows of a table into an index.
 long createIndex(FemLocalIndex index, FennelTxnContext txnContext)
          Creates an index.
 void dropIndex(FemLocalIndex index, long rootPageId, boolean truncate, FennelTxnContext txnContext)
          Drops or truncates an index.
 void setFennelDbHandle(FennelDbHandle fennelDbHandle)
          Sets the Fennel database handle to use for accessing local storage.
 boolean supportsAlterTableAddColumn()
          Checks whether ALTER TABLE ADD COLUMN is implemented for tables stored by this local data server.
 void validateTableDefinition(FemLocalTable table, FemLocalIndex generatedPrimaryKeyIndex)
          Validates the definition of a table being created.
 void validateTableDefinition(FemLocalTable table, FemLocalIndex generatedPrimaryKeyIndex, boolean creation)
          Validates the definition of a table being created.
 void versionIndexRoot(Long oldRoot, Long newRoot, FennelTxnContext txnContext)
          Versions the root page of an index
 
Methods inherited from interface net.sf.farrago.namespace.FarragoMedDataServer
getNameDirectory, getRuntimeSupport, newColumnSet, registerRelMetadataProviders, registerRules, releaseResources, setLoopbackDataSource
 
Methods inherited from interface org.eigenbase.util.ClosableAllocation
closeAllocation
 

Method Detail

setFennelDbHandle

void setFennelDbHandle(FennelDbHandle fennelDbHandle)
Sets the Fennel database handle to use for accessing local storage.

Parameters:
fennelDbHandle - the handle to use

validateTableDefinition

void validateTableDefinition(FemLocalTable table,
                             FemLocalIndex generatedPrimaryKeyIndex)
                             throws SQLException
Validates the definition of a table being created. May have side-effects such as creating additional system-maintained indexes.

Parameters:
table - definition of the table being created
generatedPrimaryKeyIndex - if non-null, a reference to an index generated by the system to enforce the primary key
Throws:
SQLException

validateTableDefinition

void validateTableDefinition(FemLocalTable table,
                             FemLocalIndex generatedPrimaryKeyIndex,
                             boolean creation)
                             throws SQLException
Validates the definition of a table being created. May have side-effects such as creating additional system-maintained indexes.

Parameters:
table - definition of the table being created
generatedPrimaryKeyIndex - if non-null, a reference to an index generated by the system to enforce the primary key
creation - true if the table being validated is being newly created
Throws:
SQLException

createIndex

long createIndex(FemLocalIndex index,
                 FennelTxnContext txnContext)
                 throws SQLException
Creates an index.

Parameters:
index - definition of the index to create
txnContext - Fennel txn context
Returns:
root PageId of index
Throws:
SQLException

dropIndex

void dropIndex(FemLocalIndex index,
               long rootPageId,
               boolean truncate,
               FennelTxnContext txnContext)
               throws SQLException
Drops or truncates an index.

Parameters:
index - definition of the index to drop
rootPageId - root PageId of index
truncate - if true, only truncate storage; if false, drop storage entirely
txnContext - Fennel txn context
Throws:
SQLException

computeIndexStats

FarragoMedLocalIndexStats computeIndexStats(FemLocalIndex index,
                                            long rootPageId,
                                            boolean estimate,
                                            FennelTxnContext txnContext)
                                            throws SQLException
Verifies an index and returns its page count.

Parameters:
index - definition of the index to verify
rootPageId - root PageId of index
estimate - whether to estimate statistics for a quicker result (and at the cost of no unique key count)
txnContext - Fennel txn context
Returns:
index statistics for the specified index
Throws:
SQLException

constructIndexBuildPlan

RelNode constructIndexBuildPlan(RelOptTable table,
                                FemLocalIndex index,
                                RelOptCluster cluster)
Creates a plan for loading existing rows of a table into an index. Typically, the topmost node of this plan will be a FarragoIndexBuilderRel, and this plugin will supply a rule which transforms that into a corresponding physical rel for writing to the index. Where possible, the returned plan should consist of logical rels, increasing optimization potential.

Parameters:
table - the optimizer representation for the indexed table
index - the index to be loaded
cluster - container for newly created relational expressions
Returns:
plan which will be used as input to optimization

versionIndexRoot

void versionIndexRoot(Long oldRoot,
                      Long newRoot,
                      FennelTxnContext txnContext)
                      throws SQLException
Versions the root page of an index

Parameters:
oldRoot - original root page
newRoot - new versioned, root page
txnContext - Fennel txn context
Throws:
SQLException

supportsAlterTableAddColumn

boolean supportsAlterTableAddColumn()
Checks whether ALTER TABLE ADD COLUMN is implemented for tables stored by this local data server.

Returns:
whether ALTER TABLE ADD COLUMN can be executed