/** * Determines if a storage with the given URI already exists. * * @param uri Storage URI. * @throws java.io.IOException in case of I/O error. * @return a boolean. */ protected boolean exists(URI uri) throws IOException { return exists(getPath(uri)); }
/** * Determines if the header should be validated. * * @param uri Storage URI * @throws java.io.IOException if header validation fails * @return a boolean. */ protected boolean shouldValidateHeader(URI uri) throws IOException { return shouldValidateHeader(getPath(uri)); }
/** * Creates RrdBackend object for the given storage path. * @param rrdDb * * @param uri Storage uri * @param readOnly True, if the storage should be accessed in read/only mode. * False otherwise. * @return Backend object which handles all I/O operations for the given storage path * @throws java.io.IOException Thrown in case of I/O error. */ RrdBackend getBackend(RrdDb rrdDb, URI uri, boolean readOnly) throws IOException { checkClosing(); RrdBackend backend = open(getPath(uri), readOnly); backend.done(this, new ClosingReference(rrdDb, backend, refQueue)); return backend; }
RrdDb requestRrdDb(URI uri, RrdBackendFactory factory) throws IOException { uri = factory.getCanonicalUri(uri); RrdEntry ref = null; try { ref = getEntry(uri, true); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IllegalStateException("request interrupted for " + uri, e); } //Someone might have already open it, rechecks if (ref.count == 0) { try { ref.rrdDb = RrdDb.getBuilder().setPath(factory.getPath(uri)).setBackendFactory(factory).setPool(this).build(); } catch (IOException | RuntimeException e) { passNext(ACTION.DROP, ref); throw e; } } ref.count++; passNext(ACTION.SWAP, ref); return ref.rrdDb; }