All Downloads are FREE. Search and download functionalities are using the official Maven repository.

zipkin2.storage.cassandra.internal.call.AccumulateTraceIdTsUuid Maven / Gradle / Ivy

There is a newer version: 3.4.2
Show newest version
/*
 * Copyright The OpenZipkin Authors
 * SPDX-License-Identifier: Apache-2.0
 */
package zipkin2.storage.cassandra.internal.call;

import com.datastax.oss.driver.api.core.cql.Row;
import com.datastax.oss.driver.api.core.uuid.Uuids;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Supplier;

public final class AccumulateTraceIdTsUuid
  extends AccumulateAllResults> {
  static final AccumulateAllResults> INSTANCE = new AccumulateTraceIdTsUuid();

  public static AccumulateAllResults> get() {
    return INSTANCE;
  }

  @Override protected Supplier> supplier() {
    return LinkedHashMap::new; // because results are not distinct
  }

  @Override protected BiConsumer> accumulator() {
    return (row, result) ->
      result.put(row.getString(0), Uuids.unixTimestamp(row.getUuid(1)));
  }

  @Override public String toString() {
    return "AccumulateTraceIdTsUuid{}";
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy