public StatsDataStore(File directory){
  if (!directory.exists())   directory.mkdirs();
  cumulativeStats=Caffeine.newBuilder().maximumSize(1_000_000).refreshAfterWrite(60,TimeUnit.MINUTES).build(null);
  DBMaker dbm=DBMaker.newFileDB(new File(directory,"stats.db")).mmapFileEnableIfSupported().cacheWeakRefEnable().cacheSize(2_500_000).compressionEnable().asyncWriteEnable().asyncWriteFlushDelay(1000).closeOnJvmShutdown();
  db=dbm.make();
  BTreeMapMaker statsMapMaker=db.createTreeMap("statsMap");
  statsMap=statsMapMaker.keySerializer(BTreeKeySerializer.TUPLE2).valueSerializer(new SegmentStatisticsSerializer()).makeOrGet();
  DB.BTreeSetMaker weekSetMaker=db.createTreeSet("weekSet");
  weekSet=weekSetMaker.serializer(BTreeKeySerializer.ZERO_OR_POSITIVE_INT).makeOrGet();
  executor=Executors.newFixedThreadPool(1);
  Runnable statsCollector=null;
  executor.execute(statsCollector);
}

public StatsDataStore ( File directory ) { if ( ! directory . exists ( ) ) directory . mkdirs ( ) ; cumulativeStats = Caffeine . newBuilder ( ) . maximumSize ( 1_000_000 ) . refreshAfterWrite ( 60 , TimeUnit . MINUTES ) . build ( null ) ; DBMaker dbm = DBMaker . newFileDB ( new File ( directory , "stats.db" ) ) . mmapFileEnableIfSupported ( ) . cacheWeakRefEnable ( ) . cacheSize ( 2_500_000 ) . compressionEnable ( ) . asyncWriteEnable ( ) . asyncWriteFlushDelay ( 1000 ) . closeOnJvmShutdown ( ) ; db = dbm . make ( ) ; BTreeMapMaker statsMapMaker = db . createTreeMap ( "statsMap" ) ; statsMap = statsMapMaker . keySerializer ( BTreeKeySerializer . TUPLE2 ) . valueSerializer ( new SegmentStatisticsSerializer ( ) ) . makeOrGet ( ) ; DB . BTreeSetMaker weekSetMaker = db . createTreeSet ( "weekSet" ) ; weekSet = weekSetMaker . serializer ( BTreeKeySerializer . ZERO_OR_POSITIVE_INT ) . makeOrGet ( ) ; executor = Executors . newFixedThreadPool ( 1 ) ; Runnable statsCollector = null ; executor . execute ( statsCollector ) ; }
create a new datastore .
