/** * Writes the affinity function context. * @param affCtx Affinity context. * @param writer Writer. * @param ctx Platform context. */ public static void writeAffinityFunctionContext(AffinityFunctionContext affCtx, BinaryRawWriterEx writer, PlatformContext ctx) { assert affCtx != null; assert writer != null; assert ctx != null; ctx.writeNodes(writer, affCtx.currentTopologySnapshot()); writer.writeInt(affCtx.backups()); writer.writeLong(affCtx.currentTopologyVersion().topologyVersion()); writer.writeInt(affCtx.currentTopologyVersion().minorTopologyVersion()); ctx.writeEvent(writer, affCtx.discoveryEvent()); // Write previous assignment List<List<ClusterNode>> prevAssignment = ((GridAffinityFunctionContextImpl)affCtx).prevAssignment(); if (prevAssignment == null) writer.writeInt(-1); else { writer.writeInt(prevAssignment.size()); for (List<ClusterNode> part : prevAssignment) ctx.writeNodes(writer, part); } }
/** * Writes the affinity function context. * @param affCtx Affinity context. * @param writer Writer. * @param ctx Platform context. */ public static void writeAffinityFunctionContext(AffinityFunctionContext affCtx, BinaryRawWriterEx writer, PlatformContext ctx) { assert affCtx != null; assert writer != null; assert ctx != null; ctx.writeNodes(writer, affCtx.currentTopologySnapshot()); writer.writeInt(affCtx.backups()); writer.writeLong(affCtx.currentTopologyVersion().topologyVersion()); writer.writeInt(affCtx.currentTopologyVersion().minorTopologyVersion()); ctx.writeEvent(writer, affCtx.discoveryEvent()); // Write previous assignment List<List<ClusterNode>> prevAssignment = ((GridAffinityFunctionContextImpl)affCtx).prevAssignment(); if (prevAssignment == null) writer.writeInt(-1); else { writer.writeInt(prevAssignment.size()); for (List<ClusterNode> part : prevAssignment) ctx.writeNodes(writer, part); } }