class MemoryDataSeries implements DataSeries<Long> {

  @Override
  public List<SeriesData<Long>> getDataForRange(@NotNull Range timeCurrentRangeUs) {
    // TODO: Change the Memory API to allow specifying padding in the request as number of samples.
    long bufferNs = TimeUnit.SECONDS.toNanos(1);
    MemoryRequest.Builder dataRequestBuilder = MemoryRequest.newBuilder()
      .setSession(mySession)
      .setStartTime(TimeUnit.MICROSECONDS.toNanos((long)timeCurrentRangeUs.getMin()) - bufferNs)
      .setEndTime(TimeUnit.MICROSECONDS.toNanos((long)timeCurrentRangeUs.getMax()) + bufferNs);
    MemoryData response = myClient.getData(dataRequestBuilder.build());

    List<SeriesData<Long>> seriesData = new ArrayList<>();
    for (MemoryData.MemorySample sample : response.getMemSamplesList()) {
      long dataTimestamp = TimeUnit.NANOSECONDS.toMicros(sample.getTimestamp());
      seriesData.add(new SeriesData<>(dataTimestamp, mySampleTransformer.apply(sample)));
    }
    return seriesData;
  }

  public  MemoryDataSeries(@NotNull MemoryServiceGrpc.MemoryServiceBlockingStub client,
                          @NotNull Common.Session session,
                          @NotNull Function<MemorySample, Long> transformer);

}