Search in sources :

Example 6 with FeedConnection

use of org.apache.asterix.metadata.entities.FeedConnection in project asterixdb by apache.

the class MetadataLockManager method startFeedBegin.

public void startFeedBegin(LockList locks, String dataverseName, String feedName, List<FeedConnection> feedConnections) throws AsterixException {
    acquireDataverseReadLock(locks, dataverseName);
    acquireFeedReadLock(locks, feedName);
    for (FeedConnection feedConnection : feedConnections) {
        // what if the dataset is in a different dataverse
        String fqName = dataverseName + "." + feedConnection.getDatasetName();
        acquireDatasetReadLock(locks, fqName);
    }
}
Also used : FeedConnection(org.apache.asterix.metadata.entities.FeedConnection)

Example 7 with FeedConnection

use of org.apache.asterix.metadata.entities.FeedConnection in project asterixdb by apache.

the class MetadataNode method getFeedConnection.

@Override
public FeedConnection getFeedConnection(JobId jobId, String dataverseName, String feedName, String datasetName) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = createTuple(dataverseName, feedName, datasetName);
        FeedConnectionTupleTranslator tupleReaderWriter = new FeedConnectionTupleTranslator(false);
        List<FeedConnection> results = new ArrayList<>();
        IValueExtractor<FeedConnection> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        searchIndex(jobId, MetadataPrimaryIndexes.FEED_CONNECTION_DATASET, searchKey, valueExtractor, results);
        if (!results.isEmpty()) {
            return results.get(0);
        }
        return null;
    } catch (HyracksDataException e) {
        throw new MetadataException(e);
    }
}
Also used : MetadataEntityValueExtractor(org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor) FeedConnection(org.apache.asterix.metadata.entities.FeedConnection) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ArrayList(java.util.ArrayList) FeedConnectionTupleTranslator(org.apache.asterix.metadata.entitytupletranslators.FeedConnectionTupleTranslator) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 8 with FeedConnection

use of org.apache.asterix.metadata.entities.FeedConnection in project asterixdb by apache.

the class MetadataNode method getFeedConnections.

@Override
public List<FeedConnection> getFeedConnections(JobId jobId, String dataverseName, String feedName) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = createTuple(dataverseName, feedName);
        FeedConnectionTupleTranslator tupleReaderWriter = new FeedConnectionTupleTranslator(false);
        List<FeedConnection> results = new ArrayList<>();
        IValueExtractor<FeedConnection> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        searchIndex(jobId, MetadataPrimaryIndexes.FEED_CONNECTION_DATASET, searchKey, valueExtractor, results);
        return results;
    } catch (HyracksDataException e) {
        throw new MetadataException(e);
    }
}
Also used : MetadataEntityValueExtractor(org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor) FeedConnection(org.apache.asterix.metadata.entities.FeedConnection) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ArrayList(java.util.ArrayList) FeedConnectionTupleTranslator(org.apache.asterix.metadata.entitytupletranslators.FeedConnectionTupleTranslator) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 9 with FeedConnection

use of org.apache.asterix.metadata.entities.FeedConnection in project asterixdb by apache.

the class MetadataTransactionContext method dropFeedConnection.

public void dropFeedConnection(String dataverseName, String feedName, String datasetName) {
    FeedConnection feedConnection = new FeedConnection(dataverseName, feedName, datasetName, null, null, null);
    droppedCache.addFeedConnectionIfNotExists(feedConnection);
    logAndApply(new MetadataLogicalOperation(feedConnection, false));
}
Also used : FeedConnection(org.apache.asterix.metadata.entities.FeedConnection)

Example 10 with FeedConnection

use of org.apache.asterix.metadata.entities.FeedConnection in project asterixdb by apache.

the class MetadataManager method dropFeed.

@Override
public void dropFeed(MetadataTransactionContext ctx, String dataverse, String feedName) throws MetadataException {
    Feed feed = null;
    List<FeedConnection> feedConnections = null;
    try {
        feed = metadataNode.getFeed(ctx.getJobId(), dataverse, feedName);
        feedConnections = metadataNode.getFeedConnections(ctx.getJobId(), dataverse, feedName);
        metadataNode.dropFeed(ctx.getJobId(), dataverse, feedName);
        for (FeedConnection feedConnection : feedConnections) {
            metadataNode.dropFeedConnection(ctx.getJobId(), dataverse, feedName, feedConnection.getDatasetName());
            ctx.dropFeedConnection(dataverse, feedName, feedConnection.getDatasetName());
        }
    } catch (RemoteException e) {
        throw new MetadataException(e);
    }
    ctx.dropFeed(feed);
}
Also used : FeedConnection(org.apache.asterix.metadata.entities.FeedConnection) RemoteException(java.rmi.RemoteException) Feed(org.apache.asterix.metadata.entities.Feed)

Aggregations

FeedConnection (org.apache.asterix.metadata.entities.FeedConnection)14 ArrayList (java.util.ArrayList)6 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)6 Feed (org.apache.asterix.metadata.entities.Feed)5 RemoteException (java.rmi.RemoteException)4 ACIDException (org.apache.asterix.common.exceptions.ACIDException)4 FunctionSignature (org.apache.asterix.common.functions.FunctionSignature)4 AlgebricksException (org.apache.hyracks.algebricks.common.exceptions.AlgebricksException)4 IOException (java.io.IOException)3 ActiveJobNotificationHandler (org.apache.asterix.active.ActiveJobNotificationHandler)3 ActiveLifecycleListener (org.apache.asterix.active.ActiveLifecycleListener)3 EntityId (org.apache.asterix.active.EntityId)3 AsterixException (org.apache.asterix.common.exceptions.AsterixException)3 CompilationException (org.apache.asterix.common.exceptions.CompilationException)3 MetadataException (org.apache.asterix.metadata.MetadataException)3 MetadataTransactionContext (org.apache.asterix.metadata.MetadataTransactionContext)3 Dataset (org.apache.asterix.metadata.entities.Dataset)3 Function (org.apache.asterix.metadata.entities.Function)3 List (java.util.List)2 FeedDataSource (org.apache.asterix.metadata.declared.FeedDataSource)2