use of org.apache.hyracks.api.io.FileReference in project asterixdb by apache.
the class ExternalBTreeLocalResource method createInstance.
@Override
public ILSMIndex createInstance(INCServiceContext serviceCtx) throws HyracksDataException {
IIOManager ioManager = serviceCtx.getIoManager();
FileReference file = ioManager.resolve(path);
return LSMBTreeUtil.createExternalBTree(ioManager, file, storageManager.getBufferCache(serviceCtx), storageManager.getFileMapProvider(serviceCtx), typeTraits, cmpFactories, bloomFilterKeyFields, bloomFilterFalsePositiveRate, mergePolicyFactory.createMergePolicy(mergePolicyProperties, serviceCtx), opTrackerProvider.getOperationTracker(serviceCtx), ioSchedulerProvider.getIoScheduler(serviceCtx), ioOpCallbackFactory.createIoOpCallback(), durable, metadataPageManagerFactory);
}
use of org.apache.hyracks.api.io.FileReference in project asterixdb by apache.
the class BTreeResource method createInstance.
@Override
public IIndex createInstance(INCServiceContext ctx) throws HyracksDataException {
IBufferCache bufferCache = storageManager.getBufferCache(ctx);
IIOManager ioManager = ctx.getIoManager();
FileReference resourceRef = ioManager.resolve(path);
return BTreeUtils.createBTree(bufferCache, storageManager.getFileMapProvider(ctx), typeTraits, comparatorFactories, BTreeLeafFrameType.REGULAR_NSM, resourceRef, pageManagerFactory.createPageManager(bufferCache));
}
use of org.apache.hyracks.api.io.FileReference in project asterixdb by apache.
the class IndexDataflowHelperFactory method create.
@Override
public IIndexDataflowHelper create(IHyracksTaskContext ctx, int partition) throws HyracksDataException {
FileSplit fileSplit = fileSplitProvider.getFileSplits()[partition];
FileReference resourceRef = fileSplit.getFileReference(ctx.getIoManager());
return new IndexDataflowHelper(ctx.getJobletContext().getServiceContext(), storageMgr, resourceRef);
}
use of org.apache.hyracks.api.io.FileReference in project asterixdb by apache.
the class PersistentLocalResourceRepository method insert.
@Override
public synchronized void insert(LocalResource resource) throws HyracksDataException {
String relativePath = getFileName(resource.getPath());
FileReference resourceFile = ioManager.resolve(relativePath);
if (resourceFile.getFile().exists()) {
throw new HyracksDataException("Duplicate resource: " + resourceFile.getAbsolutePath());
} else {
resourceFile.getFile().getParentFile().mkdirs();
}
resourceCache.put(resource.getPath(), resource);
try (FileOutputStream fos = new FileOutputStream(resourceFile.getFile());
ObjectOutputStream oosToFos = new ObjectOutputStream(fos)) {
oosToFos.writeObject(resource);
oosToFos.flush();
} catch (IOException e) {
throw new HyracksDataException(e);
}
//if replication enabled, send resource metadata info to remote nodes
if (isReplicationEnabled) {
createReplicationJob(ReplicationOperation.REPLICATE, resourceFile);
}
}
use of org.apache.hyracks.api.io.FileReference in project asterixdb by apache.
the class TransientFileMapManager method unregisterFile.
@Override
public void unregisterFile(int fileId) throws HyracksDataException {
FileReference fileRef = id2nameMap.remove(fileId);
name2IdMap.remove(fileRef);
}
Aggregations