/** * @param repositoryManager * @param peerName * @throws FileNotFoundException */ public FSBlockRepository(FSRepositoryManager repositoryManager, String directoryPath) { super(repositoryManager); if (directoryPath == null) { throw new RuntimeException("DirectoryPath cannot be null"); } this.directoryPath = directoryPath; this.usedSpace = getUsedSpace(); try { BitCoopFile dirFile = new BitCoopFile(directoryPath); dirFile.mkdirs(); openIndex(); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } }
/*junit*/ BitCoopFile getFileForId(long blockId) { BitCoopFile parent = new BitCoopFile(getFilePath(blockId)); parent.mkdirs(); return new BitCoopFile(parent, "data"); }