use of com.orientechnologies.orient.core.storage.fs.OFile in project orientdb by orientechnologies.
the class OStorageConfigurationSegment method update.
@Override
public void update() throws OSerializationException {
try {
final OFile f = segment.getFile();
if (!f.isOpen())
return;
final byte[] buffer = toStream();
final int len = buffer.length + OBinaryProtocol.SIZE_INT;
if (len > f.getFileSize())
f.allocateSpace(len - f.getFileSize());
f.writeInt(0, buffer.length);
f.write(OBinaryProtocol.SIZE_INT, buffer);
if (OGlobalConfiguration.STORAGE_CONFIGURATION_SYNC_ON_UPDATE.getValueAsBoolean())
f.synch();
} catch (Exception e) {
throw OException.wrapException(new OSerializationException("Error on update storage configuration"), e);
}
}
use of com.orientechnologies.orient.core.storage.fs.OFile in project orientdb by orientechnologies.
the class OStorageConfigurationSegment method create.
public void create() throws IOException {
segment.create(START_SIZE);
super.create();
final OFile f = segment.getFile();
if (OGlobalConfiguration.STORAGE_CONFIGURATION_SYNC_ON_UPDATE.getValueAsBoolean())
f.synch();
}
Aggregations