public DBSharder getDB(Long timestamp) { try { Long timeshard = DateTimeHelper.getTimesMorning(timestamp); //log.info("timestamp:" + timestamp + " shard:" + timeshard + " befor:" + DateTimeHelper.getBeforeDay(fieryConfig.getKeepdataday())); if (timeshard > DateTimeHelper.getBeforeDay(fieryConfig.getKeepdataday()) && timeshard <= DateTimeHelper.getCurrentTime()) { if (dbSharderList.containsKey(timeshard)) { return dbSharderList.get(timeshard); } dbSharderList.put(timeshard, new DBSharder(fieryConfig.getDbpath(), timeshard)); return dbSharderList.get(timeshard); } else { log.info("out of the date:" + timeshard); return null; } } catch (RocksDBException e) { e.printStackTrace(); log.error(e.getMessage()); return null; } }
private void flagVisitedVariant(byte[] key, VariantAvro variantAvro) { // The annotation.additionalAttributes field is initialized with an empty map to flag this variant as // already visited variantAvro.getAnnotation().setAdditionalAttributes(Collections.emptyMap()); try { dbIndex.put(key, jsonObjectWriter.writeValueAsBytes(variantAvro)); } catch (RocksDBException e) { e.printStackTrace(); } catch (JsonProcessingException e) { e.printStackTrace(); } }
private Object[] getDBConnection(String dbLocation, boolean forceCreate) { boolean indexingNeeded = forceCreate || !Files.exists(Paths.get(dbLocation)); // a static method that loads the RocksDB C++ library. RocksDB.loadLibrary(); // the Options class contains a set of configurable DB options // that determines the behavior of a database. Options options = new Options().setCreateIfMissing(true); RocksDB db = null; try { // a factory method that returns a RocksDB instance if (indexingNeeded) { db = RocksDB.open(options, dbLocation); } else { db = RocksDB.openReadOnly(options, dbLocation); } // do something } catch (RocksDBException e) { // do some error handling e.printStackTrace(); System.exit(1); } return new Object[]{db, options, dbLocation, indexingNeeded}; }
private Object[] getDBConnection(String dbLocation, boolean forceCreate) { boolean indexingNeeded = forceCreate || !Files.exists(Paths.get(dbLocation)); // a static method that loads the RocksDB C++ library. RocksDB.loadLibrary(); // the Options class contains a set of configurable DB options // that determines the behavior of a database. Options options = new Options().setCreateIfMissing(true); if (maxOpenFiles > 0) { options.setMaxOpenFiles(maxOpenFiles); } RocksDB db = null; try { // a factory method that returns a RocksDB instance if (indexingNeeded) { db = RocksDB.open(options, dbLocation); } else { db = RocksDB.openReadOnly(options, dbLocation); } // do something } catch (RocksDBException e) { // do some error handling e.printStackTrace(); System.exit(1); } return new Object[]{db, options, dbLocation, indexingNeeded}; }
exonSequence = fastaIndexManager.query(gtf.getSequenceName(), gtf.getStart(), gtf.getEnd()); } catch (RocksDBException e) { e.printStackTrace();