@Override public String getPath() { return resource.getPath(); }
@Override public IIndex createInstance(INCServiceContext ncServiceCtx) throws HyracksDataException { return resource.createInstance(ncServiceCtx); }
@Override public void setPath(String path) { resource.setPath(path); }
@Override public JsonNode toJson(IPersistedResourceRegistry registry) throws HyracksDataException { ObjectNode json = registry.getClassIdentifier(getClass(), serialVersionUID); json.put("id", id); json.put("version", version); json.put("durable", durable); json.set("resource", resource.toJson(registry)); return json; }
@Override public JsonNode toJson(IPersistedResourceRegistry registry) throws HyracksDataException { ObjectNode json = registry.getClassIdentifier(getClass(), serialVersionUID); json.put("datasetId", datasetId); json.put("partition", partition); json.set("resource", resource.toJson(registry)); return json; }
/** * @return the resource relative path */ public String getPath() { return resource.getPath(); }
private LocalResource readIndex() throws HyracksDataException { // Get local resource LocalResource lr = getResource(); if (lr == null) { throw HyracksDataException.create(ErrorCode.INDEX_DOES_NOT_EXIST); } IResource resource = lr.getResource(); index = resource.createInstance(ctx); return lr; }
@Override public ILSMComponentIdGenerator getComponentIdGenerator(INCServiceContext serviceCtx, IResource resource) throws HyracksDataException { IDatasetLifecycleManager dslcManager = ((INcApplicationContext) serviceCtx.getApplicationContext()).getDatasetLifecycleManager(); int partition = StoragePathUtil.getPartitionNumFromRelativePath(resource.getPath()); return dslcManager.getComponentIdGenerator(datasetId, partition, resource.getPath()); }
IoUtil.delete(resourceRef); index = resource.createInstance(ctx);
@Override public ILSMOperationTracker getOperationTracker(INCServiceContext ctx, IResource resource) throws HyracksDataException { IDatasetLifecycleManager dslcManager = ((INcApplicationContext) ctx.getApplicationContext()).getDatasetLifecycleManager(); int partition = StoragePathUtil.getPartitionNumFromRelativePath(resource.getPath()); return dslcManager.getOperationTracker(datasetId, partition, resource.getPath()); }
@Override public ILSMOperationTracker getOperationTracker(INCServiceContext ctx, IResource resource) { try { INcApplicationContext appCtx = (INcApplicationContext) ctx.getApplicationContext(); DatasetLifecycleManager dslcManager = (DatasetLifecycleManager) appCtx.getDatasetLifecycleManager(); DatasetResource dsr = dslcManager.getDatasetLifecycle(datasetId); int partition = StoragePathUtil.getPartitionNumFromRelativePath(resource.getPath()); PrimaryIndexOperationTracker opTracker = dslcManager.getOperationTracker(datasetId, partition, resource.getPath()); if (!(opTracker instanceof TestPrimaryIndexOperationTracker)) { Field opTrackersField = DatasetResource.class.getDeclaredField("datasetPrimaryOpTrackers"); opTracker = new TestPrimaryIndexOperationTracker(datasetId, partition, appCtx.getTransactionSubsystem().getLogManager(), dsr.getDatasetInfo(), dslcManager.getComponentIdGenerator(datasetId, partition, resource.getPath())); replaceMapEntry(opTrackersField, dsr, partition, opTracker); } return opTracker; } catch (Exception e) { throw new RuntimeException(e); } }