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

io.weaviate.client.v1.misc.api.LiveChecker Maven / Gradle / Ivy

There is a newer version: 4.9.0
Show newest version
package io.weaviate.client.v1.misc.api;

import io.weaviate.client.Config;
import io.weaviate.client.base.BaseClient;
import io.weaviate.client.base.ClientResult;
import io.weaviate.client.base.Response;
import io.weaviate.client.base.Result;
import io.weaviate.client.base.http.HttpClient;
import io.weaviate.client.base.util.DbVersionProvider;

public class LiveChecker extends BaseClient implements ClientResult {

  private final DbVersionProvider dbVersionProvider;

  public LiveChecker(HttpClient httpClient, Config config, DbVersionProvider dbVersionProvider) {
    super(httpClient, config);
    this.dbVersionProvider = dbVersionProvider;
  }

  @Override
  public Result run() {
    Response resp = sendGetRequest("/.well-known/live", String.class);
    if (resp.getStatusCode() == 200) {
      dbVersionProvider.refresh();
    }
    return new Result<>(resp.getStatusCode(), resp.getStatusCode() == 200, resp.getErrors());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy