private void phySegmentToStream( final StringBuilder iBuffer, final OStorageSegmentConfiguration iSegment) { write(iBuffer, iSegment.location); write(iBuffer, iSegment.maxSize); write(iBuffer, iSegment.fileType); write(iBuffer, iSegment.fileStartSize); write(iBuffer, iSegment.fileMaxSize); write(iBuffer, iSegment.fileIncrementSize); write(iBuffer, iSegment.defrag); write(iBuffer, iSegment.infoFiles.length); for (OStorageFileConfiguration f : iSegment.infoFiles) fileToStream(iBuffer, f); }
private void entryToStream(final StringBuilder iBuffer, final OStorageEntryConfiguration iEntry) { write(iBuffer, iEntry.name); write(iBuffer, iEntry.value); }
private void fileToStream(final StringBuilder iBuffer, final OStorageFileConfiguration iFile) { write(iBuffer, iFile.path); write(iBuffer, iFile.type); write(iBuffer, iFile.maxSize); }
public byte[] toStream() throws OSerializationException { final StringBuilder buffer = new StringBuilder(); write(buffer, CURRENT_VERSION); write(buffer, name); write(buffer, schemaRecordId); write(buffer, dictionaryRecordId); write(buffer, indexMgrRecordId); write(buffer, localeLanguage); write(buffer, localeCountry); write(buffer, dateFormat); write(buffer, dateTimeFormat); write(buffer, timeZone.getID()); write(buffer, charset); phySegmentToStream(buffer, fileTemplate); write(buffer, clusters.size()); for (OStorageClusterConfiguration c : clusters) { if (c == null) { write(buffer, -1); continue; } write(buffer, c.getId()); write(buffer, c.getName()); write(buffer, c.getDataSegmentId()); if (c instanceof OStoragePhysicalClusterConfigurationLocal) { // PHYSICAL write(buffer, "p"); phySegmentToStream(buffer, (OStoragePhysicalClusterConfigurationLocal) c); fileToStream(buffer, ((OStoragePhysicalClusterConfigurationLocal) c).getHoleFile()); } else if (c instanceof OStorageMemoryClusterConfiguration) { // MEMORY write(buffer, "m"); } else if (c instanceof OStoragePhysicalClusterLHPEPSConfiguration) { write(buffer, "h"); phySegmentToStream(buffer, (OStoragePhysicalClusterLHPEPSConfiguration) c); // TODO in this place we need serialize info about overflow bucket but it seems that there // is no such info // fileSegmentConfigurationToStream(buffer, ((OStoragePhysicalClusterLHPEPSConfiguration) // c).getOverflowSegment()); fileToStream( buffer, ((OStoragePhysicalClusterLHPEPSConfiguration) c).getOverflowStatisticsFile()); } } write(buffer, dataSegments.size()); for (OStorageDataConfiguration d : dataSegments) { if (d == null) { write(buffer, -1); continue; } write(buffer, d.id); write(buffer, d.name); phySegmentToStream(buffer, d); fileToStream(buffer, d.holeFile); } fileToStream(buffer, txSegment); write(buffer, txSegment.isSynchRecord()); write(buffer, txSegment.isSynchTx()); write(buffer, properties.size()); for (OStorageEntryConfiguration e : properties) entryToStream(buffer, e); // PLAIN: ALLOCATE ENOUGHT SPACE TO REUSE IT EVERY TIME buffer.append("|"); return buffer.toString().getBytes(); }