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

com.aerospike.vector.client.internal.HostPort Maven / Gradle / Ivy

package com.aerospike.vector.client.internal;

import com.aerospike.vector.client.proto.ServerEndpoint;

/**
 * Represents a network host with a specified port and a TLS configuration. This record is used to
 * store information about network endpoints that may or may not use TLS (Transport Layer Security).
 * It is particularly useful for representing the endpoints in a format that is compatible with gRPC
 * and protobuf defined structures, facilitating easy conversion to the {@link ServerEndpoint}
 * protobuf type defined in the {@code aerospike.vector} package.
 *
 * @param address IP address of the AVS
 * @param port Port of the AVS server
 * @param isTls A boolean indicating whether the connection to this host should be secured with TLS.
 */
public record HostPort(String address, int port, boolean isTls) {

    /**
     * Converts this {@code HostPort} instance to a {@code ServerEndpoint} object defined in the
     * gRPC protobuf specifications. The {@code ServerEndpoint} is used to specify network
     * connection points in a distributed system and is utilized within the ClusterInfo service for
     * network configurations and operations.
     *
     * @return A {@code ServerEndpoint} built from the values of this host-port combination,
     *     suitable for gRPC transmissions and conforming to the protobuf definitions in the {@code
     *     aerospike.vector} package.
     */
    public ServerEndpoint toGrpc() {
        return ServerEndpoint.newBuilder()
                .setAddress(address)
                .setPort(port)
                .setIsTls(isTls)
                .build();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy