@Override public void perform( FileSystemAbstraction fs, String fileName, File directory, boolean skipNonExistentFromFile, File unusedFile, ExistingTargetStrategy unused ) { File file = fromFile( fs, directory, fileName, skipNonExistentFromFile ); if ( file != null ) { fs.deleteFile( file ); } } };
@Override public boolean deleteFile( File fileName ) { return delegate.deleteFile( fileName ); }
@Override public boolean deleteFile( File fileName ) { return fs.deleteFile( fileName ); }
/** * Delete failure file for the given index id * */ public synchronized void clearForIndex() { fs.deleteFile( failureFile() ); }
@Override public void accept( long version ) { fromVersion = fromVersion == NO_VERSION ? version : Math.min( fromVersion, version ); toVersion = toVersion == NO_VERSION ? version : Math.max( toVersion, version ); File logFile = logFiles.getLogFileForVersion( version ); fs.deleteFile( logFile ); }
@Override public synchronized void closeAndDelete() throws IOException { close(); fs.deleteFile( file ); }
@Override public void purge() throws IOException { super.purge(); // Clears all cached data // Delete the file if ( !fileSystem.deleteFile( authFile ) ) { throw new IOException( "Failed to delete file '" + authFile.getAbsolutePath() + "'" ); } }
@Override public boolean deleteFile( File fileName ) { return chooseFileSystem( fileName ).deleteFile( fileName ); }
@Override public boolean deleteFile( File fileName ) { adversary.injectFailure( SecurityException.class ); return delegate.deleteFile( fileName ); }
private void cleanupCountsForRebuilding() { fs.deleteFile( alphaStoreFile() ); fs.deleteFile( betaStoreFile() ); }
@Before public void createStore() { file = new File( "target/test-data/index-provider-store" ); fileSystem = new DefaultFileSystemAbstraction(); file.mkdirs(); fileSystem.deleteFile( file ); }
private void truncateLogFiles( long recoveredTransactionLogVersion, long recoveredTransactionOffset ) throws IOException { File lastRecoveredTransactionLog = logFiles.getLogFileForVersion( recoveredTransactionLogVersion ); fs.truncate( lastRecoveredTransactionLog, recoveredTransactionOffset ); forEachSubsequentLogFile( recoveredTransactionLogVersion, fileIndex -> fs.deleteFile( logFiles.getLogFileForVersion( fileIndex ) ) ); }
private File fileContaining( FileSystemAbstraction fs, String content ) throws IOException { File shortFile = directory.file( "file" ); fs.deleteFile( shortFile ); try ( OutputStream outputStream = fs.openAsOutputStream( shortFile, false ) ) { outputStream.write( UTF8.encode( content ) ); return shortFile; } } }
private void deleteCounts( FileSystemAbstraction snapshot ) { DatabaseLayout databaseLayout = testDirectory.databaseLayout(); File alpha = databaseLayout.countStoreA(); File beta = databaseLayout.countStoreB(); assertTrue( snapshot.deleteFile( alpha ) ); assertTrue( snapshot.deleteFile( beta ) ); }
@Test void streamFilesRecursiveMustThrowWhenDeletingNonExistingFile() throws Exception { File a = existingFile( "a" ); FileHandle handle = fsa.streamFilesRecursive( a ).findAny().get(); fsa.deleteFile( a ); assertThrows( NoSuchFileException.class, handle::delete ); }
private File emptyFile( FileSystemAbstraction fs ) throws IOException { File shortFile = directory.file( "empty" ); fs.deleteFile( shortFile ); fs.create( shortFile ).close(); return shortFile; }
private void deleteIndexFilesFor( IndexProviderDescriptor descriptor ) { File databaseDirectory = this.databaseLayout.databaseDirectory(); File rootDirectory = subProviderDirectoryStructure( databaseDirectory ).forProvider( descriptor ).rootDirectory(); File[] files = fs.listFiles( rootDirectory ); for ( File indexFile : files ) { fs.deleteFile( indexFile ); } }
private void replaceLabelIndexWithCopy( File labelIndexFileCopy ) throws IOException { db.restartDatabase( ( fs, directory ) -> { DatabaseLayout databaseLayout = db.databaseLayout(); fs.deleteFile( databaseLayout.labelScanStore() ); fs.copyFile( labelIndexFileCopy, databaseLayout.labelScanStore() ); } ); }
private void prepareEmpty23Database() throws IOException { new TestGraphDatabaseFactory().newEmbeddedDatabase( storeDir ).shutdown(); fileSystem.deleteFile( nativeLabelIndex ); MetaDataStore.setRecord( pageCache, databaseLayout.metadataStore(), Position.STORE_VERSION, versionStringToLong( StandardV2_3.STORE_VERSION ) ); }
@Test public void upgradeShouldNotLeaveLeftoverAndMigrationDirs() throws Exception { // Given fileSystem.deleteFile( databaseLayout.file( INTERNAL_LOG_FILE ) ); PageCache pageCache = pageCacheRule.getPageCache( fileSystem ); UpgradableDatabase upgradableDatabase = getUpgradableDatabase( pageCache ); // When newUpgrader( upgradableDatabase, allowMigrateConfig, pageCache ).migrateIfNeeded( databaseLayout ); // Then assertThat( migrationHelperDirs(), is( emptyCollectionOf( File.class ) ) ); }