io.weaviate.client.v1.misc.api.LiveChecker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of client Show documentation
Show all versions of client Show documentation
A java client for Weaviate Vector Search Engine
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());
}
}