Search in sources :

Example 1 with VisibilityLevel

use of org.apache.tephra.Transaction.VisibilityLevel in project phoenix by apache.

the class TephraTransactionContext method getVisibilityLevel.

@Override
public PhoenixVisibilityLevel getVisibilityLevel() {
    VisibilityLevel visibilityLevel = null;
    Transaction tx = getCurrentTransaction();
    assert (tx != null);
    visibilityLevel = tx.getVisibilityLevel();
    PhoenixVisibilityLevel phoenixVisibilityLevel;
    switch(visibilityLevel) {
        case SNAPSHOT:
            phoenixVisibilityLevel = PhoenixVisibilityLevel.SNAPSHOT;
            break;
        case SNAPSHOT_EXCLUDE_CURRENT:
            phoenixVisibilityLevel = PhoenixVisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT;
            break;
        case SNAPSHOT_ALL:
            phoenixVisibilityLevel = PhoenixVisibilityLevel.SNAPSHOT_ALL;
        default:
            phoenixVisibilityLevel = null;
    }
    return phoenixVisibilityLevel;
}
Also used : Transaction(org.apache.tephra.Transaction) VisibilityLevel(org.apache.tephra.Transaction.VisibilityLevel)

Example 2 with VisibilityLevel

use of org.apache.tephra.Transaction.VisibilityLevel in project phoenix by apache.

the class TephraTransactionContext method setVisibilityLevel.

@Override
public void setVisibilityLevel(PhoenixVisibilityLevel visibilityLevel) {
    VisibilityLevel tephraVisibilityLevel = null;
    switch(visibilityLevel) {
        case SNAPSHOT:
            tephraVisibilityLevel = VisibilityLevel.SNAPSHOT;
            break;
        case SNAPSHOT_EXCLUDE_CURRENT:
            tephraVisibilityLevel = VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT;
            break;
        case SNAPSHOT_ALL:
            tephraVisibilityLevel = VisibilityLevel.SNAPSHOT_ALL;
            break;
        default:
            assert (false);
    }
    Transaction tx = getCurrentTransaction();
    assert (tx != null);
    tx.setVisibility(tephraVisibilityLevel);
}
Also used : Transaction(org.apache.tephra.Transaction) VisibilityLevel(org.apache.tephra.Transaction.VisibilityLevel)

Aggregations

Transaction (org.apache.tephra.Transaction)2 VisibilityLevel (org.apache.tephra.Transaction.VisibilityLevel)2