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

io.hyperfoil.controller.Client Maven / Gradle / Ivy

There is a newer version: 0.27.1
Show newest version
package io.hyperfoil.controller;

import java.io.File;
import java.nio.file.Path;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import io.hyperfoil.api.config.Benchmark;
import io.hyperfoil.controller.model.Histogram;
import io.hyperfoil.controller.model.RequestStatisticsResponse;
import io.hyperfoil.controller.model.Run;
import io.hyperfoil.controller.model.Version;

/**
 * API for server control
 */
public interface Client {
   BenchmarkRef register(Benchmark benchmark, String prevVersion);

   BenchmarkRef register(String yaml, Map otherFiles, String prevVersion, String storedFilesBenchmark);

   BenchmarkRef register(Path benchmarkFile, Map otherFiles, String prevVersion, String storedFilesBenchmark);

   BenchmarkRef registerLocal(String benchmarkUri, String prevVersion, String storedFilesBenchmark);

   List benchmarks();

   List templates();

   BenchmarkRef benchmark(String name);

   List runs(boolean details);

   RunRef run(String id);

   long ping();

   Version version();

   Collection agents();

   String downloadLog(String node, String logId, long offset, File destinationFile);

   void shutdown(boolean force);

   interface BenchmarkRef {
      String name();

      BenchmarkSource source();

      Benchmark get();

      RunRef start(String description, Map templateParams);

      BenchmarkStructure structure(Integer maxCollectionSize, Map templateParams);

      Map files();
   }

   class BenchmarkSource {
      public final String source;
      public final String version;

      public BenchmarkSource(String source, String version) {
         this.source = source;
         this.version = version;
      }
   }

   class BenchmarkStructure {
      public final Map params;
      public final String content;

      @JsonCreator
      public BenchmarkStructure(@JsonProperty("params") Map params, @JsonProperty("content") String content) {
         this.params = params;
         this.content = content;
      }
   }

   interface RunRef {
      String id();

      Run get();

      RunRef kill();

      Benchmark benchmark();

      Map> sessionStatsRecent();

      Map> sessionStatsTotal();

      // TODO: server should expose JSON-formatted variants
      Collection sessions();

      Collection connections();

      Map> connectionStatsRecent();

      Map> connectionStatsTotal();

      RequestStatisticsResponse statsRecent();

      RequestStatisticsResponse statsTotal();

      byte[] statsAll(String format);

      Histogram histogram(String phase, int stepId, String metric);

      byte[] file(String filename);

      byte[] report(String source);

      Map> agentCpu();
   }

   class MinMax {
      public final int min;
      public final int max;

      @JsonCreator
      public MinMax(@JsonProperty("min") int min, @JsonProperty("max") int max) {
         this.min = min;
         this.max = max;
      }
   }

   class EditConflictException extends RuntimeException {
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy