Search in sources :

Example 1 with OFile

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);
    }
}
Also used : OFile(com.orientechnologies.orient.core.storage.fs.OFile) OSerializationException(com.orientechnologies.orient.core.exception.OSerializationException) OException(com.orientechnologies.common.exception.OException) IOException(java.io.IOException) OSerializationException(com.orientechnologies.orient.core.exception.OSerializationException)

Example 2 with OFile

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();
}
Also used : OFile(com.orientechnologies.orient.core.storage.fs.OFile)

Aggregations

OFile (com.orientechnologies.orient.core.storage.fs.OFile)2 OException (com.orientechnologies.common.exception.OException)1 OSerializationException (com.orientechnologies.orient.core.exception.OSerializationException)1 IOException (java.io.IOException)1