public DataTable(final File filePath, final PagePool pool) throws IOException { myFile = new RandomAccessDataFile(filePath, pool); if (myFile.length() == 0) { markDirty(); } else { readInHeader(filePath); } }
protected AbstractStorage(String storageFilePath, PagePool pool, CapacityAllocationPolicy capacityAllocationPolicy) throws IOException { myCapacityAllocationPolicy = capacityAllocationPolicy != null ? capacityAllocationPolicy : CapacityAllocationPolicy.DEFAULT; tryInit(storageFilePath, pool, 0); }
public AbstractRecordsTable(final File storageFilePath, final PagePool pool) throws IOException { myStorage = new RandomAccessDataFile(storageFilePath, pool); if (myStorage.length() == 0) { myStorage.put(0, new byte[getHeaderSize()], 0, getHeaderSize()); markDirty(); } else { if (myStorage.getInt(HEADER_MAGIC_OFFSET) != getSafelyClosedMagic()) { myStorage.dispose(); throw new IOException("Records table for '" + storageFilePath + "' haven't been closed correctly. Rebuild required."); } } }
public LocalHistoryRecordsTable(final File storageFilePath, final PagePool pool) throws IOException { super(storageFilePath, pool); }
public LocalHistoryStorage(String storageFilePath, PagePool pool) throws IOException { super(storageFilePath, pool); }
@Override protected AbstractRecordsTable createRecordsTable(PagePool pool, File recordsFile) throws IOException { return new LocalHistoryRecordsTable(recordsFile, pool); }
public CompactRecordsTable(File recordsFile, PagePool pool, boolean forceSplit) throws IOException { super(recordsFile, pool); zeroes = new byte[getRecordSize()]; this.forceSplit = forceSplit; }
@Override protected AbstractRecordsTable createRecordsTable(PagePool pool, File recordsFile) throws IOException { return new CompactRecordsTable(recordsFile, pool, false); }
@Override protected AbstractRecordsTable createRecordsTable(PagePool pool, File recordsFile) throws IOException { return new RefCountingRecordsTable(recordsFile, pool); }
protected AbstractStorage(String storageFilePath) throws IOException { this(storageFilePath, PagePool.SHARED); }
protected AbstractStorage(String storageFilePath, PagePool pool) throws IOException { this(storageFilePath, pool, CapacityAllocationPolicy.DEFAULT); }
protected AbstractStorage(String storageFilePath, CapacityAllocationPolicy capacityAllocationPolicy) throws IOException { this(storageFilePath, PagePool.SHARED, capacityAllocationPolicy); }
private void tryInit(String storageFilePath, PagePool pool, int retryCount) throws IOException { convertFromOldExtensions(storageFilePath); final File recordsFile = new File(storageFilePath + INDEX_EXTENSION); final File dataFile = new File(storageFilePath + DATA_EXTENSION); if (recordsFile.exists() != dataFile.exists()) { deleteFiles(storageFilePath); } FileUtil.createIfDoesntExist(recordsFile); FileUtil.createIfDoesntExist(dataFile); AbstractRecordsTable recordsTable = null; DataTable dataTable; try { recordsTable = createRecordsTable(pool, recordsFile); dataTable = new DataTable(dataFile, pool); } catch (IOException e) { LOG.info(e.getMessage()); if (recordsTable != null) { recordsTable.dispose(); } boolean deleted = deleteFiles(storageFilePath); if (!deleted) { throw new IOException("Can't delete caches at: " + storageFilePath); } if (retryCount >= 5) { throw new IOException("Can't create storage at: " + storageFilePath); } tryInit(storageFilePath, pool, retryCount+1); return; } myRecordsTable = recordsTable; myDataTable = dataTable; myPool = pool; if (myDataTable.isCompactNecessary()) { compact(storageFilePath); } }
public RefCountingRecordsTable(File recordsFile, PagePool pool) throws IOException { super(recordsFile, pool); }
RecordsTable(File storageFilePath, PagePool pool) throws IOException { super(storageFilePath, pool); }
public Storage(String path, PagePool pool) throws IOException { super(path, pool); }
@Override protected AbstractRecordsTable createRecordsTable(PagePool pool, File recordsFile) throws IOException { return new RecordsTable(recordsFile, pool); }