@Override public int writeTo(OFile file, long pos, ORecordVersion version) throws IOException { final ODistributedVersion distributedVersion = (ODistributedVersion) version; int len = 0; file.writeInt(pos + len, distributedVersion.counter); len += OBinaryProtocol.SIZE_INT; file.writeLong(pos + len, distributedVersion.timestamp); len += OBinaryProtocol.SIZE_LONG; file.writeLong(pos + len, distributedVersion.macAddress); len += OBinaryProtocol.SIZE_LONG; return len; }
@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 new OSerializationException("Error on update storage configuration", e); } }