class ToFileStoreWriter implements StoreWriter {

    @Override
    public long write( String path, ReadableByteChannel data, ByteBuffer temporaryBuffer, boolean hasData,
            int requiredElementAlignment ) throws IOException
    {
        try
        {
            temporaryBuffer.clear();
            File file = new File( basePath, path );
            file.getParentFile().mkdirs();

            String fullFilePath = file.toString();

            monitor.startReceivingStoreFile( fullFilePath );
            try
            {
                // We don't add file move actions for these files. The reason is that we will perform the file moves
                // *after* we have done recovery on the store, and this may delete some files, and add other files.
                return writeDataThroughFileSystem( file, data, temporaryBuffer, hasData );
            }
            finally
            {
                monitor.finishReceivingStoreFile( fullFilePath );
            }
        }
        catch ( Throwable t )
        {
            throw new IOException( t );
        }
    }

    public  ToFileStoreWriter( File graphDbStoreDir, FileSystemAbstraction fs,
            StoreCopyClientMonitor storeCopyClientMonitor );

}