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);
}
}
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);
}
}
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);
}
}
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));
}
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);
}
Aggregations