Class StreamingSimulationResourceManager
java.lang.Object
gov.nasa.jpl.aerie.merlin.driver.resources.StreamingSimulationResourceManager
- All Implemented Interfaces:
SimulationResourceManager
A variant of a SimulationResourceManager that streams resources as needed in order to conserve memory.
The way it streams resources is determined by the Consumer passed to it during construction
-
Constructor Summary
ConstructorsConstructorDescriptionStreamingSimulationResourceManager(AsyncConsumer<ResourceProfiles> streamer, int threshold) -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptUpdates(gov.nasa.jpl.aerie.merlin.protocol.types.Duration elapsedTime, Map<String, Pair<gov.nasa.jpl.aerie.merlin.protocol.types.ValueSchema, gov.nasa.jpl.aerie.merlin.protocol.types.RealDynamics>> realResourceUpdates, Map<String, Pair<gov.nasa.jpl.aerie.merlin.protocol.types.ValueSchema, gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue>> discreteResourceUpdates) Add new segments to this manager's internal store of segments.computeProfiles(gov.nasa.jpl.aerie.merlin.protocol.types.Duration elapsedDuration) Compute all ProfileSegments stored in this resource manager, and stream them to the databasecomputeProfiles(gov.nasa.jpl.aerie.merlin.protocol.types.Duration elapsedDuration, Set<String> resources) This class streams all resources it has as it accepts updates, so it cannot only compute a subset of ProfileSegments.
-
Constructor Details
-
StreamingSimulationResourceManager
-
StreamingSimulationResourceManager
-
-
Method Details
-
computeProfiles
public ResourceProfiles computeProfiles(gov.nasa.jpl.aerie.merlin.protocol.types.Duration elapsedDuration) Compute all ProfileSegments stored in this resource manager, and stream them to the database- Specified by:
computeProfilesin interfaceSimulationResourceManager- Parameters:
elapsedDuration- the amount of time elapsed since the start of simulation.
-
computeProfiles
public ResourceProfiles computeProfiles(gov.nasa.jpl.aerie.merlin.protocol.types.Duration elapsedDuration, Set<String> resources) This class streams all resources it has as it accepts updates, so it cannot only compute a subset of ProfileSegments.- Specified by:
computeProfilesin interfaceSimulationResourceManager- Parameters:
elapsedDuration- the amount of time elapsed since the start of simulation.resources- the set of names of the resources to be computed- Throws:
UnsupportedOperationException
-
acceptUpdates
public void acceptUpdates(gov.nasa.jpl.aerie.merlin.protocol.types.Duration elapsedTime, Map<String, Pair<gov.nasa.jpl.aerie.merlin.protocol.types.ValueSchema, gov.nasa.jpl.aerie.merlin.protocol.types.RealDynamics>> realResourceUpdates, Map<String, Pair<gov.nasa.jpl.aerie.merlin.protocol.types.ValueSchema, gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue>> discreteResourceUpdates) Add new segments to this manager's internal store of segments. Will stream all held segments should any resource's number of stored segments exceed the streaming threshold.- Specified by:
acceptUpdatesin interfaceSimulationResourceManager- Parameters:
elapsedTime- the amount of time elapsed since the start of simulation. Must be monotonically increasing on subsequent calls.realResourceUpdates- the set of updates to real resources. Up to one update per resource is permitted.discreteResourceUpdates- the set of updates to discrete resources. Up to one update per resource is permitted.
-