/** * @param director a {@link HollowCombinerCopyDirector} which will specify which specific records to copy from the input(s). * @param inputs the set of {@link HollowReadStateEngine} to combine data from. */ public HollowCombiner(HollowCombinerCopyDirector director, HollowReadStateEngine... inputs) { this(director, HollowWriteStateCreator.createWithSchemas(inputs[0].getSchemas()), inputs); }
/** * @param inputs the set of {@link HollowReadStateEngine} to combine data from. */ public HollowCombiner(HollowReadStateEngine... inputs) { this(HollowWriteStateCreator.createWithSchemas(inputs[0].getSchemas()), inputs); }
private static HollowObjectMapper createNewHollowObjectMapperFromExisting(HollowObjectMapper objectMapper) { Collection<HollowSchema> schemas = objectMapper.getStateEngine().getSchemas(); HollowWriteStateEngine writeEngine = HollowWriteStateCreator.createWithSchemas(schemas); return new HollowObjectMapper(writeEngine); }
public HollowSplitter(HollowSplitterCopyDirector director, HollowReadStateEngine inputStateEngine) { this.inputStateEngine = inputStateEngine; this.outputStateEngines = new HollowWriteStateEngine[director.getNumShards()]; this.director = director; List<HollowSchema> schemas = inputStateEngine.getSchemas(); for(int i=0;i<director.getNumShards();i++) outputStateEngines[i] = HollowWriteStateCreator.createWithSchemas(schemas); }
/** * Create a delta patcher which will patch between the states contained in the two state engines. * * @param from The earlier state * @param to The later state. */ public HollowStateDeltaPatcher(HollowReadStateEngine from, HollowReadStateEngine to) { this.from = from; this.to = to; this.schemas = HollowSchemaSorter.dependencyOrderedSchemaList(getCommonSchemas(from, to)); this.writeEngine = HollowWriteStateCreator.createWithSchemas(schemas); this.changedOrdinalsBetweenStates = discoverChangedOrdinalsBetweenStates(); }
public HollowHistoricalStateDataAccess copyButRemapOrdinals(HollowHistoricalStateDataAccess previous, OrdinalRemapper ordinalRemapper) { HollowWriteStateEngine writeEngine = HollowWriteStateCreator.createWithSchemas(schemasWithoutKeys(previous.getSchemas())); IntMapOrdinalRemapper typeRemovedOrdinalRemapping = new IntMapOrdinalRemapper(); for(String typeName : previous.getAllTypes()) { HollowHistoricalTypeDataAccess typeDataAccess = (HollowHistoricalTypeDataAccess) previous.getTypeDataAccess(typeName); copyRemappedRecords(typeDataAccess.getRemovedRecords(), ordinalRemapper, writeEngine); IntMap ordinalLookupMap = remapPreviousOrdinalMapping(typeDataAccess.getOrdinalRemap(), typeName, ordinalRemapper); typeRemovedOrdinalRemapping.addOrdinalRemapping(typeName, ordinalLookupMap); } return new HollowHistoricalStateDataAccess(totalHistory, previous.getVersion(), roundTripStateEngine(writeEngine), typeRemovedOrdinalRemapping, previous.getSchemaChanges()); }
/** * Create a {@link HollowDataAccess} for a historical state after a double snapshot occurs, without a {@link HollowHistory}. * * @param version the version * @param previous the previous state * @param current the current state * @param ordinalRemapper the ordinal remapper * @return the data access for a history */ public HollowHistoricalStateDataAccess createHistoricalStateFromDoubleSnapshot(long version, HollowReadStateEngine previous, HollowReadStateEngine current, DiffEqualityMappingOrdinalRemapper ordinalRemapper) { HollowWriteStateEngine writeEngine = HollowWriteStateCreator.createWithSchemas(schemasWithoutKeys(previous.getSchemas())); IntMapOrdinalRemapper typeRemovedOrdinalLookupMaps = new IntMapOrdinalRemapper(); for(HollowSchema previousSchema : HollowSchemaSorter.dependencyOrderedSchemaList(previous)) { HollowTypeReadState previousTypeState = previous.getTypeState(previousSchema.getName()); String typeName = previousTypeState.getSchema().getName(); IntMap ordinalLookupMap; if(current.getTypeState(typeName) == null) { ordinalLookupMap = copyAllRecords(previousTypeState, ordinalRemapper, writeEngine); } else { HollowTypeReadState currentTypeState = current.getTypeState(typeName); BitSet currentlyPopulatedOrdinals = currentTypeState.getListener(PopulatedOrdinalListener.class).getPopulatedOrdinals(); ordinalLookupMap = copyUnmatchedRecords(previousTypeState, ordinalRemapper, currentlyPopulatedOrdinals, writeEngine); } typeRemovedOrdinalLookupMaps.addOrdinalRemapping(typeName, ordinalLookupMap); } Map<String, HollowHistoricalSchemaChange> schemaChanges = calculateSchemaChanges(previous, current, ordinalRemapper.getDiffEqualityMapping()); return new HollowHistoricalStateDataAccess(totalHistory, version, roundTripStateEngine(writeEngine), typeRemovedOrdinalLookupMaps, schemaChanges); }