From 161eca4895e4fdbbb6601ffd10102d809bfdf280 Mon Sep 17 00:00:00 2001 From: kpango Date: Wed, 2 Oct 2024 04:06:59 +0900 Subject: [PATCH] Refactor grpc/status.withDetails function for performance Signed-off-by: kpango --- .gitfiles | 52 +- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .../ISSUE_TEMPLATE/security_issue_report.md | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 2 +- Makefile.d/tools.mk | 2 +- dockers/agent/core/agent/Dockerfile | 2 +- dockers/ci/base/Dockerfile | 2 +- dockers/dev/Dockerfile | 2 +- example/client/go.mod | 12 +- example/client/go.mod.default | 2 +- example/client/go.sum | 12 +- go.mod | 58 +- go.sum | 79 +- hack/actions/gen/main_test.go | 692 +++++++ hack/go.mod.default | 2 +- .../core/algorithm/usearch/option_test.go | 696 +++++++ .../core/algorithm/usearch/usearch_test.go | 1328 +++++++++++++ internal/errors/usearch_test.go | 189 ++ internal/net/grpc/client_test.go | 1748 ++++++++++------- internal/net/grpc/codes/codes_test.go | 101 + .../net/grpc/errdetails/errdetails_test.go | 96 + .../server/logging/accesslog_test.go | 108 + internal/net/grpc/status/status.go | 287 +-- internal/net/grpc/status/status_test.go | 255 +++ internal/net/http/json/json.go | 2 +- internal/os/hostname.go | 55 + internal/os/hostname_test.go | 95 + pkg/agent/core/faiss/handler/grpc/option.go | 2 +- pkg/agent/core/ngt/handler/grpc/option.go | 2 +- pkg/agent/core/ngt/service/ngt_test.go | 1054 +++++++--- pkg/discoverer/k8s/handler/grpc/option.go | 3 +- pkg/gateway/filter/handler/grpc/option.go | 2 +- pkg/gateway/lb/handler/grpc/option.go | 2 +- pkg/gateway/mirror/handler/grpc/option.go | 2 +- pkg/gateway/mirror/service/gateway_test.go | 4 +- rust/Cargo.lock | 129 +- versions/CMAKE_VERSION | 2 +- versions/GO_VERSION | 2 +- versions/HDF5_VERSION | 2 +- versions/JAEGER_OPERATOR_VERSION | 2 +- versions/actions/CODECOV_CODECOV_ACTION | 2 +- 41 files changed, 5810 insertions(+), 1283 deletions(-) create mode 100644 hack/actions/gen/main_test.go create mode 100644 internal/core/algorithm/usearch/option_test.go create mode 100644 internal/errors/usearch_test.go create mode 100644 internal/net/grpc/codes/codes_test.go create mode 100644 internal/os/hostname.go create mode 100644 internal/os/hostname_test.go diff --git a/.gitfiles b/.gitfiles index 57a22cb2e3..2e7e7b8eb2 100644 --- a/.gitfiles +++ b/.gitfiles @@ -630,6 +630,7 @@ go.mod go.sum hack/CHANGELOG.template.md hack/actions/gen/main.go +hack/actions/gen/main_test.go hack/benchmark/assets/checksum/fashion-mnist-784-euclidean.md5 hack/benchmark/assets/checksum/gist-960-euclidean.md5 hack/benchmark/assets/checksum/glove-100-angular.md5 @@ -717,6 +718,8 @@ hack/helm/schema/gen/main.go hack/helm/schema/gen/main_test.go hack/license/gen/main.go hack/license/gen/main_test.go +hack/tools/deadlink/index.html +hack/tools/deadlink/main.go hack/tools/kvsdb/main.go hack/tools/metrics/main.go hack/tools/metrics/main_test.go @@ -887,6 +890,7 @@ internal/core/algorithm/ngt/ngt_test.go internal/core/algorithm/ngt/option.go internal/core/algorithm/ngt/option_test.go internal/core/algorithm/usearch/option.go +internal/core/algorithm/usearch/option_test.go internal/core/algorithm/usearch/usearch.go internal/core/algorithm/usearch/usearch_test.go internal/db/kvs/bbolt/bbolt.go @@ -1032,6 +1036,7 @@ internal/errors/tls.go internal/errors/unit.go internal/errors/unit_test.go internal/errors/usearch.go +internal/errors/usearch_test.go internal/errors/vald.go internal/errors/vald_test.go internal/errors/vqueue.go @@ -1161,6 +1166,7 @@ internal/net/grpc/client_test.go internal/net/grpc/codec.go internal/net/grpc/codec_test.go internal/net/grpc/codes/codes.go +internal/net/grpc/codes/codes_test.go internal/net/grpc/context.go internal/net/grpc/context_test.go internal/net/grpc/credentials/credentials.go @@ -1288,6 +1294,8 @@ internal/observability/trace/status_test.go internal/observability/trace/trace.go internal/observability/trace/trace_option.go internal/observability/trace/trace_test.go +internal/os/hostname.go +internal/os/hostname_test.go internal/params/option.go internal/params/option_test.go internal/params/params.go @@ -1409,16 +1417,29 @@ internal/worker/worker.go internal/worker/worker_option.go internal/worker/worker_option_test.go internal/worker/worker_test.go +k8s/agent/clusterrole.yaml +k8s/agent/clusterrolebinding.yaml +k8s/agent/daemonset.yaml +k8s/agent/deployment.yaml +k8s/agent/faiss/configmap.yaml +k8s/agent/hpa.yaml +k8s/agent/networkpolicy.yaml k8s/agent/ngt/configmap.yaml k8s/agent/pdb.yaml k8s/agent/priorityclass.yaml +k8s/agent/serviceaccount.yaml +k8s/agent/sidecar/configmap.yaml +k8s/agent/sidecar/svc.yaml k8s/agent/statefulset.yaml k8s/agent/svc.yaml k8s/debug/kind/config.yaml k8s/discoverer/clusterrole.yaml k8s/discoverer/clusterrolebinding.yaml k8s/discoverer/configmap.yaml +k8s/discoverer/daemonset.yaml k8s/discoverer/deployment.yaml +k8s/discoverer/hpa.yaml +k8s/discoverer/networkpolicy.yaml k8s/discoverer/pdb.yaml k8s/discoverer/priorityclass.yaml k8s/discoverer/serviceaccount.yaml @@ -1426,33 +1447,55 @@ k8s/discoverer/svc.yaml k8s/external/minio/deployment.yaml k8s/external/minio/mb-job.yaml k8s/external/minio/svc.yaml +k8s/gateway/gateway/filter/configmap.yaml +k8s/gateway/gateway/filter/daemonset.yaml +k8s/gateway/gateway/filter/deployment.yaml +k8s/gateway/gateway/filter/hpa.yaml +k8s/gateway/gateway/filter/networkpolicy.yaml +k8s/gateway/gateway/filter/pdb.yaml +k8s/gateway/gateway/filter/priorityclass.yaml +k8s/gateway/gateway/filter/svc.yaml k8s/gateway/gateway/ing.yaml k8s/gateway/gateway/lb/configmap.yaml +k8s/gateway/gateway/lb/daemonset.yaml k8s/gateway/gateway/lb/deployment.yaml k8s/gateway/gateway/lb/hpa.yaml +k8s/gateway/gateway/lb/networkpolicy.yaml k8s/gateway/gateway/lb/pdb.yaml k8s/gateway/gateway/lb/priorityclass.yaml k8s/gateway/gateway/lb/svc.yaml k8s/gateway/gateway/mirror/clusterrole.yaml k8s/gateway/gateway/mirror/clusterrolebinding.yaml k8s/gateway/gateway/mirror/configmap.yaml +k8s/gateway/gateway/mirror/daemonset.yaml k8s/gateway/gateway/mirror/deployment.yaml k8s/gateway/gateway/mirror/hpa.yaml +k8s/gateway/gateway/mirror/networkpolicy.yaml k8s/gateway/gateway/mirror/pdb.yaml k8s/gateway/gateway/mirror/priorityclass.yaml k8s/gateway/gateway/mirror/serviceaccount.yaml k8s/gateway/gateway/mirror/svc.yaml k8s/index/job/correction/configmap.yaml k8s/index/job/correction/cronjob.yaml +k8s/index/job/correction/networkpolicy.yaml k8s/index/job/creation/configmap.yaml k8s/index/job/creation/cronjob.yaml +k8s/index/job/creation/networkpolicy.yaml +k8s/index/job/readreplica/rotate/clusterrole.yaml +k8s/index/job/readreplica/rotate/clusterrolebinding.yaml +k8s/index/job/readreplica/rotate/configmap.yaml +k8s/index/job/readreplica/rotate/networkpolicy.yaml +k8s/index/job/readreplica/rotate/serviceaccount.yaml k8s/index/job/save/configmap.yaml k8s/index/job/save/cronjob.yaml +k8s/index/job/save/networkpolicy.yaml k8s/index/operator/configmap.yaml k8s/index/operator/deployment.yaml k8s/index/operator/priorityclass.yaml k8s/manager/index/configmap.yaml +k8s/manager/index/daemonset.yaml k8s/manager/index/deployment.yaml +k8s/manager/index/networkpolicy.yaml k8s/manager/index/pdb.yaml k8s/manager/index/priorityclass.yaml k8s/manager/index/svc.yaml @@ -1702,7 +1745,6 @@ pkg/gateway/filter/router/router.go pkg/gateway/filter/router/router_test.go pkg/gateway/filter/usecase/vald.go pkg/gateway/filter/usecase/vald_test.go -pkg/gateway/internal/location/location_test.go pkg/gateway/lb/README.md pkg/gateway/lb/config/config.go pkg/gateway/lb/config/config_test.go @@ -1938,16 +1980,24 @@ rust/libs/observability/src/lib.rs rust/libs/observability/src/macros.rs rust/libs/observability/src/observability.rs rust/libs/proto/Cargo.toml +rust/libs/proto/src/core.v1.rs rust/libs/proto/src/core.v1.tonic.rs +rust/libs/proto/src/discoverer.v1.rs rust/libs/proto/src/discoverer.v1.tonic.rs +rust/libs/proto/src/filter.egress.v1.rs rust/libs/proto/src/filter.egress.v1.tonic.rs +rust/libs/proto/src/filter.ingress.v1.rs rust/libs/proto/src/filter.ingress.v1.tonic.rs rust/libs/proto/src/lib.rs +rust/libs/proto/src/meta.v1.rs rust/libs/proto/src/meta.v1.tonic.rs +rust/libs/proto/src/mirror.v1.rs rust/libs/proto/src/mirror.v1.tonic.rs rust/libs/proto/src/payload.v1.rs rust/libs/proto/src/rpc.v1.rs +rust/libs/proto/src/sidecar.v1.rs rust/libs/proto/src/sidecar.v1.tonic.rs +rust/libs/proto/src/vald.v1.rs rust/libs/proto/src/vald.v1.tonic.rs rust/rust-toolchain rust/rust-toolchain.toml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 55143b8fda..21c388a3ce 100755 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -23,7 +23,7 @@ assignees: "" - Vald Version: v1.7.13 -- Go Version: v1.23.1 +- Go Version: v1.23.2 - Rust Version: v1.81.0 - Docker Version: v27.3.1 - Kubernetes Version: v1.31.1 diff --git a/.github/ISSUE_TEMPLATE/security_issue_report.md b/.github/ISSUE_TEMPLATE/security_issue_report.md index 8e7fc2d081..ade2f8720f 100644 --- a/.github/ISSUE_TEMPLATE/security_issue_report.md +++ b/.github/ISSUE_TEMPLATE/security_issue_report.md @@ -17,7 +17,7 @@ assignees: "" - Vald Version: v1.7.13 -- Go Version: v1.23.1 +- Go Version: v1.23.2 - Rust Version: v1.81.0 - Docker Version: v27.3.1 - Kubernetes Version: v1.31.1 diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index a534bf495f..5d46241b71 100755 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -16,7 +16,7 @@ - Vald Version: v1.7.13 -- Go Version: v1.23.1 +- Go Version: v1.23.2 - Rust Version: v1.81.0 - Docker Version: v27.3.1 - Kubernetes Version: v1.31.1 diff --git a/Makefile.d/tools.mk b/Makefile.d/tools.mk index c9968e5d75..cda9ead19e 100644 --- a/Makefile.d/tools.mk +++ b/Makefile.d/tools.mk @@ -234,7 +234,7 @@ hdf5/install: $(LIB_PATH)/libhdf5.a $(LIB_PATH)/libhdf5.a: $(LIB_PATH) \ zlib/install mkdir -p $(TEMP_DIR)/hdf5 \ - && curl -fsSL https://github.com/HDFGroup/hdf5/releases/download/$(HDF5_VERSION)/hdf5.tar.gz -o $(TEMP_DIR)/hdf5.tar.gz \ + && curl -fsSL https://github.com/HDFGroup/hdf5/archive/refs/tags/$(HDF5_VERSION).tar.gz -o $(TEMP_DIR)/hdf5.tar.gz \ && tar -xzvf $(TEMP_DIR)/hdf5.tar.gz -C $(TEMP_DIR)/hdf5 --strip-components 2 \ && mkdir -p $(TEMP_DIR)/hdf5/build \ && cd $(TEMP_DIR)/hdf5/build \ diff --git a/dockers/agent/core/agent/Dockerfile b/dockers/agent/core/agent/Dockerfile index 9f8e80f25f..f0e82341f3 100644 --- a/dockers/agent/core/agent/Dockerfile +++ b/dockers/agent/core/agent/Dockerfile @@ -39,8 +39,8 @@ ENV REPO=vald ENV RUST_HOME=/usr/local/lib/rust ENV TZ=Etc/UTC ENV USER=root -ENV RUSTUP_HOME=${RUST_HOME}/rustup ENV CARGO_HOME=${RUST_HOME}/cargo +ENV RUSTUP_HOME=${RUST_HOME}/rustup ENV PATH=${CARGO_HOME}/bin:${RUSTUP_HOME}/bin:/usr/local/bin:${PATH} WORKDIR ${HOME}/rust/src/github.com/${ORG}/${REPO} SHELL ["/bin/bash", "-o", "pipefail", "-c"] diff --git a/dockers/ci/base/Dockerfile b/dockers/ci/base/Dockerfile index ecbdeceeec..a05d3e2593 100644 --- a/dockers/ci/base/Dockerfile +++ b/dockers/ci/base/Dockerfile @@ -44,8 +44,8 @@ ENV REPO=vald ENV RUST_HOME=/usr/local/lib/rust ENV TZ=Etc/UTC ENV USER=root -ENV CARGO_HOME=${RUST_HOME}/cargo ENV RUSTUP_HOME=${RUST_HOME}/rustup +ENV CARGO_HOME=${RUST_HOME}/cargo ENV PATH=${CARGO_HOME}/bin:${GOPATH}/bin:${GOROOT}/bin:${RUSTUP_HOME}/bin:/usr/local/bin:${PATH} WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} SHELL ["/bin/bash", "-o", "pipefail", "-c"] diff --git a/dockers/dev/Dockerfile b/dockers/dev/Dockerfile index a084f9b51c..a45fcbbe0f 100644 --- a/dockers/dev/Dockerfile +++ b/dockers/dev/Dockerfile @@ -44,8 +44,8 @@ ENV REPO=vald ENV RUST_HOME=/usr/local/lib/rust ENV TZ=Etc/UTC ENV USER=root -ENV CARGO_HOME=${RUST_HOME}/cargo ENV RUSTUP_HOME=${RUST_HOME}/rustup +ENV CARGO_HOME=${RUST_HOME}/cargo ENV PATH=${CARGO_HOME}/bin:${GOPATH}/bin:${GOROOT}/bin:${RUSTUP_HOME}/bin:/usr/local/bin:${PATH} WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} SHELL ["/bin/bash", "-o", "pipefail", "-c"] diff --git a/example/client/go.mod b/example/client/go.mod index 1b680ca571..0162083b72 100644 --- a/example/client/go.mod +++ b/example/client/go.mod @@ -1,6 +1,6 @@ module github.com/vdaas/vald/example/client -go 1.23.1 +go 1.23.2 replace ( github.com/envoyproxy/protoc-gen-validate => github.com/envoyproxy/protoc-gen-validate v1.1.0 @@ -11,10 +11,10 @@ replace ( golang.org/x/crypto => golang.org/x/crypto v0.27.0 golang.org/x/net => golang.org/x/net v0.29.0 golang.org/x/text => golang.org/x/text v0.18.0 - google.golang.org/genproto => google.golang.org/genproto v0.0.0-20240924160255-9d4c2d233b61 - google.golang.org/genproto/googleapis/api => google.golang.org/genproto/googleapis/api v0.0.0-20240924160255-9d4c2d233b61 - google.golang.org/genproto/googleapis/rpc => google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 - google.golang.org/grpc => google.golang.org/grpc v1.67.0 + google.golang.org/genproto => google.golang.org/genproto v0.0.0-20240930140551-af27646dc61f + google.golang.org/genproto/googleapis/api => google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f + google.golang.org/genproto/googleapis/rpc => google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f + google.golang.org/grpc => google.golang.org/grpc v1.67.1 google.golang.org/protobuf => google.golang.org/protobuf v1.34.2 gopkg.in/yaml.v2 => gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 => gopkg.in/yaml.v3 v3.0.1 @@ -37,6 +37,6 @@ require ( golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.18.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 // indirect google.golang.org/protobuf v1.34.2 // indirect ) diff --git a/example/client/go.mod.default b/example/client/go.mod.default index a1ab487b5a..205d365b8e 100644 --- a/example/client/go.mod.default +++ b/example/client/go.mod.default @@ -1,6 +1,6 @@ module github.com/vdaas/vald/example/client -go 1.23.1 +go 1.23.2 replace ( github.com/envoyproxy/protoc-gen-validate => github.com/envoyproxy/protoc-gen-validate latest diff --git a/example/client/go.sum b/example/client/go.sum index 215ea70b56..21700f4311 100644 --- a/example/client/go.sum +++ b/example/client/go.sum @@ -30,11 +30,11 @@ golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gonum.org/v1/hdf5 v0.0.0-20210714002203-8c5d23bc6946 h1:vJpL69PeUullhJyKtTjHjENEmZU3BkO4e+fod7nKzgM= gonum.org/v1/hdf5 v0.0.0-20210714002203-8c5d23bc6946/go.mod h1:BQUWDHIAygjdt1HnUPQ0eWqLN2n5FwJycrpYUVUOx2I= -google.golang.org/genproto/googleapis/api v0.0.0-20240924160255-9d4c2d233b61 h1:pAjq8XSSzXoP9ya73v/w+9QEAAJNluLrpmMq5qFJQNY= -google.golang.org/genproto/googleapis/api v0.0.0-20240924160255-9d4c2d233b61/go.mod h1:O6rP0uBq4k0mdi/b4ZEMAZjkhYWhS815kCvaMha4VN8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 h1:N9BgCIAUvn/M+p4NJccWPWb3BWh88+zyL0ll9HgbEeM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= -google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f h1:jTm13A2itBi3La6yTGqn8bVSrc3ZZ1r8ENHlIXBfnRA= +google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f/go.mod h1:CLGoBuH1VHxAUXVPP8FfPwPEVJB6lz3URE5mY2SuayE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= diff --git a/go.mod b/go.mod index 9dd20907f9..fb5fa8a928 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/vdaas/vald -go 1.23.1 +go 1.23.2 replace ( cloud.google.com/go => cloud.google.com/go v0.115.1 @@ -15,7 +15,7 @@ replace ( cloud.google.com/go/secretmanager => cloud.google.com/go/secretmanager v1.14.1 cloud.google.com/go/storage => cloud.google.com/go/storage v1.43.0 cloud.google.com/go/trace => cloud.google.com/go/trace v1.11.1 - code.cloudfoundry.org/bytefmt => code.cloudfoundry.org/bytefmt v0.10.0 + code.cloudfoundry.org/bytefmt => code.cloudfoundry.org/bytefmt v0.11.0 contrib.go.opencensus.io/exporter/aws => contrib.go.opencensus.io/exporter/aws v0.0.0-20230502192102-15967c811cec contrib.go.opencensus.io/exporter/prometheus => contrib.go.opencensus.io/exporter/prometheus v0.4.2 contrib.go.opencensus.io/integrations/ocsql => contrib.go.opencensus.io/integrations/ocsql v0.1.7 @@ -25,7 +25,7 @@ replace ( github.com/Azure/azure-sdk-for-go/sdk/azcore => github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity => github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/internal => github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 - github.com/Azure/go-amqp => github.com/Azure/go-amqp v1.1.0 + github.com/Azure/go-amqp => github.com/Azure/go-amqp v1.2.0 github.com/Azure/go-autorest => github.com/Azure/go-autorest v14.2.1-0.20240530140449-f7ea664c9cff+incompatible github.com/Azure/go-autorest/autorest => github.com/Azure/go-autorest/autorest v0.11.30-0.20240530140449-f7ea664c9cff github.com/Azure/go-autorest/autorest/adal => github.com/Azure/go-autorest/autorest/adal v0.9.24 @@ -47,10 +47,10 @@ replace ( github.com/aws/aws-sdk-go => github.com/aws/aws-sdk-go v1.55.5 github.com/aws/aws-sdk-go-v2 => github.com/aws/aws-sdk-go-v2 v1.31.0 github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream => github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.5 - github.com/aws/aws-sdk-go-v2/config => github.com/aws/aws-sdk-go-v2/config v1.27.38 - github.com/aws/aws-sdk-go-v2/credentials => github.com/aws/aws-sdk-go-v2/credentials v1.17.36 + github.com/aws/aws-sdk-go-v2/config => github.com/aws/aws-sdk-go-v2/config v1.27.39 + github.com/aws/aws-sdk-go-v2/credentials => github.com/aws/aws-sdk-go-v2/credentials v1.17.37 github.com/aws/aws-sdk-go-v2/feature/ec2/imds => github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.14 - github.com/aws/aws-sdk-go-v2/feature/s3/manager => github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.24 + github.com/aws/aws-sdk-go-v2/feature/s3/manager => github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.25 github.com/aws/aws-sdk-go-v2/internal/configsources => github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.18 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 => github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.18 github.com/aws/aws-sdk-go-v2/internal/ini => github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 @@ -58,14 +58,14 @@ replace ( github.com/aws/aws-sdk-go-v2/service/internal/checksum => github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.20 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.20 github.com/aws/aws-sdk-go-v2/service/internal/s3shared => github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.18 - github.com/aws/aws-sdk-go-v2/service/kms => github.com/aws/aws-sdk-go-v2/service/kms v1.36.2 - github.com/aws/aws-sdk-go-v2/service/s3 => github.com/aws/aws-sdk-go-v2/service/s3 v1.63.2 - github.com/aws/aws-sdk-go-v2/service/secretsmanager => github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.33.2 - github.com/aws/aws-sdk-go-v2/service/sns => github.com/aws/aws-sdk-go-v2/service/sns v1.32.2 - github.com/aws/aws-sdk-go-v2/service/sqs => github.com/aws/aws-sdk-go-v2/service/sqs v1.35.2 - github.com/aws/aws-sdk-go-v2/service/ssm => github.com/aws/aws-sdk-go-v2/service/ssm v1.54.2 - github.com/aws/aws-sdk-go-v2/service/sso => github.com/aws/aws-sdk-go-v2/service/sso v1.23.2 - github.com/aws/aws-sdk-go-v2/service/sts => github.com/aws/aws-sdk-go-v2/service/sts v1.31.2 + github.com/aws/aws-sdk-go-v2/service/kms => github.com/aws/aws-sdk-go-v2/service/kms v1.36.3 + github.com/aws/aws-sdk-go-v2/service/s3 => github.com/aws/aws-sdk-go-v2/service/s3 v1.63.3 + github.com/aws/aws-sdk-go-v2/service/secretsmanager => github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.33.3 + github.com/aws/aws-sdk-go-v2/service/sns => github.com/aws/aws-sdk-go-v2/service/sns v1.32.3 + github.com/aws/aws-sdk-go-v2/service/sqs => github.com/aws/aws-sdk-go-v2/service/sqs v1.35.3 + github.com/aws/aws-sdk-go-v2/service/ssm => github.com/aws/aws-sdk-go-v2/service/ssm v1.54.3 + github.com/aws/aws-sdk-go-v2/service/sso => github.com/aws/aws-sdk-go-v2/service/sso v1.23.3 + github.com/aws/aws-sdk-go-v2/service/sts => github.com/aws/aws-sdk-go-v2/service/sts v1.31.3 github.com/aws/smithy-go => github.com/aws/smithy-go v1.21.0 github.com/benbjohnson/clock => github.com/benbjohnson/clock v1.3.5 github.com/beorn7/perks => github.com/beorn7/perks v1.0.1 @@ -132,7 +132,7 @@ replace ( github.com/gobwas/pool => github.com/gobwas/pool v0.2.1 github.com/gobwas/ws => github.com/gobwas/ws v1.4.0 github.com/goccy/go-json => github.com/goccy/go-json v0.10.3 - github.com/gocql/gocql => github.com/gocql/gocql v1.6.0 + github.com/gocql/gocql => github.com/gocql/gocql v1.7.0 github.com/gocraft/dbr/v2 => github.com/gocraft/dbr/v2 v2.7.6 github.com/godbus/dbus/v5 => github.com/godbus/dbus/v5 v5.1.0 github.com/gofrs/uuid => github.com/gofrs/uuid v4.4.0+incompatible @@ -154,7 +154,7 @@ replace ( github.com/google/gofuzz => github.com/google/gofuzz v1.2.0 github.com/google/martian => github.com/google/martian v2.1.0+incompatible github.com/google/martian/v3 => github.com/google/martian/v3 v3.3.3 - github.com/google/pprof => github.com/google/pprof v0.0.0-20240925223930-fa3061bff0bc + github.com/google/pprof => github.com/google/pprof v0.0.0-20241001023024-f4c0cfd0cf1d github.com/google/shlex => github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 github.com/google/subcommands => github.com/google/subcommands v1.2.0 github.com/google/uuid => github.com/google/uuid v1.6.0 @@ -166,7 +166,7 @@ replace ( github.com/gregjones/httpcache => github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 github.com/grpc-ecosystem/grpc-gateway/v2 => github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 github.com/hailocab/go-hostpool => github.com/kpango/go-hostpool v0.0.0-20210303030322-aab80263dcd0 - github.com/hanwen/go-fuse/v2 => github.com/hanwen/go-fuse/v2 v2.5.1 + github.com/hanwen/go-fuse/v2 => github.com/hanwen/go-fuse/v2 v2.6.1 github.com/hashicorp/go-uuid => github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/go-version => github.com/hashicorp/go-version v1.7.0 github.com/iancoleman/strcase => github.com/iancoleman/strcase v0.3.0 @@ -192,7 +192,7 @@ replace ( github.com/jstemmer/go-junit-report => github.com/jstemmer/go-junit-report v1.0.0 github.com/kisielk/errcheck => github.com/kisielk/errcheck v1.7.0 github.com/kisielk/gotool => github.com/kisielk/gotool v1.0.0 - github.com/klauspost/compress => github.com/klauspost/compress v1.17.11-0.20240923131516-13a1ce6df1e0 + github.com/klauspost/compress => github.com/klauspost/compress v1.17.11-0.20240927175842-8e14b1b5a913 github.com/klauspost/cpuid/v2 => github.com/klauspost/cpuid/v2 v2.2.8 github.com/kpango/fastime => github.com/kpango/fastime v1.1.9 github.com/kpango/fuid => github.com/kpango/fuid v0.0.0-20221203053508-503b5ad89aa1 @@ -239,7 +239,7 @@ replace ( github.com/prashantv/gostub => github.com/prashantv/gostub v1.1.0 github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.20.4 github.com/prometheus/client_model => github.com/prometheus/client_model v0.6.1 - github.com/prometheus/common => github.com/prometheus/common v0.59.1 + github.com/prometheus/common => github.com/prometheus/common v0.60.0 github.com/prometheus/procfs => github.com/prometheus/procfs v0.15.1 github.com/prometheus/prometheus => github.com/prometheus/prometheus v1.99.0 github.com/quasilyte/go-ruleguard => github.com/quasilyte/go-ruleguard v0.4.2 @@ -299,7 +299,7 @@ replace ( golang.org/x/exp/typeparams => golang.org/x/exp/typeparams v0.0.0-20240909161429-701f63a606c0 golang.org/x/image => golang.org/x/image v0.20.0 golang.org/x/lint => golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 - golang.org/x/mobile => golang.org/x/mobile v0.0.0-20240909163608-642950227fb3 + golang.org/x/mobile => golang.org/x/mobile v0.0.0-20240930194658-c6794c95c70b golang.org/x/mod => golang.org/x/mod v0.21.0 golang.org/x/net => golang.org/x/net v0.29.0 golang.org/x/oauth2 => golang.org/x/oauth2 v0.23.0 @@ -316,10 +316,10 @@ replace ( gonum.org/v1/plot => gonum.org/v1/plot v0.14.0 google.golang.org/api => google.golang.org/api v0.199.0 google.golang.org/appengine => google.golang.org/appengine v1.6.8 - google.golang.org/genproto => google.golang.org/genproto v0.0.0-20240924160255-9d4c2d233b61 - google.golang.org/genproto/googleapis/api => google.golang.org/genproto/googleapis/api v0.0.0-20240924160255-9d4c2d233b61 - google.golang.org/genproto/googleapis/rpc => google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 - google.golang.org/grpc => google.golang.org/grpc v1.67.0 + google.golang.org/genproto => google.golang.org/genproto v0.0.0-20240930140551-af27646dc61f + google.golang.org/genproto/googleapis/api => google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f + google.golang.org/genproto/googleapis/rpc => google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f + google.golang.org/grpc => google.golang.org/grpc v1.67.1 google.golang.org/grpc/cmd/protoc-gen-go-grpc => google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 google.golang.org/protobuf => google.golang.org/protobuf v1.34.2 gopkg.in/check.v1 => gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c @@ -380,7 +380,7 @@ require ( github.com/quasilyte/go-ruleguard/dsl v0.3.22 github.com/scylladb/gocqlx v0.0.0-00010101000000-000000000000 github.com/stretchr/testify v1.9.0 - github.com/unum-cloud/usearch/golang v0.0.0-20240828190432-b9a9758a06e1 + github.com/unum-cloud/usearch/golang v0.0.0-20240928043120-b3da75964080 github.com/zeebo/xxh3 v1.0.2 go.etcd.io/bbolt v1.3.8 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 @@ -406,8 +406,8 @@ require ( golang.org/x/tools v0.25.0 gonum.org/v1/hdf5 v0.0.0-00010101000000-000000000000 gonum.org/v1/plot v0.14.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 - google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 + google.golang.org/genproto/googleapis/api v0.0.0-20240924160255-9d4c2d233b61 + google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 google.golang.org/grpc v1.67.0 google.golang.org/protobuf v1.34.2 gopkg.in/yaml.v2 v2.4.0 @@ -462,7 +462,7 @@ require ( github.com/google/btree v1.1.3 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/pprof v0.0.0-20240910150728-a0b0bb1d4134 // indirect + github.com/google/pprof v0.0.0-20240929191954-255acd752d31 // indirect github.com/google/s2a-go v0.1.8 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/wire v0.6.0 // indirect @@ -490,7 +490,7 @@ require ( github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.20.0 // indirect + github.com/prometheus/client_golang v1.20.4 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/go.sum b/go.sum index 5d8173de0d..84ace8d9bf 100644 --- a/go.sum +++ b/go.sum @@ -45,7 +45,7 @@ cloud.google.com/go/billing v1.19.1/go.mod h1:c5l7ORJjOLH/aASJqUqNsEmwrhfjWZYHX+ cloud.google.com/go/binaryauthorization v1.9.1/go.mod h1:jqBzP68bfzjoiMFT6Q1EdZtKJG39zW9ywwzHuv7V8ms= cloud.google.com/go/certificatemanager v1.9.1/go.mod h1:a6bXZULtd6iQTRuSVs1fopcHLMJ/T3zSpIB7aJaq/js= cloud.google.com/go/channel v1.18.1/go.mod h1:aitAlN/pIlbtjVWsNjbJT5FZRpvwjZtcnYp5ALsb7rA= -cloud.google.com/go/cloudbuild v1.17.1/go.mod h1:L3Y9HrIRFRg92SyCM3aThSgHnWdNSHm6gDUFRb+iQ9A= +cloud.google.com/go/cloudbuild v1.18.0/go.mod h1:KCHWGIoS/5fj+By9YmgIQnUiDq8P6YURWOjX3hoc6As= cloud.google.com/go/clouddms v1.8.1/go.mod h1:bmW2eDFH1LjuwkHcKKeeppcmuBGS0r6Qz6TXanehKP0= cloud.google.com/go/cloudtasks v1.13.1/go.mod h1:dyRD7tEEkLMbHLagb7UugkDa77UVJp9d/6O9lm3ModI= cloud.google.com/go/compute v1.28.1/go.mod h1:b72iXMY4FucVry3NR3Li4kVyyTvbMDE7x5WsqvxjsYk= @@ -66,12 +66,12 @@ cloud.google.com/go/dataform v0.10.1/go.mod h1:c5y0hIOBCfszmBcLJyxnELF30gC1qC/Ne cloud.google.com/go/datafusion v1.8.1/go.mod h1:I5+nRt6Lob4g1eCbcxP4ayRNx8hyOZ8kA3PB/vGd9Lo= cloud.google.com/go/datalabeling v0.9.1/go.mod h1:umplHuZX+x5DItNPV5BFBXau5TDsljLNzEj5AB5uRUM= cloud.google.com/go/dataplex v1.19.1/go.mod h1:WzoQ+vcxrAyM0cjJWmluEDVsg7W88IXXCfuy01BslKE= -cloud.google.com/go/dataproc/v2 v2.8.0/go.mod h1:i4365hSwNP6Bx0SAUnzCC6VloeNxChDjJWH6BfVPcbs= +cloud.google.com/go/dataproc/v2 v2.9.0/go.mod h1:i4365hSwNP6Bx0SAUnzCC6VloeNxChDjJWH6BfVPcbs= cloud.google.com/go/dataqna v0.9.1/go.mod h1:86DNLE33yEfNDp5F2nrITsmTYubMbsF7zQRzC3CcZrY= cloud.google.com/go/datastore v1.19.0/go.mod h1:KGzkszuj87VT8tJe67GuB+qLolfsOt6bZq/KFuWaahc= cloud.google.com/go/datastream v1.11.1/go.mod h1:a4j5tnptIxdZ132XboR6uQM/ZHcuv/hLqA6hH3NJWgk= cloud.google.com/go/deploy v1.22.1/go.mod h1:OEV1lWIaXrAnOEayZekdR5YwHW03EA6BFNr09D8R+lY= -cloud.google.com/go/dialogflow v1.57.1/go.mod h1:ARkUX3FWRg1wl0hq/VP/heydctZ6nj/WqiXrrXtjxCE= +cloud.google.com/go/dialogflow v1.58.0/go.mod h1:sWcyFLdUrg+TWBJVq/OtwDyjcyDOfirTF0Gx12uKy7o= cloud.google.com/go/dlp v1.19.0/go.mod h1:cr8dKBq8un5LALiyGkz4ozcwzt3FyTlOwA4/fFzJ64c= cloud.google.com/go/documentai v1.34.0/go.mod h1:onJlbHi4ZjQTsANSZJvW7fi2M8LZJrrupXkWDcy4gLY= cloud.google.com/go/domains v0.10.1/go.mod h1:RjDl3K8iq/ZZHMVqfZzRuBUr5t85gqA6LEXQBeBL5F4= @@ -104,13 +104,12 @@ cloud.google.com/go/longrunning v0.5.2/go.mod h1:nqo6DQbNV2pXhGDbDMoN2bWz68MjZUz cloud.google.com/go/longrunning v0.5.6/go.mod h1:vUaDrWYOMKRuhiv6JBnn49YxCPz2Ayn9GqyjaBT8/mA= cloud.google.com/go/longrunning v0.5.7/go.mod h1:8GClkudohy1Fxm3owmBGid8W0pSgodEMwEAztp38Xng= cloud.google.com/go/longrunning v0.5.9/go.mod h1:HD+0l9/OOW0za6UWdKJtXoFAX/BGg/3Wj8p10NeWF7c= -cloud.google.com/go/longrunning v0.5.11/go.mod h1:rDn7//lmlfWV1Dx6IB4RatCPenTwwmqXuiP0/RgoEO4= cloud.google.com/go/longrunning v0.5.12/go.mod h1:S5hMV8CDJ6r50t2ubVJSKQVv5u0rmik5//KgLO3k4lU= cloud.google.com/go/longrunning v0.6.0/go.mod h1:uHzSZqW89h7/pasCWNYdUpwGz3PcVWhrWupreVPYLts= cloud.google.com/go/longrunning v0.6.1 h1:lOLTFxYpr8hcRtcwWir5ITh1PAKUD/sG2lKrTSYjyMc= cloud.google.com/go/longrunning v0.6.1/go.mod h1:nHISoOZpBcmlwbJmiVk5oDRz0qG/ZxPynEGs1iZ79s0= cloud.google.com/go/managedidentities v1.7.1/go.mod h1:iK4qqIBOOfePt5cJR/Uo3+uol6oAVIbbG7MGy917cYM= -cloud.google.com/go/maps v1.13.0/go.mod h1:UepOes9un0UP7i8JBiaqgh8jqUaZAHVRXCYjrVlhSC8= +cloud.google.com/go/maps v1.14.0/go.mod h1:UepOes9un0UP7i8JBiaqgh8jqUaZAHVRXCYjrVlhSC8= cloud.google.com/go/mediatranslation v0.9.1/go.mod h1:vQH1amULNhSGryBjbjLb37g54rxrOwVxywS8WvUCsIU= cloud.google.com/go/memcache v1.11.1/go.mod h1:3zF+dEqmEmElHuO4NtHiShekQY5okQtssjPBv7jpmZ8= cloud.google.com/go/metastore v1.14.1/go.mod h1:WDvsAcbQLl9M4xL+eIpbKogH7aEaPWMhO9aRBcFOnJE= @@ -144,7 +143,7 @@ cloud.google.com/go/security v1.18.1/go.mod h1:5P1q9rqwt0HuVeL9p61pTqQ6Lgio1c64j cloud.google.com/go/securitycenter v1.35.1/go.mod h1:UDeknPuHWi15TaxrJCIv3aN1VDTz9nqWVUmW2vGayTo= cloud.google.com/go/servicedirectory v1.12.1/go.mod h1:d2H6joDMjnTQ4cUUCZn6k9NgZFbXjLVJbHETjoJR9k0= cloud.google.com/go/shell v1.8.1/go.mod h1:jaU7OHeldDhTwgs3+clM0KYEDYnBAPevUI6wNLf7ycE= -cloud.google.com/go/spanner v1.67.0/go.mod h1:Um+TNmxfcCHqNCKid4rmAMvoe/Iu1vdz6UfxJ9GPxRQ= +cloud.google.com/go/spanner v1.68.0/go.mod h1:X5T0XftydYp0K1adeJQDJtdWpbrOeJ7wHecM4tK6FiE= cloud.google.com/go/speech v1.25.1/go.mod h1:WgQghvghkZ1htG6BhYn98mP7Tg0mti8dBFDLMVXH/vM= cloud.google.com/go/storage v1.43.0 h1:CcxnSohZwizt4LCzQHWvBf1/kvtHUn7gk9QERXPyXFs= cloud.google.com/go/storage v1.43.0/go.mod h1:ajvxEa7WmZS1PxvKRq4bq0tFT3vMd502JwstCcYv0Q0= @@ -164,8 +163,8 @@ cloud.google.com/go/vpcaccess v1.8.1/go.mod h1:cWlLCpLOuMH8oaNmobaymgmLesasLd9w1 cloud.google.com/go/webrisk v1.10.1/go.mod h1:VzmUIag5P6V71nVAuzc7Hu0VkIDKjDa543K7HOulH/k= cloud.google.com/go/websecurityscanner v1.7.1/go.mod h1:vAZ6hyqECDhgF+gyVRGzfXMrURQN5NH75Y9yW/7sSHU= cloud.google.com/go/workflows v1.13.1/go.mod h1:xNdYtD6Sjoug+khNCAtBMK/rdh8qkjyL6aBas2XlkNc= -code.cloudfoundry.org/bytefmt v0.10.0 h1:q/n3VEyTHSYIr+MTRIYxNMRutBilgv0gbFWZbXqWI60= -code.cloudfoundry.org/bytefmt v0.10.0/go.mod h1:FQhPpsF//guTvK6ZnAC2JkVRZjl6s5ee0H90K2r3zxI= +code.cloudfoundry.org/bytefmt v0.11.0 h1:nyYr03vV/5apByN4lYr1vYM4/KKrM9Fc2PFQVmYRbi0= +code.cloudfoundry.org/bytefmt v0.11.0/go.mod h1:9nh0kJEX7nqb9l+byNdSy4xRtWeHy98a/P1Z0zdEnOE= dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20221208032759-85de2813cf6b/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= eliasnaur.com/font v0.0.0-20230308162249-dd43949cb42d/go.mod h1:OYVuxibdk9OSLX8vAqydtRPP87PyTFcT9uH3MlEGBQA= @@ -194,6 +193,7 @@ github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2 github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU= github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.5.0/go.mod h1:dppbR7CwXD4pgtV9t3wD1812RaLDcBjtblcDF5f1vI0= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.24.1/go.mod h1:itPGVDKf9cC/ov4MdvJ2QZ0khw4bfoo9jzwTJlaxy2k= github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk= github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9/go.mod h1:7uhhqiBaR4CpN0k9rMjOtjpcfGd6DG2m04zQxKnWQ0I= github.com/ajstarks/deck v0.0.0-20240918141114-8d365813662d/go.mod h1:5o5HzZ3nUiOivE0SPQepE7oNquDd+9yip0PtlFpq888= @@ -224,14 +224,14 @@ github.com/aws/aws-sdk-go-v2 v1.31.0 h1:3V05LbxTSItI5kUqNwhJrrrY1BAXxXt0sN0l72Qm github.com/aws/aws-sdk-go-v2 v1.31.0/go.mod h1:ztolYtaEUtdpf9Wftr31CJfLVjOnD/CVRkKOOYgF8hA= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.5 h1:xDAuZTn4IMm8o1LnBZvmrL8JA1io4o3YWNXgohbf20g= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.5/go.mod h1:wYSv6iDS621sEFLfKvpPE2ugjTuGlAG7iROg0hLOkfc= -github.com/aws/aws-sdk-go-v2/config v1.27.38 h1:mMVyJJuSUdbD4zKXoxDgWrgM60QwlFEg+JhihCq6wCw= -github.com/aws/aws-sdk-go-v2/config v1.27.38/go.mod h1:6xOiNEn58bj/64MPKx89r6G/el9JZn8pvVbquSqTKK4= -github.com/aws/aws-sdk-go-v2/credentials v1.17.36 h1:zwI5WrT+oWWfzSKoTNmSyeBKQhsFRJRv+PGW/UZW+Yk= -github.com/aws/aws-sdk-go-v2/credentials v1.17.36/go.mod h1:3AG/sY1rc9NJrNWcN/3KPU4SIDPGTrd/qegKB0TnFdE= +github.com/aws/aws-sdk-go-v2/config v1.27.39 h1:FCylu78eTGzW1ynHcongXK9YHtoXD5AiiUqq3YfJYjU= +github.com/aws/aws-sdk-go-v2/config v1.27.39/go.mod h1:wczj2hbyskP4LjMKBEZwPRO1shXY+GsQleab+ZXT2ik= +github.com/aws/aws-sdk-go-v2/credentials v1.17.37 h1:G2aOH01yW8X373JK419THj5QVqu9vKEwxSEsGxihoW0= +github.com/aws/aws-sdk-go-v2/credentials v1.17.37/go.mod h1:0ecCjlb7htYCptRD45lXJ6aJDQac6D2NlKGpZqyTG6A= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.14 h1:C/d03NAmh8C4BZXhuRNboF/DqhBkBCeDiJDcaqIT5pA= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.14/go.mod h1:7I0Ju7p9mCIdlrfS+JCgqcYD0VXz/N4yozsox+0o078= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.24 h1:WEiv2o2tjSx9tv5jP7rCR1P8FE8c6DxkFpvHGy6SYZg= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.24/go.mod h1:mhxj3DJiOXogLRZ/wlGmI9VHiCW2kzHjHTJLxexOtEk= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.25 h1:HkpHeZMM39sGtMHVYG1buAg93vhj5d7F81y6G0OAbGc= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.25/go.mod h1:j3Vz04ZjaWA6kygOsZRpmWe4CyGqfqq2u3unDTU0QGA= github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.18 h1:kYQ3H1u0ANr9KEKlGs/jTLrBFPo8P8NaH/w7A01NeeM= github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.18/go.mod h1:r506HmK5JDUh9+Mw4CfGJGSSoqIiLCndAuqXuhbv67Y= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.18 h1:Z7IdFUONvTcvS7YuhtVxN99v2cCoHRXOS4mTr0B/pUc= @@ -248,14 +248,14 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.20 h1:Xbwbmk44 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.20/go.mod h1:oAfOFzUB14ltPZj1rWwRc3d/6OgD76R8KlvU3EqM9Fg= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.18 h1:eb+tFOIl9ZsUe2259/BKPeniKuz4/02zZFH/i4Nf8Rg= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.18/go.mod h1:GVCC2IJNJTmdlyEsSmofEy7EfJncP7DNnXDzRjJ5Keg= -github.com/aws/aws-sdk-go-v2/service/s3 v1.63.2 h1:1iXmXy8SJzQVMGvo40TSzBYS9ig6BSyXfRIMzLfmBfE= -github.com/aws/aws-sdk-go-v2/service/s3 v1.63.2/go.mod h1:NLTqRLe3pUNu3nTEHI6XlHLKYmc8fbHUdMxAB6+s41Q= -github.com/aws/aws-sdk-go-v2/service/sso v1.23.2 h1:yzi/y/vKlLyzOfG7pSu5ONNGRxHIgLeDrV4w2AMRCo0= -github.com/aws/aws-sdk-go-v2/service/sso v1.23.2/go.mod h1:XRlMvmad0ZNL+75C5FYdMvbbLkd6qiqz6foR1nA1PXY= +github.com/aws/aws-sdk-go-v2/service/s3 v1.63.3 h1:3zt8qqznMuAZWDTDpcwv9Xr11M/lVj2FsRR7oYBt0OA= +github.com/aws/aws-sdk-go-v2/service/s3 v1.63.3/go.mod h1:NLTqRLe3pUNu3nTEHI6XlHLKYmc8fbHUdMxAB6+s41Q= +github.com/aws/aws-sdk-go-v2/service/sso v1.23.3 h1:rs4JCczF805+FDv2tRhZ1NU0RB2H6ryAvsWPanAr72Y= +github.com/aws/aws-sdk-go-v2/service/sso v1.23.3/go.mod h1:XRlMvmad0ZNL+75C5FYdMvbbLkd6qiqz6foR1nA1PXY= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4 h1:yiwVzJW2ZxZTurVbYWA7QOrAaCYQR72t0wrSBfoesUE= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4/go.mod h1:0oxfLkpz3rQ/CHlx5hB7H69YUpFiI1tql6Q6Ne+1bCw= -github.com/aws/aws-sdk-go-v2/service/sts v1.31.2 h1:O6tyji8mXmBGsHvTCB0VIhrDw19lGTUSbKIyjnw79s8= -github.com/aws/aws-sdk-go-v2/service/sts v1.31.2/go.mod h1:yMWe0F+XG0DkRZK5ODZhG7BEFYhLXi2dqGsv6tX0cgI= +github.com/aws/aws-sdk-go-v2/service/sts v1.31.3 h1:VzudTFrDCIDakXtemR7l6Qzt2+JYsVqo2MxBPt5k8T8= +github.com/aws/aws-sdk-go-v2/service/sts v1.31.3/go.mod h1:yMWe0F+XG0DkRZK5ODZhG7BEFYhLXi2dqGsv6tX0cgI= github.com/aws/smithy-go v1.21.0 h1:H7L8dtDRk0P1Qm6y0ji7MCYMQObJ5R9CRpyPhRUkLYA= github.com/aws/smithy-go v1.21.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= @@ -376,8 +376,8 @@ github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/goccy/go-yaml v1.9.8/go.mod h1:JubOolP3gh0HpiBc4BLRD4YmjEjHAmIIB2aaXKkTfoE= github.com/goccy/go-yaml v1.11.0/go.mod h1:H+mJrWtjPTJAHvRbV09MCK9xYwODM+wRTVFFTWckfng= -github.com/gocql/gocql v1.6.0 h1:IdFdOTbnpbd0pDhl4REKQDM+Q0SzKXQ1Yh+YZZ8T/qU= -github.com/gocql/gocql v1.6.0/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8= +github.com/gocql/gocql v1.7.0 h1:O+7U7/1gSN7QTEAaMEsJc1Oq2QHXvCWoF3DFK9HDHus= +github.com/gocql/gocql v1.7.0/go.mod h1:vnlvXyFZeLBF0Wy+RS8hrOdbn0UWsWtdg07XJnFxZ+4= github.com/gocraft/dbr/v2 v2.7.6 h1:ASHKFgCbTLODbb9f756Cl8VAlnvQLKqIzx9E1Cfb7eo= github.com/gocraft/dbr/v2 v2.7.6/go.mod h1:8IH98S8M8J0JSEiYk0MPH26ZDUKemiQ/GvmXL5jo+Uw= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -416,8 +416,8 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= -github.com/google/pprof v0.0.0-20240925223930-fa3061bff0bc h1:7bf8bGo4akhLJrmttkYLjxIz0yQmBi5umb+Nj1qRPpE= -github.com/google/pprof v0.0.0-20240925223930-fa3061bff0bc/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20241001023024-f4c0cfd0cf1d h1:Jaz2JzpQaQXyET0AjLBXShrthbpqMkhGiEfkcQAiAUs= +github.com/google/pprof v0.0.0-20241001023024-f4c0cfd0cf1d/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/s2a-go v0.1.3/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= @@ -492,8 +492,8 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:C github.com/kisielk/errcheck v1.7.0/go.mod h1:1kLL+jV4e+CFfueBmI1dSK2ADDyQnlrnrY/FqKluHJQ= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= -github.com/klauspost/compress v1.17.11-0.20240923131516-13a1ce6df1e0 h1:YNGbURX+AQoK0BmPSNoJrHLjfNQw8NvNOqLshq3hcpo= -github.com/klauspost/compress v1.17.11-0.20240923131516-13a1ce6df1e0/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= +github.com/klauspost/compress v1.17.11-0.20240927175842-8e14b1b5a913 h1:7s7Xd7zVElAw1qh/eh+tXDNfDNXXj38Tpq54eeG6/BM= +github.com/klauspost/compress v1.17.11-0.20240927175842-8e14b1b5a913/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM= github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/kpango/fastime v1.1.9 h1:xVQHcqyPt5M69DyFH7g1EPRns1YQNap9d5eLhl/Jy84= @@ -586,8 +586,8 @@ github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zI github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJoX0= -github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0= +github.com/prometheus/common v0.60.0 h1:+V9PAREWNvJMAuJ1x1BaWl9dewMW4YrHZQbx0sJNllA= +github.com/prometheus/common v0.60.0/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/quasilyte/go-ruleguard v0.4.2 h1:htXcXDK6/rO12kiTHKfHuqR4kr3Y4M0J0rOL6CH/BYs= @@ -640,8 +640,8 @@ github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vl github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= -github.com/unum-cloud/usearch/golang v0.0.0-20240828190432-b9a9758a06e1 h1:hILse+Dt0Sk6RfyG19Ld48kcdTOnHx2F6dm3QH1X4Mw= -github.com/unum-cloud/usearch/golang v0.0.0-20240828190432-b9a9758a06e1/go.mod h1:NxBpQibuBBeA/V8RGbrNzVAv4OyWWL5yNao7mVz656k= +github.com/unum-cloud/usearch/golang v0.0.0-20240928043120-b3da75964080 h1:8Bp9eul9roXA0UUSEZa3fyhGz4i/nD6CL8UzZlsbYmg= +github.com/unum-cloud/usearch/golang v0.0.0-20240928043120-b3da75964080/go.mod h1:NxBpQibuBBeA/V8RGbrNzVAv4OyWWL5yNao7mVz656k= github.com/urfave/cli/v2 v2.4.0/go.mod h1:NX9W0zmTvedE5oDoOMs2RTC8RvdK98NTYZE5LbaEYPg= github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ= github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0= @@ -655,6 +655,7 @@ go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0= go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/contrib/detectors/gcp v1.29.0/go.mod h1:GW2aWZNwR2ZxDLdv8OyC2G8zkRoQBuURgV7RPQgcPoU= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0 h1:hCq2hNMwsegUvPzI7sPOvtO9cqyy5GbWt/Ybp2xrx8Q= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0/go.mod h1:LqaApwGx/oUmzsbqxkzuBvyoPpkxk3JQWnqfVrJ3wCA= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= @@ -708,7 +709,7 @@ golang.org/x/exp/typeparams v0.0.0-20240909161429-701f63a606c0/go.mod h1:AbB0pIl golang.org/x/image v0.20.0 h1:7cVCUjQwfL18gyBJOmYvptfSHS8Fb3YUDtfLIZ7Nbpw= golang.org/x/image v0.20.0/go.mod h1:0a88To4CYVBAHp5FXJm8o7QbUl37Vd85ply1vyD8auM= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20240909163608-642950227fb3/go.mod h1:5EJr05J3jS1A5hwVNxs4vC0pIRxtWmwM15D1ZxCj93s= +golang.org/x/mobile v0.0.0-20240930194658-c6794c95c70b/go.mod h1:5EJr05J3jS1A5hwVNxs4vC0pIRxtWmwM15D1ZxCj93s= golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= @@ -741,15 +742,15 @@ gonum.org/v1/plot v0.14.0/go.mod h1:MLdR9424SJed+5VqC6MsouEpig9pZX2VZ57H9ko2bXU= google.golang.org/api v0.199.0 h1:aWUXClp+VFJmqE0JPvpZOK3LDQMyFKYIow4etYd9qxs= google.golang.org/api v0.199.0/go.mod h1:ohG4qSztDJmZdjK/Ar6MhbAmb/Rpi4JHOqagsh90K28= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto v0.0.0-20240924160255-9d4c2d233b61 h1:KipVMxePgXPFBzXOvpKbny3RVdVmJOD64R/Ob7GPWEs= -google.golang.org/genproto v0.0.0-20240924160255-9d4c2d233b61/go.mod h1:HiAZQz/G7n0EywFjmncAwsfnmFm2bjm7qPjwl8hyzjM= -google.golang.org/genproto/googleapis/api v0.0.0-20240924160255-9d4c2d233b61 h1:pAjq8XSSzXoP9ya73v/w+9QEAAJNluLrpmMq5qFJQNY= -google.golang.org/genproto/googleapis/api v0.0.0-20240924160255-9d4c2d233b61/go.mod h1:O6rP0uBq4k0mdi/b4ZEMAZjkhYWhS815kCvaMha4VN8= +google.golang.org/genproto v0.0.0-20240930140551-af27646dc61f h1:mCJ6SGikSxVlt9scCayUl2dMq0msUgmBArqRY6umieI= +google.golang.org/genproto v0.0.0-20240930140551-af27646dc61f/go.mod h1:xtVODtPkMQRUZ4kqOTgp6JrXQrPevvfCSdk4mJtHUbM= +google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f h1:jTm13A2itBi3La6yTGqn8bVSrc3ZZ1r8ENHlIXBfnRA= +google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f/go.mod h1:CLGoBuH1VHxAUXVPP8FfPwPEVJB6lz3URE5mY2SuayE= google.golang.org/genproto/googleapis/bytestream v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:q0eWNnCW04EJlyrmLT+ZHsjuoUiZ36/eAEdCCezZoco= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 h1:N9BgCIAUvn/M+p4NJccWPWb3BWh88+zyL0ll9HgbEeM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= -google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/hack/actions/gen/main_test.go b/hack/actions/gen/main_test.go new file mode 100644 index 0000000000..febb202e0f --- /dev/null +++ b/hack/actions/gen/main_test.go @@ -0,0 +1,692 @@ +// Copyright (C) 2019-2024 vdaas.org vald team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package gen + +// NOT IMPLEMENTED BELOW +// +// func TestData_initPullRequestPaths(t *testing.T) { +// type fields struct { +// AliasImage bool +// ConfigExists bool +// Year int +// ContainerType ContainerType +// AppName string +// BinDir string +// BuildUser string +// BuilderImage string +// BuilderTag string +// BuildStageName string +// Maintainer string +// PackageDir string +// RootDir string +// RuntimeImage string +// RuntimeTag string +// RuntimeUser string +// Name string +// BuildPlatforms string +// Arguments map[string]string +// Environments map[string]string +// Entrypoints []string +// EnvironmentsSlice []string +// ExtraCopies []string +// ExtraImages []string +// ExtraPackages []string +// Preprocess []string +// RunCommands []string +// RunMounts []string +// StageFiles []string +// PullRequestPaths []string +// } +// type want struct{} +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want) error { +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// AliasImage:false, +// ConfigExists:false, +// Year:0, +// ContainerType:nil, +// AppName:"", +// BinDir:"", +// BuildUser:"", +// BuilderImage:"", +// BuilderTag:"", +// BuildStageName:"", +// Maintainer:"", +// PackageDir:"", +// RootDir:"", +// RuntimeImage:"", +// RuntimeTag:"", +// RuntimeUser:"", +// Name:"", +// BuildPlatforms:"", +// Arguments:nil, +// Environments:nil, +// Entrypoints:nil, +// EnvironmentsSlice:nil, +// ExtraCopies:nil, +// ExtraImages:nil, +// ExtraPackages:nil, +// Preprocess:nil, +// RunCommands:nil, +// RunMounts:nil, +// StageFiles:nil, +// PullRequestPaths:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// AliasImage:false, +// ConfigExists:false, +// Year:0, +// ContainerType:nil, +// AppName:"", +// BinDir:"", +// BuildUser:"", +// BuilderImage:"", +// BuilderTag:"", +// BuildStageName:"", +// Maintainer:"", +// PackageDir:"", +// RootDir:"", +// RuntimeImage:"", +// RuntimeTag:"", +// RuntimeUser:"", +// Name:"", +// BuildPlatforms:"", +// Arguments:nil, +// Environments:nil, +// Entrypoints:nil, +// EnvironmentsSlice:nil, +// ExtraCopies:nil, +// ExtraImages:nil, +// ExtraPackages:nil, +// Preprocess:nil, +// RunCommands:nil, +// RunMounts:nil, +// StageFiles:nil, +// PullRequestPaths:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// data := &Data{ +// AliasImage: test.fields.AliasImage, +// ConfigExists: test.fields.ConfigExists, +// Year: test.fields.Year, +// ContainerType: test.fields.ContainerType, +// AppName: test.fields.AppName, +// BinDir: test.fields.BinDir, +// BuildUser: test.fields.BuildUser, +// BuilderImage: test.fields.BuilderImage, +// BuilderTag: test.fields.BuilderTag, +// BuildStageName: test.fields.BuildStageName, +// Maintainer: test.fields.Maintainer, +// PackageDir: test.fields.PackageDir, +// RootDir: test.fields.RootDir, +// RuntimeImage: test.fields.RuntimeImage, +// RuntimeTag: test.fields.RuntimeTag, +// RuntimeUser: test.fields.RuntimeUser, +// Name: test.fields.Name, +// BuildPlatforms: test.fields.BuildPlatforms, +// Arguments: test.fields.Arguments, +// Environments: test.fields.Environments, +// Entrypoints: test.fields.Entrypoints, +// EnvironmentsSlice: test.fields.EnvironmentsSlice, +// ExtraCopies: test.fields.ExtraCopies, +// ExtraImages: test.fields.ExtraImages, +// ExtraPackages: test.fields.ExtraPackages, +// Preprocess: test.fields.Preprocess, +// RunCommands: test.fields.RunCommands, +// RunMounts: test.fields.RunMounts, +// StageFiles: test.fields.StageFiles, +// PullRequestPaths: test.fields.PullRequestPaths, +// } +// +// data.initPullRequestPaths() +// if err := checkFunc(test.want); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func TestData_initData(t *testing.T) { +// type fields struct { +// AliasImage bool +// ConfigExists bool +// Year int +// ContainerType ContainerType +// AppName string +// BinDir string +// BuildUser string +// BuilderImage string +// BuilderTag string +// BuildStageName string +// Maintainer string +// PackageDir string +// RootDir string +// RuntimeImage string +// RuntimeTag string +// RuntimeUser string +// Name string +// BuildPlatforms string +// Arguments map[string]string +// Environments map[string]string +// Entrypoints []string +// EnvironmentsSlice []string +// ExtraCopies []string +// ExtraImages []string +// ExtraPackages []string +// Preprocess []string +// RunCommands []string +// RunMounts []string +// StageFiles []string +// PullRequestPaths []string +// } +// type want struct{} +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want) error { +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// AliasImage:false, +// ConfigExists:false, +// Year:0, +// ContainerType:nil, +// AppName:"", +// BinDir:"", +// BuildUser:"", +// BuilderImage:"", +// BuilderTag:"", +// BuildStageName:"", +// Maintainer:"", +// PackageDir:"", +// RootDir:"", +// RuntimeImage:"", +// RuntimeTag:"", +// RuntimeUser:"", +// Name:"", +// BuildPlatforms:"", +// Arguments:nil, +// Environments:nil, +// Entrypoints:nil, +// EnvironmentsSlice:nil, +// ExtraCopies:nil, +// ExtraImages:nil, +// ExtraPackages:nil, +// Preprocess:nil, +// RunCommands:nil, +// RunMounts:nil, +// StageFiles:nil, +// PullRequestPaths:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// AliasImage:false, +// ConfigExists:false, +// Year:0, +// ContainerType:nil, +// AppName:"", +// BinDir:"", +// BuildUser:"", +// BuilderImage:"", +// BuilderTag:"", +// BuildStageName:"", +// Maintainer:"", +// PackageDir:"", +// RootDir:"", +// RuntimeImage:"", +// RuntimeTag:"", +// RuntimeUser:"", +// Name:"", +// BuildPlatforms:"", +// Arguments:nil, +// Environments:nil, +// Entrypoints:nil, +// EnvironmentsSlice:nil, +// ExtraCopies:nil, +// ExtraImages:nil, +// ExtraPackages:nil, +// Preprocess:nil, +// RunCommands:nil, +// RunMounts:nil, +// StageFiles:nil, +// PullRequestPaths:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// data := &Data{ +// AliasImage: test.fields.AliasImage, +// ConfigExists: test.fields.ConfigExists, +// Year: test.fields.Year, +// ContainerType: test.fields.ContainerType, +// AppName: test.fields.AppName, +// BinDir: test.fields.BinDir, +// BuildUser: test.fields.BuildUser, +// BuilderImage: test.fields.BuilderImage, +// BuilderTag: test.fields.BuilderTag, +// BuildStageName: test.fields.BuildStageName, +// Maintainer: test.fields.Maintainer, +// PackageDir: test.fields.PackageDir, +// RootDir: test.fields.RootDir, +// RuntimeImage: test.fields.RuntimeImage, +// RuntimeTag: test.fields.RuntimeTag, +// RuntimeUser: test.fields.RuntimeUser, +// Name: test.fields.Name, +// BuildPlatforms: test.fields.BuildPlatforms, +// Arguments: test.fields.Arguments, +// Environments: test.fields.Environments, +// Entrypoints: test.fields.Entrypoints, +// EnvironmentsSlice: test.fields.EnvironmentsSlice, +// ExtraCopies: test.fields.ExtraCopies, +// ExtraImages: test.fields.ExtraImages, +// ExtraPackages: test.fields.ExtraPackages, +// Preprocess: test.fields.Preprocess, +// RunCommands: test.fields.RunCommands, +// RunMounts: test.fields.RunMounts, +// StageFiles: test.fields.StageFiles, +// PullRequestPaths: test.fields.PullRequestPaths, +// } +// +// data.initData() +// if err := checkFunc(test.want); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func TestData_generateWorkflowStruct(t *testing.T) { +// type fields struct { +// AliasImage bool +// ConfigExists bool +// Year int +// ContainerType ContainerType +// AppName string +// BinDir string +// BuildUser string +// BuilderImage string +// BuilderTag string +// BuildStageName string +// Maintainer string +// PackageDir string +// RootDir string +// RuntimeImage string +// RuntimeTag string +// RuntimeUser string +// Name string +// BuildPlatforms string +// Arguments map[string]string +// Environments map[string]string +// Entrypoints []string +// EnvironmentsSlice []string +// ExtraCopies []string +// ExtraImages []string +// ExtraPackages []string +// Preprocess []string +// RunCommands []string +// RunMounts []string +// StageFiles []string +// PullRequestPaths []string +// } +// type want struct { +// want *Workflow +// err error +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, *Workflow, error) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, got *Workflow, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// AliasImage:false, +// ConfigExists:false, +// Year:0, +// ContainerType:nil, +// AppName:"", +// BinDir:"", +// BuildUser:"", +// BuilderImage:"", +// BuilderTag:"", +// BuildStageName:"", +// Maintainer:"", +// PackageDir:"", +// RootDir:"", +// RuntimeImage:"", +// RuntimeTag:"", +// RuntimeUser:"", +// Name:"", +// BuildPlatforms:"", +// Arguments:nil, +// Environments:nil, +// Entrypoints:nil, +// EnvironmentsSlice:nil, +// ExtraCopies:nil, +// ExtraImages:nil, +// ExtraPackages:nil, +// Preprocess:nil, +// RunCommands:nil, +// RunMounts:nil, +// StageFiles:nil, +// PullRequestPaths:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// AliasImage:false, +// ConfigExists:false, +// Year:0, +// ContainerType:nil, +// AppName:"", +// BinDir:"", +// BuildUser:"", +// BuilderImage:"", +// BuilderTag:"", +// BuildStageName:"", +// Maintainer:"", +// PackageDir:"", +// RootDir:"", +// RuntimeImage:"", +// RuntimeTag:"", +// RuntimeUser:"", +// Name:"", +// BuildPlatforms:"", +// Arguments:nil, +// Environments:nil, +// Entrypoints:nil, +// EnvironmentsSlice:nil, +// ExtraCopies:nil, +// ExtraImages:nil, +// ExtraPackages:nil, +// Preprocess:nil, +// RunCommands:nil, +// RunMounts:nil, +// StageFiles:nil, +// PullRequestPaths:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// data := &Data{ +// AliasImage: test.fields.AliasImage, +// ConfigExists: test.fields.ConfigExists, +// Year: test.fields.Year, +// ContainerType: test.fields.ContainerType, +// AppName: test.fields.AppName, +// BinDir: test.fields.BinDir, +// BuildUser: test.fields.BuildUser, +// BuilderImage: test.fields.BuilderImage, +// BuilderTag: test.fields.BuilderTag, +// BuildStageName: test.fields.BuildStageName, +// Maintainer: test.fields.Maintainer, +// PackageDir: test.fields.PackageDir, +// RootDir: test.fields.RootDir, +// RuntimeImage: test.fields.RuntimeImage, +// RuntimeTag: test.fields.RuntimeTag, +// RuntimeUser: test.fields.RuntimeUser, +// Name: test.fields.Name, +// BuildPlatforms: test.fields.BuildPlatforms, +// Arguments: test.fields.Arguments, +// Environments: test.fields.Environments, +// Entrypoints: test.fields.Entrypoints, +// EnvironmentsSlice: test.fields.EnvironmentsSlice, +// ExtraCopies: test.fields.ExtraCopies, +// ExtraImages: test.fields.ExtraImages, +// ExtraPackages: test.fields.ExtraPackages, +// Preprocess: test.fields.Preprocess, +// RunCommands: test.fields.RunCommands, +// RunMounts: test.fields.RunMounts, +// StageFiles: test.fields.StageFiles, +// PullRequestPaths: test.fields.PullRequestPaths, +// } +// +// got, err := data.generateWorkflowStruct() +// if err := checkFunc(test.want, got, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func Test_main(t *testing.T) { +// type want struct{} +// type test struct { +// name string +// want want +// checkFunc func(want) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want) error { +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// main() +// if err := checkFunc(test.want); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } diff --git a/hack/go.mod.default b/hack/go.mod.default index 7185722665..38793cafcd 100644 --- a/hack/go.mod.default +++ b/hack/go.mod.default @@ -1,6 +1,6 @@ module github.com/vdaas/vald -go 1.23.1 +go 1.23.2 replace ( cloud.google.com/go => cloud.google.com/go upgrade diff --git a/internal/core/algorithm/usearch/option_test.go b/internal/core/algorithm/usearch/option_test.go new file mode 100644 index 0000000000..26be929db9 --- /dev/null +++ b/internal/core/algorithm/usearch/option_test.go @@ -0,0 +1,696 @@ +// Copyright (C) 2019-2024 vdaas.org vald team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package usearch + +// NOT IMPLEMENTED BELOW +// +// func TestWithIndexPath(t *testing.T) { +// type args struct { +// path string +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// path:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// path:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithIndexPath(test.args.path) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func TestWithQuantizationType(t *testing.T) { +// type args struct { +// quantizationType string +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// quantizationType:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// quantizationType:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithQuantizationType(test.args.quantizationType) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func TestWithMetricType(t *testing.T) { +// type args struct { +// metricType string +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// metricType:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// metricType:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithMetricType(test.args.metricType) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func TestWithDimension(t *testing.T) { +// type args struct { +// dim int +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// dim:0, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// dim:0, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithDimension(test.args.dim) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func TestWithConnectivity(t *testing.T) { +// type args struct { +// connectivity int +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// connectivity:0, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// connectivity:0, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithConnectivity(test.args.connectivity) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func TestWithExpansionAdd(t *testing.T) { +// type args struct { +// expansionAdd int +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// expansionAdd:0, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// expansionAdd:0, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithExpansionAdd(test.args.expansionAdd) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func TestWithExpansionSearch(t *testing.T) { +// type args struct { +// expansionSearch int +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// expansionSearch:0, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// expansionSearch:0, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithExpansionSearch(test.args.expansionSearch) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func TestWithMulti(t *testing.T) { +// type args struct { +// multi bool +// } +// type want struct { +// want Option +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Option) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Option) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// multi:false, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// multi:false, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := WithMulti(test.args.multi) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } diff --git a/internal/core/algorithm/usearch/usearch_test.go b/internal/core/algorithm/usearch/usearch_test.go index bcd03fee5b..8537488831 100644 --- a/internal/core/algorithm/usearch/usearch_test.go +++ b/internal/core/algorithm/usearch/usearch_test.go @@ -349,3 +349,1331 @@ func Test_usearch_Search(t *testing.T) { }) } } + +// NOT IMPLEMENTED BELOW +// +// func TestNew(t *testing.T) { +// type args struct { +// opts []Option +// } +// type want struct { +// want Usearch +// err error +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Usearch, error) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Usearch, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// opts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// opts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got, err := New(test.args.opts...) +// if err := checkFunc(test.want, got, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func TestLoad(t *testing.T) { +// type args struct { +// opts []Option +// } +// type want struct { +// want Usearch +// err error +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Usearch, error) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Usearch, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// opts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// opts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got, err := Load(test.args.opts...) +// if err := checkFunc(test.want, got, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func Test_gen(t *testing.T) { +// type args struct { +// isLoad bool +// opts []Option +// } +// type want struct { +// want Usearch +// err error +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, Usearch, error) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got Usearch, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// isLoad:false, +// opts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// isLoad:false, +// opts:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got, err := gen(test.args.isLoad, test.args.opts...) +// if err := checkFunc(test.want, got, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func Test_usearch_SaveIndex(t *testing.T) { +// type fields struct { +// index *core.Index +// quantizationType core.Quantization +// metricType core.Metric +// dimension uint +// connectivity uint +// expansionAdd uint +// expansionSearch uint +// multi bool +// idxPath string +// mu *sync.RWMutex +// } +// type want struct { +// err error +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, error) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// u := &usearch{ +// index: test.fields.index, +// quantizationType: test.fields.quantizationType, +// metricType: test.fields.metricType, +// dimension: test.fields.dimension, +// connectivity: test.fields.connectivity, +// expansionAdd: test.fields.expansionAdd, +// expansionSearch: test.fields.expansionSearch, +// multi: test.fields.multi, +// idxPath: test.fields.idxPath, +// mu: test.fields.mu, +// } +// +// err := u.SaveIndex() +// if err := checkFunc(test.want, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func Test_usearch_SaveIndexWithPath(t *testing.T) { +// type args struct { +// idxPath string +// } +// type fields struct { +// index *core.Index +// quantizationType core.Quantization +// metricType core.Metric +// dimension uint +// connectivity uint +// expansionAdd uint +// expansionSearch uint +// multi bool +// idxPath string +// mu *sync.RWMutex +// } +// type want struct { +// err error +// } +// type test struct { +// name string +// args args +// fields fields +// want want +// checkFunc func(want, error) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// idxPath:"", +// }, +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// idxPath:"", +// }, +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// u := &usearch{ +// index: test.fields.index, +// quantizationType: test.fields.quantizationType, +// metricType: test.fields.metricType, +// dimension: test.fields.dimension, +// connectivity: test.fields.connectivity, +// expansionAdd: test.fields.expansionAdd, +// expansionSearch: test.fields.expansionSearch, +// multi: test.fields.multi, +// idxPath: test.fields.idxPath, +// mu: test.fields.mu, +// } +// +// err := u.SaveIndexWithPath(test.args.idxPath) +// if err := checkFunc(test.want, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func Test_usearch_GetIndicesSize(t *testing.T) { +// type fields struct { +// index *core.Index +// quantizationType core.Quantization +// metricType core.Metric +// dimension uint +// connectivity uint +// expansionAdd uint +// expansionSearch uint +// multi bool +// idxPath string +// mu *sync.RWMutex +// } +// type want struct { +// wantIndicesSize int +// err error +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, int, error) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, gotIndicesSize int, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// if !reflect.DeepEqual(gotIndicesSize, w.wantIndicesSize) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotIndicesSize, w.wantIndicesSize) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// u := &usearch{ +// index: test.fields.index, +// quantizationType: test.fields.quantizationType, +// metricType: test.fields.metricType, +// dimension: test.fields.dimension, +// connectivity: test.fields.connectivity, +// expansionAdd: test.fields.expansionAdd, +// expansionSearch: test.fields.expansionSearch, +// multi: test.fields.multi, +// idxPath: test.fields.idxPath, +// mu: test.fields.mu, +// } +// +// gotIndicesSize, err := u.GetIndicesSize() +// if err := checkFunc(test.want, gotIndicesSize, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func Test_usearch_Add(t *testing.T) { +// type args struct { +// key core.Key +// vec []float32 +// } +// type fields struct { +// index *core.Index +// quantizationType core.Quantization +// metricType core.Metric +// dimension uint +// connectivity uint +// expansionAdd uint +// expansionSearch uint +// multi bool +// idxPath string +// mu *sync.RWMutex +// } +// type want struct { +// err error +// } +// type test struct { +// name string +// args args +// fields fields +// want want +// checkFunc func(want, error) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// key:nil, +// vec:nil, +// }, +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// key:nil, +// vec:nil, +// }, +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// u := &usearch{ +// index: test.fields.index, +// quantizationType: test.fields.quantizationType, +// metricType: test.fields.metricType, +// dimension: test.fields.dimension, +// connectivity: test.fields.connectivity, +// expansionAdd: test.fields.expansionAdd, +// expansionSearch: test.fields.expansionSearch, +// multi: test.fields.multi, +// idxPath: test.fields.idxPath, +// mu: test.fields.mu, +// } +// +// err := u.Add(test.args.key, test.args.vec) +// if err := checkFunc(test.want, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func Test_usearch_Reserve(t *testing.T) { +// type args struct { +// vectorCount int +// } +// type fields struct { +// index *core.Index +// quantizationType core.Quantization +// metricType core.Metric +// dimension uint +// connectivity uint +// expansionAdd uint +// expansionSearch uint +// multi bool +// idxPath string +// mu *sync.RWMutex +// } +// type want struct { +// err error +// } +// type test struct { +// name string +// args args +// fields fields +// want want +// checkFunc func(want, error) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// vectorCount:0, +// }, +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// vectorCount:0, +// }, +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// u := &usearch{ +// index: test.fields.index, +// quantizationType: test.fields.quantizationType, +// metricType: test.fields.metricType, +// dimension: test.fields.dimension, +// connectivity: test.fields.connectivity, +// expansionAdd: test.fields.expansionAdd, +// expansionSearch: test.fields.expansionSearch, +// multi: test.fields.multi, +// idxPath: test.fields.idxPath, +// mu: test.fields.mu, +// } +// +// err := u.Reserve(test.args.vectorCount) +// if err := checkFunc(test.want, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func Test_usearch_GetObject(t *testing.T) { +// type args struct { +// key core.Key +// count int +// } +// type fields struct { +// index *core.Index +// quantizationType core.Quantization +// metricType core.Metric +// dimension uint +// connectivity uint +// expansionAdd uint +// expansionSearch uint +// multi bool +// idxPath string +// mu *sync.RWMutex +// } +// type want struct { +// want []float32 +// err error +// } +// type test struct { +// name string +// args args +// fields fields +// want want +// checkFunc func(want, []float32, error) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got []float32, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// key:nil, +// count:0, +// }, +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// key:nil, +// count:0, +// }, +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// u := &usearch{ +// index: test.fields.index, +// quantizationType: test.fields.quantizationType, +// metricType: test.fields.metricType, +// dimension: test.fields.dimension, +// connectivity: test.fields.connectivity, +// expansionAdd: test.fields.expansionAdd, +// expansionSearch: test.fields.expansionSearch, +// multi: test.fields.multi, +// idxPath: test.fields.idxPath, +// mu: test.fields.mu, +// } +// +// got, err := u.GetObject(test.args.key, test.args.count) +// if err := checkFunc(test.want, got, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func Test_usearch_Remove(t *testing.T) { +// type args struct { +// key core.Key +// } +// type fields struct { +// index *core.Index +// quantizationType core.Quantization +// metricType core.Metric +// dimension uint +// connectivity uint +// expansionAdd uint +// expansionSearch uint +// multi bool +// idxPath string +// mu *sync.RWMutex +// } +// type want struct { +// err error +// } +// type test struct { +// name string +// args args +// fields fields +// want want +// checkFunc func(want, error) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// key:nil, +// }, +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// key:nil, +// }, +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// u := &usearch{ +// index: test.fields.index, +// quantizationType: test.fields.quantizationType, +// metricType: test.fields.metricType, +// dimension: test.fields.dimension, +// connectivity: test.fields.connectivity, +// expansionAdd: test.fields.expansionAdd, +// expansionSearch: test.fields.expansionSearch, +// multi: test.fields.multi, +// idxPath: test.fields.idxPath, +// mu: test.fields.mu, +// } +// +// err := u.Remove(test.args.key) +// if err := checkFunc(test.want, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func Test_usearch_Close(t *testing.T) { +// type fields struct { +// index *core.Index +// quantizationType core.Quantization +// metricType core.Metric +// dimension uint +// connectivity uint +// expansionAdd uint +// expansionSearch uint +// multi bool +// idxPath string +// mu *sync.RWMutex +// } +// type want struct { +// err error +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, error) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// index:nil, +// quantizationType:nil, +// metricType:nil, +// dimension:0, +// connectivity:0, +// expansionAdd:0, +// expansionSearch:0, +// multi:false, +// idxPath:"", +// mu:sync.RWMutex{}, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// u := &usearch{ +// index: test.fields.index, +// quantizationType: test.fields.quantizationType, +// metricType: test.fields.metricType, +// dimension: test.fields.dimension, +// connectivity: test.fields.connectivity, +// expansionAdd: test.fields.expansionAdd, +// expansionSearch: test.fields.expansionSearch, +// multi: test.fields.multi, +// idxPath: test.fields.idxPath, +// mu: test.fields.mu, +// } +// +// err := u.Close() +// if err := checkFunc(test.want, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } diff --git a/internal/errors/usearch_test.go b/internal/errors/usearch_test.go new file mode 100644 index 0000000000..70a2325350 --- /dev/null +++ b/internal/errors/usearch_test.go @@ -0,0 +1,189 @@ +// Copyright (C) 2019-2024 vdaas.org vald team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package errors + +// NOT IMPLEMENTED BELOW +// +// func TestNewUsearchError(t *testing.T) { +// type args struct { +// msg string +// } +// type want struct { +// err error +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, error) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, err error) error { +// if !Is(err, w.err) { +// return Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// msg:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// msg:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// err := NewUsearchError(test.args.msg) +// if err := checkFunc(test.want, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func TestUsearchError_Error(t *testing.T) { +// type fields struct { +// Msg string +// } +// type want struct { +// want string +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, string) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, got string) error { +// if !reflect.DeepEqual(got, w.want) { +// return Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// Msg:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// Msg:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// u := UsearchError{ +// Msg: test.fields.Msg, +// } +// +// got := u.Error() +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } diff --git a/internal/net/grpc/client_test.go b/internal/net/grpc/client_test.go index f28d50023b..15d9e06b80 100644 --- a/internal/net/grpc/client_test.go +++ b/internal/net/grpc/client_test.go @@ -109,28 +109,29 @@ package grpc // ctx context.Context // } // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // want <-chan error @@ -171,6 +172,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -214,6 +216,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -258,28 +261,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // got, err := g.StartConnectionMonitor(test.args.ctx) @@ -296,28 +300,29 @@ package grpc // f func(ctx context.Context, addr string, conn *ClientConn, copts ...CallOption) error // } // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // err error @@ -355,6 +360,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -399,6 +405,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -443,28 +450,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // err := g.Range(test.args.ctx, test.args.f) @@ -482,28 +490,29 @@ package grpc // f func(ctx context.Context, addr string, conn *ClientConn, copts ...CallOption) error // } // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // err error @@ -542,6 +551,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -587,6 +597,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -631,28 +642,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // err := g.RangeConcurrent(test.args.ctx, test.args.concurrency, test.args.f) @@ -670,28 +682,29 @@ package grpc // f func(ctx context.Context, addr string, conn *ClientConn, copts ...CallOption) error // } // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // err error @@ -730,6 +743,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -775,6 +789,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -819,28 +834,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // err := g.OrderedRange(test.args.ctx, test.args.orders, test.args.f) @@ -859,28 +875,29 @@ package grpc // f func(ctx context.Context, addr string, conn *ClientConn, copts ...CallOption) error // } // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // err error @@ -920,6 +937,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -966,6 +984,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -1010,28 +1029,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // err := g.OrderedRangeConcurrent(test.args.ctx, test.args.orders, test.args.concurrency, test.args.f) @@ -1048,28 +1068,29 @@ package grpc // f func(ctx context.Context, conn *ClientConn, copts ...CallOption) (any, error) // } // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // wantData any @@ -1111,6 +1132,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -1155,6 +1177,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -1199,28 +1222,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // gotData, err := g.RoundRobin(test.args.ctx, test.args.f) @@ -1238,28 +1262,29 @@ package grpc // f func(ctx context.Context, conn *ClientConn, copts ...CallOption) (any, error) // } // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // wantData any @@ -1302,6 +1327,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -1347,6 +1373,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -1391,28 +1418,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // gotData, err := g.Do(test.args.ctx, test.args.addr, test.args.f) @@ -1432,28 +1460,29 @@ package grpc // f func(ctx context.Context, conn *ClientConn, copts ...CallOption) (any, error) // } // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // wantData any @@ -1498,6 +1527,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -1545,6 +1575,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -1589,28 +1620,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // gotData, err := g.connectWithBackoff(test.args.ctx, test.args.p, test.args.addr, test.args.enableBackoff, test.args.f) @@ -1623,28 +1655,29 @@ package grpc // // func Test_gRPCClient_GetDialOption(t *testing.T) { // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // want []DialOption @@ -1677,6 +1710,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -1717,6 +1751,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -1761,28 +1796,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // got := g.GetDialOption() @@ -1795,28 +1831,29 @@ package grpc // // func Test_gRPCClient_GetCallOption(t *testing.T) { // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // want []CallOption @@ -1849,6 +1886,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -1889,6 +1927,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -1933,28 +1972,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // got := g.GetCallOption() @@ -1967,28 +2007,29 @@ package grpc // // func Test_gRPCClient_GetBackoff(t *testing.T) { // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // want backoff.Backoff @@ -2021,6 +2062,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -2061,6 +2103,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -2105,28 +2148,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // got := g.GetBackoff() @@ -2137,6 +2181,190 @@ package grpc // } // } // +// func Test_gRPCClient_SetDisableResolveDNSAddr(t *testing.T) { +// type args struct { +// addr string +// disabled bool +// } +// type fields struct { +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc +// } +// type want struct{} +// type test struct { +// name string +// args args +// fields fields +// want want +// checkFunc func(want) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want) error { +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// addr:"", +// disabled:false, +// }, +// fields: fields { +// addrs:nil, +// poolSize:0, +// clientCount:0, +// conns:nil, +// hcDur:nil, +// prDur:nil, +// dialer:nil, +// enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, +// resolveDNS:false, +// dopts:nil, +// copts:nil, +// roccd:"", +// eg:nil, +// bo:nil, +// cb:nil, +// gbo:nil, +// mcd:nil, +// group:nil, +// crl:nil, +// ech:nil, +// monitorRunning:nil, +// stopMonitor:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// addr:"", +// disabled:false, +// }, +// fields: fields { +// addrs:nil, +// poolSize:0, +// clientCount:0, +// conns:nil, +// hcDur:nil, +// prDur:nil, +// dialer:nil, +// enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, +// resolveDNS:false, +// dopts:nil, +// copts:nil, +// roccd:"", +// eg:nil, +// bo:nil, +// cb:nil, +// gbo:nil, +// mcd:nil, +// group:nil, +// crl:nil, +// ech:nil, +// monitorRunning:nil, +// stopMonitor:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// g := &gRPCClient{ +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, +// } +// +// g.SetDisableResolveDNSAddr(test.args.addr, test.args.disabled) +// if err := checkFunc(test.want); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// // func Test_gRPCClient_Connect(t *testing.T) { // type args struct { // ctx context.Context @@ -2144,28 +2372,29 @@ package grpc // dopts []DialOption // } // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // wantConn pool.Conn @@ -2208,6 +2437,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -2253,6 +2483,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -2297,28 +2528,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // gotConn, err := g.Connect(test.args.ctx, test.args.addr, test.args.dopts...) @@ -2335,28 +2567,29 @@ package grpc // addr string // } // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // want bool @@ -2394,6 +2627,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -2438,6 +2672,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -2482,28 +2717,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // got := g.IsConnected(test.args.ctx, test.args.addr) @@ -2520,28 +2756,29 @@ package grpc // addr string // } // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // err error @@ -2579,6 +2816,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -2623,6 +2861,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -2667,28 +2906,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // err := g.Disconnect(test.args.ctx, test.args.addr) @@ -2701,28 +2941,29 @@ package grpc // // func Test_gRPCClient_ConnectedAddrs(t *testing.T) { // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // wantAddrs []string @@ -2755,6 +2996,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -2795,6 +3037,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -2839,28 +3082,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // gotAddrs := g.ConnectedAddrs() @@ -2876,28 +3120,29 @@ package grpc // ctx context.Context // } // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // err error @@ -2934,6 +3179,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -2977,6 +3223,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -3021,28 +3268,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // err := g.Close(test.args.ctx) @@ -3058,28 +3306,29 @@ package grpc // fn func(addr string, p pool.Conn) bool // } // type fields struct { -// addrs map[string]struct{} -// poolSize uint64 -// clientCount uint64 -// conns sync.Map[string, pool.Conn] -// hcDur time.Duration -// prDur time.Duration -// dialer net.Dialer -// enablePoolRebalance bool -// resolveDNS bool -// dopts []DialOption -// copts []CallOption -// roccd string -// eg errgroup.Group -// bo backoff.Backoff -// cb circuitbreaker.CircuitBreaker -// gbo gbackoff.Config -// mcd time.Duration -// group singleflight.Group[pool.Conn] -// crl sync.Map[string, bool] -// ech <-chan error -// monitorRunning atomic.Bool -// stopMonitor context.CancelFunc +// addrs map[string]struct{} +// poolSize uint64 +// clientCount uint64 +// conns sync.Map[string, pool.Conn] +// hcDur time.Duration +// prDur time.Duration +// dialer net.Dialer +// enablePoolRebalance bool +// disableResolveDNSAddrs sync.Map[string, bool] +// resolveDNS bool +// dopts []DialOption +// copts []CallOption +// roccd string +// eg errgroup.Group +// bo backoff.Backoff +// cb circuitbreaker.CircuitBreaker +// gbo gbackoff.Config +// mcd time.Duration +// group singleflight.Group[pool.Conn] +// crl sync.Map[string, bool] +// ech <-chan error +// monitorRunning atomic.Bool +// stopMonitor context.CancelFunc // } // type want struct { // err error @@ -3116,6 +3365,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -3159,6 +3409,7 @@ package grpc // prDur:nil, // dialer:nil, // enablePoolRebalance:false, +// disableResolveDNSAddrs:nil, // resolveDNS:false, // dopts:nil, // copts:nil, @@ -3203,28 +3454,29 @@ package grpc // checkFunc = defaultCheckFunc // } // g := &gRPCClient{ -// addrs: test.fields.addrs, -// poolSize: test.fields.poolSize, -// clientCount: test.fields.clientCount, -// conns: test.fields.conns, -// hcDur: test.fields.hcDur, -// prDur: test.fields.prDur, -// dialer: test.fields.dialer, -// enablePoolRebalance: test.fields.enablePoolRebalance, -// resolveDNS: test.fields.resolveDNS, -// dopts: test.fields.dopts, -// copts: test.fields.copts, -// roccd: test.fields.roccd, -// eg: test.fields.eg, -// bo: test.fields.bo, -// cb: test.fields.cb, -// gbo: test.fields.gbo, -// mcd: test.fields.mcd, -// group: test.fields.group, -// crl: test.fields.crl, -// ech: test.fields.ech, -// monitorRunning: test.fields.monitorRunning, -// stopMonitor: test.fields.stopMonitor, +// addrs: test.fields.addrs, +// poolSize: test.fields.poolSize, +// clientCount: test.fields.clientCount, +// conns: test.fields.conns, +// hcDur: test.fields.hcDur, +// prDur: test.fields.prDur, +// dialer: test.fields.dialer, +// enablePoolRebalance: test.fields.enablePoolRebalance, +// disableResolveDNSAddrs: test.fields.disableResolveDNSAddrs, +// resolveDNS: test.fields.resolveDNS, +// dopts: test.fields.dopts, +// copts: test.fields.copts, +// roccd: test.fields.roccd, +// eg: test.fields.eg, +// bo: test.fields.bo, +// cb: test.fields.cb, +// gbo: test.fields.gbo, +// mcd: test.fields.mcd, +// group: test.fields.group, +// crl: test.fields.crl, +// ech: test.fields.ech, +// monitorRunning: test.fields.monitorRunning, +// stopMonitor: test.fields.stopMonitor, // } // // err := g.rangeConns(test.args.fn) diff --git a/internal/net/grpc/codes/codes_test.go b/internal/net/grpc/codes/codes_test.go new file mode 100644 index 0000000000..a478c49127 --- /dev/null +++ b/internal/net/grpc/codes/codes_test.go @@ -0,0 +1,101 @@ +// Copyright (C) 2019-2024 vdaas.org vald team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package codes + +// NOT IMPLEMENTED BELOW +// +// func TestToString(t *testing.T) { +// type args struct { +// c T +// } +// type want struct { +// want string +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, string) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got string) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// c:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// c:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := ToString(test.args.c) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } diff --git a/internal/net/grpc/errdetails/errdetails_test.go b/internal/net/grpc/errdetails/errdetails_test.go index 0a80077106..6b6c8d1681 100644 --- a/internal/net/grpc/errdetails/errdetails_test.go +++ b/internal/net/grpc/errdetails/errdetails_test.go @@ -111,3 +111,99 @@ func TestDebugInfoFromInfoDetail(t *testing.T) { } // NOT IMPLEMENTED BELOW +// +// func TestDetail_MarshalJSON(t *testing.T) { +// type fields struct { +// TypeURL string +// Message proto.Message +// } +// type want struct { +// wantBody []byte +// err error +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, []byte, error) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, gotBody []byte, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// if !reflect.DeepEqual(gotBody, w.wantBody) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotBody, w.wantBody) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// TypeURL:"", +// Message:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// TypeURL:"", +// Message:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// d := &Detail{ +// TypeURL: test.fields.TypeURL, +// Message: test.fields.Message, +// } +// +// gotBody, err := d.MarshalJSON() +// if err := checkFunc(test.want, gotBody, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } diff --git a/internal/net/grpc/interceptor/server/logging/accesslog_test.go b/internal/net/grpc/interceptor/server/logging/accesslog_test.go index 328f92880a..6670fc8e2a 100644 --- a/internal/net/grpc/interceptor/server/logging/accesslog_test.go +++ b/internal/net/grpc/interceptor/server/logging/accesslog_test.go @@ -29,6 +29,114 @@ func TestMain(m *testing.M) { // NOT IMPLEMENTED BELOW // +// func TestAccessLogEntity_String(t *testing.T) { +// type fields struct { +// GRPC *AccessLogGRPCEntity +// StartTime int64 +// EndTime int64 +// Latency int64 +// TraceID string +// Error error +// } +// type want struct { +// wantStr string +// } +// type test struct { +// name string +// fields fields +// want want +// checkFunc func(want, string) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, gotStr string) error { +// if !reflect.DeepEqual(gotStr, w.wantStr) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotStr, w.wantStr) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// fields: fields { +// GRPC:AccessLogGRPCEntity{}, +// StartTime:0, +// EndTime:0, +// Latency:0, +// TraceID:"", +// Error:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// fields: fields { +// GRPC:AccessLogGRPCEntity{}, +// StartTime:0, +// EndTime:0, +// Latency:0, +// TraceID:"", +// Error:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// e := AccessLogEntity{ +// GRPC: test.fields.GRPC, +// StartTime: test.fields.StartTime, +// EndTime: test.fields.EndTime, +// Latency: test.fields.Latency, +// TraceID: test.fields.TraceID, +// Error: test.fields.Error, +// } +// +// gotStr := e.String() +// if err := checkFunc(test.want, gotStr); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// // func TestAccessLogInterceptor(t *testing.T) { // type want struct { // want grpc.UnaryServerInterceptor diff --git a/internal/net/grpc/status/status.go b/internal/net/grpc/status/status.go index 5d61fb41cf..d578a78c64 100644 --- a/internal/net/grpc/status/status.go +++ b/internal/net/grpc/status/status.go @@ -20,8 +20,8 @@ package status import ( "cmp" "context" - "os" "slices" + "strconv" "github.com/vdaas/vald/internal/errors" "github.com/vdaas/vald/internal/info" @@ -30,6 +30,7 @@ import ( "github.com/vdaas/vald/internal/net/grpc/errdetails" "github.com/vdaas/vald/internal/net/grpc/proto" "github.com/vdaas/vald/internal/net/grpc/types" + "github.com/vdaas/vald/internal/os" "github.com/vdaas/vald/internal/strings" spb "google.golang.org/genproto/googleapis/rpc/status" "google.golang.org/grpc/status" @@ -239,6 +240,16 @@ func FromError(err error) (st *Status, ok bool) { } } +var hostname = func() (h string) { + var err error + h, err = os.Hostname() + if err != nil { + log.Warnf("failed to fetch hostname: %s,\terror: %v", h, err) + h = "unknown-host" + } + return h +}() + func withDetails(st *Status, err error, details ...any) *Status { if st != nil { details = append(st.Details(), details...) @@ -248,14 +259,7 @@ func withDetails(st *Status, err error, details ...any) *Status { typeName := errdetails.ErrorInfoMessageName dmap[typeName] = []proto.Message{&errdetails.ErrorInfo{ Reason: err.Error(), - Domain: func() (hostname string) { - var err error - hostname, err = os.Hostname() - if err != nil { - log.Warn("failed to fetch hostname:", err) - } - return hostname - }(), + Domain: hostname, }} } for _, detail := range details { @@ -423,6 +427,7 @@ func withDetails(st *Status, err error, details ...any) *Status { } } } + msgs := make([]proto.MessageV1, 0, len(dmap)) visited := make(map[string]bool, len(dmap)) for typeName, ds := range dmap { @@ -431,15 +436,18 @@ func withDetails(st *Status, err error, details ...any) *Status { m := new(errdetails.DebugInfo) for _, msg := range ds { d, ok := msg.(*errdetails.DebugInfo) - if ok && d != nil && !visited[d.String()] { - visited[d.String()] = true - if m.GetDetail() == "" { - m.Detail = d.GetDetail() - } else if m.GetDetail() != d.GetDetail() && !strings.Contains(m.GetDetail(), d.GetDetail()) { - m.Detail += "\t" + d.GetDetail() - } - if len(m.GetStackEntries()) < len(d.GetStackEntries()) { - m.StackEntries = d.GetStackEntries() + if ok && d != nil { + key := errdetails.DebugInfoMessageName + d.GetDetail() + strings.Join(d.GetStackEntries(), ",") + if !visited[key] { + visited[key] = true + if m.GetDetail() == "" { + m.Detail = d.GetDetail() + } else if m.GetDetail() != d.GetDetail() && !strings.Contains(m.GetDetail(), d.GetDetail()) { + m.Detail += "\t" + d.GetDetail() + } + if len(m.GetStackEntries()) < len(d.GetStackEntries()) { + m.StackEntries = d.GetStackEntries() + } } } } @@ -449,24 +457,27 @@ func withDetails(st *Status, err error, details ...any) *Status { m := new(errdetails.ErrorInfo) for _, msg := range ds { e, ok := msg.(*errdetails.ErrorInfo) - if ok && e != nil && !visited[e.String()] && !visited[e.GetReason()] { - visited[e.String()] = true + if ok && e != nil && !visited[e.GetReason()] { visited[e.GetReason()] = true - if m.GetDomain() == "" { - m.Domain = e.GetDomain() - } else if m.GetDomain() != e.GetDomain() && !strings.Contains(m.GetDomain(), e.GetDomain()) { - m.Domain += "\t" + e.GetDomain() - } - if m.GetReason() == "" { - m.Reason += e.GetReason() - } else if m.GetReason() != e.GetReason() && !strings.Contains(m.GetReason(), e.GetReason()) { - m.Reason += "\t" + e.GetReason() - } - if e.GetMetadata() != nil { - if m.GetMetadata() == nil { - m.Metadata = e.GetMetadata() - } else { - m.Metadata = appendM(m.GetMetadata(), e.GetMetadata()) + key := errdetails.ErrorInfoMessageName + e.GetDomain() + e.GetReason() + if !visited[key] { + visited[key] = true + if m.GetDomain() == "" { + m.Domain = e.GetDomain() + } else if m.GetDomain() != e.GetDomain() && !strings.Contains(m.GetDomain(), e.GetDomain()) { + m.Domain += "\t" + e.GetDomain() + } + if m.GetReason() == "" { + m.Reason += e.GetReason() + } else if m.GetReason() != e.GetReason() && !strings.Contains(m.GetReason(), e.GetReason()) { + m.Reason += "\t" + e.GetReason() + } + if e.GetMetadata() != nil { + if m.GetMetadata() == nil { + m.Metadata = e.GetMetadata() + } else { + m.Metadata = appendM(m.GetMetadata(), e.GetMetadata()) + } } } } @@ -498,17 +509,20 @@ func withDetails(st *Status, err error, details ...any) *Status { m := new(errdetails.BadRequestFieldViolation) for _, msg := range ds { b, ok := msg.(*errdetails.BadRequestFieldViolation) - if ok && b != nil && !visited[b.String()] { - visited[b.String()] = true - if m.GetField() == "" { - m.Field = b.GetField() - } else if m.GetField() != b.GetField() && !strings.Contains(m.GetField(), b.GetField()) { - m.Field += "\t" + b.GetField() - } - if m.GetDescription() == "" { - m.Description = b.GetDescription() - } else if m.GetDescription() != b.GetDescription() && !strings.Contains(m.GetDescription(), b.GetDescription()) { - m.Description += "\t" + b.GetDescription() + if ok && b != nil { + key := errdetails.BadRequestFieldViolationMessageName + b.GetField() + b.GetDescription() + if !visited[key] { + visited[key] = true + if m.GetField() == "" { + m.Field = b.GetField() + } else if m.GetField() != b.GetField() && !strings.Contains(m.GetField(), b.GetField()) { + m.Field += "\t" + b.GetField() + } + if m.GetDescription() == "" { + m.Description = b.GetDescription() + } else if m.GetDescription() != b.GetDescription() && !strings.Contains(m.GetDescription(), b.GetDescription()) { + m.Description += "\t" + b.GetDescription() + } } } } @@ -517,17 +531,20 @@ func withDetails(st *Status, err error, details ...any) *Status { m := new(errdetails.LocalizedMessage) for _, msg := range ds { l, ok := msg.(*errdetails.LocalizedMessage) - if ok && l != nil && !visited[l.String()] { - visited[l.String()] = true - if m.GetLocale() == "" { - m.Locale = l.GetLocale() - } else if m.GetLocale() != l.GetLocale() && !strings.Contains(m.GetLocale(), l.GetLocale()) { - m.Locale += "\t" + l.GetLocale() - } - if m.GetMessage() == "" { - m.Message = l.GetMessage() - } else if m.GetMessage() != l.GetMessage() && !strings.Contains(m.GetMessage(), l.GetMessage()) { - m.Message += "\t" + l.GetMessage() + if ok && l != nil { + key := errdetails.LocalizedMessageMessageName + l.GetLocale() + l.GetMessage() + if !visited[key] { + visited[key] = true + if m.GetLocale() == "" { + m.Locale = l.GetLocale() + } else if m.GetLocale() != l.GetLocale() && !strings.Contains(m.GetLocale(), l.GetLocale()) { + m.Locale += "\t" + l.GetLocale() + } + if m.GetMessage() == "" { + m.Message = l.GetMessage() + } else if m.GetMessage() != l.GetMessage() && !strings.Contains(m.GetMessage(), l.GetMessage()) { + m.Message += "\t" + l.GetMessage() + } } } } @@ -556,22 +573,25 @@ func withDetails(st *Status, err error, details ...any) *Status { m := new(errdetails.PreconditionFailureViolation) for _, msg := range ds { p, ok := msg.(*errdetails.PreconditionFailureViolation) - if ok && p != nil && !visited[p.String()] { - visited[p.String()] = true - if m.GetType() == "" { - m.Type = p.GetType() - } else if m.GetType() != p.GetType() && !strings.Contains(m.GetType(), p.GetType()) { - m.Type += "\t" + p.GetType() - } - if m.GetSubject() == "" { - m.Subject = p.GetSubject() - } else if m.GetSubject() != p.GetSubject() && !strings.Contains(m.GetSubject(), p.GetSubject()) { - m.Subject += "\t" + p.GetSubject() - } - if m.GetDescription() == "" { - m.Description = p.GetDescription() - } else if m.GetDescription() != p.GetDescription() && !strings.Contains(m.GetDescription(), p.GetDescription()) { - m.Description += "\t" + p.GetDescription() + if ok && p != nil { + key := errdetails.PreconditionFailureViolationMessageName + p.GetType() + p.GetSubject() + p.GetDescription() + if !visited[key] { + visited[key] = true + if m.GetType() == "" { + m.Type = p.GetType() + } else if m.GetType() != p.GetType() && !strings.Contains(m.GetType(), p.GetType()) { + m.Type += "\t" + p.GetType() + } + if m.GetSubject() == "" { + m.Subject = p.GetSubject() + } else if m.GetSubject() != p.GetSubject() && !strings.Contains(m.GetSubject(), p.GetSubject()) { + m.Subject += "\t" + p.GetSubject() + } + if m.GetDescription() == "" { + m.Description = p.GetDescription() + } else if m.GetDescription() != p.GetDescription() && !strings.Contains(m.GetDescription(), p.GetDescription()) { + m.Description += "\t" + p.GetDescription() + } } } } @@ -600,17 +620,20 @@ func withDetails(st *Status, err error, details ...any) *Status { m := new(errdetails.HelpLink) for _, msg := range ds { h, ok := msg.(*errdetails.HelpLink) - if ok && h != nil && !visited[h.String()] { - visited[h.String()] = true - if m.GetUrl() == "" { - m.Url = h.GetUrl() - } else if m.GetUrl() != h.GetUrl() && !strings.Contains(m.GetUrl(), h.GetUrl()) { - m.Url += "\t" + h.GetUrl() - } - if m.GetDescription() == "" { - m.Description = h.GetDescription() - } else if m.GetDescription() != h.GetDescription() && !strings.Contains(m.GetDescription(), h.GetDescription()) { - m.Description += "\t" + h.GetDescription() + if ok && h != nil { + key := errdetails.HelpLinkMessageName + h.GetUrl() + h.GetDescription() + if !visited[key] { + visited[key] = true + if m.GetUrl() == "" { + m.Url = h.GetUrl() + } else if m.GetUrl() != h.GetUrl() && !strings.Contains(m.GetUrl(), h.GetUrl()) { + m.Url += "\t" + h.GetUrl() + } + if m.GetDescription() == "" { + m.Description = h.GetDescription() + } else if m.GetDescription() != h.GetDescription() && !strings.Contains(m.GetDescription(), h.GetDescription()) { + m.Description += "\t" + h.GetDescription() + } } } } @@ -639,17 +662,20 @@ func withDetails(st *Status, err error, details ...any) *Status { m := new(errdetails.QuotaFailureViolation) for _, msg := range ds { q, ok := msg.(*errdetails.QuotaFailureViolation) - if ok && q != nil && !visited[q.String()] { - visited[q.String()] = true - if m.GetSubject() == "" { - m.Subject = q.GetSubject() - } else if m.GetSubject() != q.GetSubject() && !strings.Contains(m.GetSubject(), q.GetSubject()) { - m.Subject += "\t" + q.GetSubject() - } - if m.GetDescription() == "" { - m.Description = q.GetDescription() - } else if m.GetDescription() != q.GetDescription() && !strings.Contains(m.GetDescription(), q.GetDescription()) { - m.Description += "\t" + q.GetDescription() + if ok && q != nil { + key := errdetails.QuotaFailureViolationMessageName + q.GetSubject() + q.GetDescription() + if !visited[key] { + visited[key] = true + if m.GetSubject() == "" { + m.Subject = q.GetSubject() + } else if m.GetSubject() != q.GetSubject() && !strings.Contains(m.GetSubject(), q.GetSubject()) { + m.Subject += "\t" + q.GetSubject() + } + if m.GetDescription() == "" { + m.Description = q.GetDescription() + } else if m.GetDescription() != q.GetDescription() && !strings.Contains(m.GetDescription(), q.GetDescription()) { + m.Description += "\t" + q.GetDescription() + } } } } @@ -658,17 +684,20 @@ func withDetails(st *Status, err error, details ...any) *Status { m := new(errdetails.RequestInfo) for _, msg := range ds { r, ok := msg.(*errdetails.RequestInfo) - if ok && r != nil && !visited[r.String()] { - visited[r.String()] = true - if m.GetRequestId() == "" { - m.RequestId = r.GetRequestId() - } else if m.GetRequestId() != r.GetRequestId() && !strings.Contains(m.GetRequestId(), r.GetRequestId()) { - m.RequestId += "\t" + r.GetRequestId() - } - if m.GetServingData() == "" { - m.ServingData = r.GetServingData() - } else if m.GetServingData() != r.GetServingData() && !strings.Contains(m.GetServingData(), r.GetServingData()) { - m.ServingData += "\t" + r.GetServingData() + if ok && r != nil { + key := errdetails.RequestInfoMessageName + r.GetRequestId() + r.GetServingData() + if !visited[key] { + visited[key] = true + if m.GetRequestId() == "" { + m.RequestId = r.GetRequestId() + } else if m.GetRequestId() != r.GetRequestId() && !strings.Contains(m.GetRequestId(), r.GetRequestId()) { + m.RequestId += "\t" + r.GetRequestId() + } + if m.GetServingData() == "" { + m.ServingData = r.GetServingData() + } else if m.GetServingData() != r.GetServingData() && !strings.Contains(m.GetServingData(), r.GetServingData()) { + m.ServingData += "\t" + r.GetServingData() + } } } } @@ -677,22 +706,25 @@ func withDetails(st *Status, err error, details ...any) *Status { m := new(errdetails.ResourceInfo) for _, msg := range ds { r, ok := msg.(*errdetails.ResourceInfo) - if ok && r != nil && !visited[r.String()] { - visited[r.String()] = true - if m.GetResourceType() == "" { - m.ResourceType = r.GetResourceType() - } else if m.GetResourceType() != r.GetResourceType() && len(m.GetResourceType()) < len(r.GetResourceType()) { - m.ResourceType += r.GetResourceType() - } - if m.GetResourceName() == "" { - m.ResourceName = r.GetResourceName() - } else if m.GetResourceName() != r.GetResourceName() && !strings.Contains(m.GetResourceName(), r.GetResourceName()) { - m.ResourceName += "\t" + r.GetResourceName() - } - if m.GetDescription() == "" { - m.Description = r.GetDescription() - } else if m.GetDescription() != r.GetDescription() && !strings.Contains(m.GetDescription(), r.GetDescription()) { - m.Description += "\t" + r.GetDescription() + if ok && r != nil { + key := errdetails.ResourceInfoMessageName + r.GetResourceType() + r.GetResourceName() + r.GetDescription() + if !visited[key] { + visited[key] = true + if m.GetResourceType() == "" { + m.ResourceType = r.GetResourceType() + } else if m.GetResourceType() != r.GetResourceType() && len(m.GetResourceType()) < len(r.GetResourceType()) { + m.ResourceType += r.GetResourceType() + } + if m.GetResourceName() == "" { + m.ResourceName = r.GetResourceName() + } else if m.GetResourceName() != r.GetResourceName() && !strings.Contains(m.GetResourceName(), r.GetResourceName()) { + m.ResourceName += "\t" + r.GetResourceName() + } + if m.GetDescription() == "" { + m.Description = r.GetDescription() + } else if m.GetDescription() != r.GetDescription() && !strings.Contains(m.GetDescription(), r.GetDescription()) { + m.Description += "\t" + r.GetDescription() + } } } } @@ -701,10 +733,13 @@ func withDetails(st *Status, err error, details ...any) *Status { m := new(errdetails.RetryInfo) for _, msg := range ds { r, ok := msg.(*errdetails.RetryInfo) - if ok && r != nil && !visited[r.String()] { - visited[r.String()] = true - if m.GetRetryDelay() == nil || r.GetRetryDelay().Seconds < m.GetRetryDelay().Seconds { - m.RetryDelay = r.GetRetryDelay() + if ok && r != nil { + key := errdetails.RetryInfoMessageName + strconv.FormatInt(r.GetRetryDelay().GetSeconds(), 10) + strconv.FormatInt(int64(r.GetRetryDelay().GetNanos()), 10) + if !visited[key] { + visited[key] = true + if m.GetRetryDelay() == nil || r.GetRetryDelay().GetSeconds() < m.GetRetryDelay().GetSeconds() { + m.RetryDelay = r.GetRetryDelay() + } } } } diff --git a/internal/net/grpc/status/status_test.go b/internal/net/grpc/status/status_test.go index 5d9f6d818f..5e076bab25 100644 --- a/internal/net/grpc/status/status_test.go +++ b/internal/net/grpc/status/status_test.go @@ -2242,6 +2242,261 @@ func TestParseError(t *testing.T) { // } // } // +// func Test_typeURL(t *testing.T) { +// type args struct { +// msg proto.Message +// } +// type want struct { +// want string +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, string) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got string) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// msg:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// msg:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := typeURL(test.args.msg) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func Test_appendM(t *testing.T) { +// type args struct { +// maps []map[K]string +// } +// type want struct { +// wantResult map[K]string +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, map[K]string) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, gotResult map[K]string) error { +// if !reflect.DeepEqual(gotResult, w.wantResult) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotResult, w.wantResult) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// maps:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// maps:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// gotResult := appendM(test.args.maps...) +// if err := checkFunc(test.want, gotResult); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func Test_removeDuplicatesFromTSVLine(t *testing.T) { +// type args struct { +// line string +// } +// type want struct { +// want string +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, string) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, got string) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// line:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// line:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// got := removeDuplicatesFromTSVLine(test.args.line) +// if err := checkFunc(test.want, got); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// // func TestLog(t *testing.T) { // type args struct { // code codes.Code diff --git a/internal/net/http/json/json.go b/internal/net/http/json/json.go index f93608be5e..33f9b86f72 100644 --- a/internal/net/http/json/json.go +++ b/internal/net/http/json/json.go @@ -20,7 +20,6 @@ import ( "bytes" "context" "net/http" - "os" "github.com/vdaas/vald/internal/encoding/json" "github.com/vdaas/vald/internal/errors" @@ -28,6 +27,7 @@ import ( "github.com/vdaas/vald/internal/log" "github.com/vdaas/vald/internal/net/http/dump" "github.com/vdaas/vald/internal/net/http/rest" + "github.com/vdaas/vald/internal/os" ) // RFC7807Error represents RFC 7807 error. diff --git a/internal/os/hostname.go b/internal/os/hostname.go new file mode 100644 index 0000000000..0bc060ba98 --- /dev/null +++ b/internal/os/hostname.go @@ -0,0 +1,55 @@ +// +// Copyright (C) 2019-2024 vdaas.org vald team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Package os provides os functions +package os + +import ( + "net" + "os" + + "github.com/vdaas/vald/internal/strings" +) + +const unknownHost = "unknown-host" + +var hostname = func() string { + h, err := os.Hostname() + if err != nil { + addrs, err := net.InterfaceAddrs() + if err != nil { + return unknownHost + } + ips := make([]string, 0, len(addrs)) + for _, addr := range addrs { + if ipn, ok := addr.(*net.IPNet); ok && !ipn.IP.IsLoopback() { + ips = append(ips, ipn.IP.String()) + } + } + if len(ips) == 0 { + return unknownHost + } + return strings.Join(ips, ",\t") + } + return h +}() + +func Hostname() (hn string, err error) { + if hostname != "" { + return hostname, nil + } + return os.Hostname() +} diff --git a/internal/os/hostname_test.go b/internal/os/hostname_test.go new file mode 100644 index 0000000000..fc6f6bfad6 --- /dev/null +++ b/internal/os/hostname_test.go @@ -0,0 +1,95 @@ +// Copyright (C) 2019-2024 vdaas.org vald team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package os + +// NOT IMPLEMENTED BELOW +// +// func TestHostname(t *testing.T) { +// type want struct { +// wantHn string +// err error +// } +// type test struct { +// name string +// want want +// checkFunc func(want, string, error) error +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) +// } +// defaultCheckFunc := func(w want, gotHn string, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// if !reflect.DeepEqual(gotHn, w.wantHn) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotHn, w.wantHn) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T,) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T,) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// gotHn, err := Hostname() +// if err := checkFunc(test.want, gotHn, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } diff --git a/pkg/agent/core/faiss/handler/grpc/option.go b/pkg/agent/core/faiss/handler/grpc/option.go index 439889b7bf..3a7ba5a338 100644 --- a/pkg/agent/core/faiss/handler/grpc/option.go +++ b/pkg/agent/core/faiss/handler/grpc/option.go @@ -18,12 +18,12 @@ package grpc import ( - "os" "runtime" "github.com/vdaas/vald/internal/errors" "github.com/vdaas/vald/internal/log" "github.com/vdaas/vald/internal/net" + "github.com/vdaas/vald/internal/os" "github.com/vdaas/vald/internal/sync/errgroup" "github.com/vdaas/vald/pkg/agent/core/faiss/service" ) diff --git a/pkg/agent/core/ngt/handler/grpc/option.go b/pkg/agent/core/ngt/handler/grpc/option.go index d7af083e0c..2b1d32c45b 100644 --- a/pkg/agent/core/ngt/handler/grpc/option.go +++ b/pkg/agent/core/ngt/handler/grpc/option.go @@ -18,12 +18,12 @@ package grpc import ( - "os" "runtime" "github.com/vdaas/vald/internal/errors" "github.com/vdaas/vald/internal/log" "github.com/vdaas/vald/internal/net" + "github.com/vdaas/vald/internal/os" "github.com/vdaas/vald/internal/sync/errgroup" "github.com/vdaas/vald/pkg/agent/core/ngt/service" ) diff --git a/pkg/agent/core/ngt/service/ngt_test.go b/pkg/agent/core/ngt/service/ngt_test.go index e85c19993f..443eeeed58 100644 --- a/pkg/agent/core/ngt/service/ngt_test.go +++ b/pkg/agent/core/ngt/service/ngt_test.go @@ -36,6 +36,7 @@ import ( core "github.com/vdaas/vald/internal/core/algorithm/ngt" "github.com/vdaas/vald/internal/errors" "github.com/vdaas/vald/internal/file" + "github.com/vdaas/vald/internal/k8s/vald" kvald "github.com/vdaas/vald/internal/k8s/vald" "github.com/vdaas/vald/internal/log" "github.com/vdaas/vald/internal/net/grpc" @@ -1784,10 +1785,423 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // +// func Test_ngt_copyNGT(t *testing.T) { +// type args struct { +// src *ngt +// } +// type fields struct { +// core core.NGT +// eg errgroup.Group +// kvs kvs.BidiMap +// fmap map[string]int64 +// vq vqueue.Queue +// indexing atomic.Value +// flushing atomic.Bool +// saving atomic.Value +// lastNocie uint64 +// nocie uint64 +// nogce uint64 +// wfci uint64 +// nobic uint64 +// nopvq atomic.Uint64 +// cfg *config.NGT +// opts []Option +// inMem bool +// dim int +// alen int +// lim time.Duration +// dur time.Duration +// sdur time.Duration +// minLit time.Duration +// maxLit time.Duration +// litFactor time.Duration +// enableProactiveGC bool +// enableCopyOnWrite bool +// podName string +// podNamespace string +// path string +// tmpPath atomic.Value +// oldPath string +// basePath string +// brokenPath string +// poolSize uint32 +// radius float32 +// epsilon float32 +// idelay time.Duration +// dcd bool +// kvsdbConcurrency int +// historyLimit int +// isReadReplica bool +// enableExportIndexInfo bool +// exportIndexInfoDuration time.Duration +// patcher client.Patcher +// enableStatistics bool +// statisticsCache atomic.Pointer[payload.Info_Index_Statistics] +// } +// type want struct{} +// type test struct { +// name string +// args args +// fields fields +// want want +// checkFunc func(want) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want) error { +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// src:ngt{}, +// }, +// fields: fields { +// core:nil, +// eg:nil, +// kvs:nil, +// fmap:nil, +// vq:nil, +// indexing:nil, +// flushing:nil, +// saving:nil, +// lastNocie:0, +// nocie:0, +// nogce:0, +// wfci:0, +// nobic:0, +// nopvq:nil, +// cfg:nil, +// opts:nil, +// inMem:false, +// dim:0, +// alen:0, +// lim:nil, +// dur:nil, +// sdur:nil, +// minLit:nil, +// maxLit:nil, +// litFactor:nil, +// enableProactiveGC:false, +// enableCopyOnWrite:false, +// podName:"", +// podNamespace:"", +// path:"", +// tmpPath:nil, +// oldPath:"", +// basePath:"", +// brokenPath:"", +// poolSize:0, +// radius:0, +// epsilon:0, +// idelay:nil, +// dcd:false, +// kvsdbConcurrency:0, +// historyLimit:0, +// isReadReplica:false, +// enableExportIndexInfo:false, +// exportIndexInfoDuration:nil, +// patcher:nil, +// enableStatistics:false, +// statisticsCache:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// src:ngt{}, +// }, +// fields: fields { +// core:nil, +// eg:nil, +// kvs:nil, +// fmap:nil, +// vq:nil, +// indexing:nil, +// flushing:nil, +// saving:nil, +// lastNocie:0, +// nocie:0, +// nogce:0, +// wfci:0, +// nobic:0, +// nopvq:nil, +// cfg:nil, +// opts:nil, +// inMem:false, +// dim:0, +// alen:0, +// lim:nil, +// dur:nil, +// sdur:nil, +// minLit:nil, +// maxLit:nil, +// litFactor:nil, +// enableProactiveGC:false, +// enableCopyOnWrite:false, +// podName:"", +// podNamespace:"", +// path:"", +// tmpPath:nil, +// oldPath:"", +// basePath:"", +// brokenPath:"", +// poolSize:0, +// radius:0, +// epsilon:0, +// idelay:nil, +// dcd:false, +// kvsdbConcurrency:0, +// historyLimit:0, +// isReadReplica:false, +// enableExportIndexInfo:false, +// exportIndexInfoDuration:nil, +// patcher:nil, +// enableStatistics:false, +// statisticsCache:nil, +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// n := &ngt{ +// core: test.fields.core, +// eg: test.fields.eg, +// kvs: test.fields.kvs, +// fmap: test.fields.fmap, +// vq: test.fields.vq, +// indexing: test.fields.indexing, +// flushing: test.fields.flushing, +// saving: test.fields.saving, +// lastNocie: test.fields.lastNocie, +// nocie: test.fields.nocie, +// nogce: test.fields.nogce, +// wfci: test.fields.wfci, +// nobic: test.fields.nobic, +// nopvq: test.fields.nopvq, +// cfg: test.fields.cfg, +// opts: test.fields.opts, +// inMem: test.fields.inMem, +// dim: test.fields.dim, +// alen: test.fields.alen, +// lim: test.fields.lim, +// dur: test.fields.dur, +// sdur: test.fields.sdur, +// minLit: test.fields.minLit, +// maxLit: test.fields.maxLit, +// litFactor: test.fields.litFactor, +// enableProactiveGC: test.fields.enableProactiveGC, +// enableCopyOnWrite: test.fields.enableCopyOnWrite, +// podName: test.fields.podName, +// podNamespace: test.fields.podNamespace, +// path: test.fields.path, +// tmpPath: test.fields.tmpPath, +// oldPath: test.fields.oldPath, +// basePath: test.fields.basePath, +// brokenPath: test.fields.brokenPath, +// poolSize: test.fields.poolSize, +// radius: test.fields.radius, +// epsilon: test.fields.epsilon, +// idelay: test.fields.idelay, +// dcd: test.fields.dcd, +// kvsdbConcurrency: test.fields.kvsdbConcurrency, +// historyLimit: test.fields.historyLimit, +// isReadReplica: test.fields.isReadReplica, +// enableExportIndexInfo: test.fields.enableExportIndexInfo, +// exportIndexInfoDuration: test.fields.exportIndexInfoDuration, +// patcher: test.fields.patcher, +// enableStatistics: test.fields.enableStatistics, +// statisticsCache: test.fields.statisticsCache, +// } +// +// n.copyNGT(test.args.src) +// if err := checkFunc(test.want); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// // func Test_migrate(t *testing.T) { // type args struct { -// ctx context.Context -// path string +// ctx context.Context +// path string +// } +// type want struct { +// err error +// } +// type test struct { +// name string +// args args +// want want +// checkFunc func(want, error) error +// beforeFunc func(*testing.T, args) +// afterFunc func(*testing.T, args) +// } +// defaultCheckFunc := func(w want, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// return nil +// } +// tests := []test{ +// // TODO test cases +// /* +// { +// name: "test_case_1", +// args: args { +// ctx:nil, +// path:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// }, +// */ +// +// // TODO test cases +// /* +// func() test { +// return test { +// name: "test_case_2", +// args: args { +// ctx:nil, +// path:"", +// }, +// want: want{}, +// checkFunc: defaultCheckFunc, +// beforeFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// afterFunc: func(t *testing.T, args args) { +// t.Helper() +// }, +// } +// }(), +// */ +// } +// +// for _, tc := range tests { +// test := tc +// t.Run(test.name, func(tt *testing.T) { +// tt.Parallel() +// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) +// if test.beforeFunc != nil { +// test.beforeFunc(tt, test.args) +// } +// if test.afterFunc != nil { +// defer test.afterFunc(tt, test.args) +// } +// checkFunc := test.checkFunc +// if test.checkFunc == nil { +// checkFunc = defaultCheckFunc +// } +// +// err := migrate(test.args.ctx, test.args.path) +// if err := checkFunc(test.want, err); err != nil { +// tt.Errorf("error = %v", err) +// } +// }) +// } +// } +// +// func Test_ngt_prepareFolders(t *testing.T) { +// type args struct { +// ctx context.Context +// } +// type fields struct { +// core core.NGT +// eg errgroup.Group +// kvs kvs.BidiMap +// fmap map[string]int64 +// vq vqueue.Queue +// indexing atomic.Value +// flushing atomic.Bool +// saving atomic.Value +// lastNocie uint64 +// nocie uint64 +// nogce uint64 +// wfci uint64 +// nobic uint64 +// nopvq atomic.Uint64 +// cfg *config.NGT +// opts []Option +// inMem bool +// dim int +// alen int +// lim time.Duration +// dur time.Duration +// sdur time.Duration +// minLit time.Duration +// maxLit time.Duration +// litFactor time.Duration +// enableProactiveGC bool +// enableCopyOnWrite bool +// podName string +// podNamespace string +// path string +// tmpPath atomic.Value +// oldPath string +// basePath string +// brokenPath string +// poolSize uint32 +// radius float32 +// epsilon float32 +// idelay time.Duration +// dcd bool +// kvsdbConcurrency int +// historyLimit int +// isReadReplica bool +// enableExportIndexInfo bool +// exportIndexInfoDuration time.Duration +// patcher client.Patcher +// enableStatistics bool +// statisticsCache atomic.Pointer[payload.Info_Index_Statistics] // } // type want struct { // err error @@ -1795,6 +2209,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // type test struct { // name string // args args +// fields fields // want want // checkFunc func(want, error) error // beforeFunc func(*testing.T, args) @@ -1813,7 +2228,55 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // ctx:nil, +// }, +// fields: fields { +// core:nil, +// eg:nil, +// kvs:nil, +// fmap:nil, +// vq:nil, +// indexing:nil, +// flushing:nil, +// saving:nil, +// lastNocie:0, +// nocie:0, +// nogce:0, +// wfci:0, +// nobic:0, +// nopvq:nil, +// cfg:nil, +// opts:nil, +// inMem:false, +// dim:0, +// alen:0, +// lim:nil, +// dur:nil, +// sdur:nil, +// minLit:nil, +// maxLit:nil, +// litFactor:nil, +// enableProactiveGC:false, +// enableCopyOnWrite:false, +// podName:"", +// podNamespace:"", // path:"", +// tmpPath:nil, +// oldPath:"", +// basePath:"", +// brokenPath:"", +// poolSize:0, +// radius:0, +// epsilon:0, +// idelay:nil, +// dcd:false, +// kvsdbConcurrency:0, +// historyLimit:0, +// isReadReplica:false, +// enableExportIndexInfo:false, +// exportIndexInfoDuration:nil, +// patcher:nil, +// enableStatistics:false, +// statisticsCache:nil, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -1833,7 +2296,55 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // ctx:nil, +// }, +// fields: fields { +// core:nil, +// eg:nil, +// kvs:nil, +// fmap:nil, +// vq:nil, +// indexing:nil, +// flushing:nil, +// saving:nil, +// lastNocie:0, +// nocie:0, +// nogce:0, +// wfci:0, +// nobic:0, +// nopvq:nil, +// cfg:nil, +// opts:nil, +// inMem:false, +// dim:0, +// alen:0, +// lim:nil, +// dur:nil, +// sdur:nil, +// minLit:nil, +// maxLit:nil, +// litFactor:nil, +// enableProactiveGC:false, +// enableCopyOnWrite:false, +// podName:"", +// podNamespace:"", // path:"", +// tmpPath:nil, +// oldPath:"", +// basePath:"", +// brokenPath:"", +// poolSize:0, +// radius:0, +// epsilon:0, +// idelay:nil, +// dcd:false, +// kvsdbConcurrency:0, +// historyLimit:0, +// isReadReplica:false, +// enableExportIndexInfo:false, +// exportIndexInfoDuration:nil, +// patcher:nil, +// enableStatistics:false, +// statisticsCache:nil, // }, // want: want{}, // checkFunc: defaultCheckFunc, @@ -1863,8 +2374,57 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // if test.checkFunc == nil { // checkFunc = defaultCheckFunc // } +// n := &ngt{ +// core: test.fields.core, +// eg: test.fields.eg, +// kvs: test.fields.kvs, +// fmap: test.fields.fmap, +// vq: test.fields.vq, +// indexing: test.fields.indexing, +// flushing: test.fields.flushing, +// saving: test.fields.saving, +// lastNocie: test.fields.lastNocie, +// nocie: test.fields.nocie, +// nogce: test.fields.nogce, +// wfci: test.fields.wfci, +// nobic: test.fields.nobic, +// nopvq: test.fields.nopvq, +// cfg: test.fields.cfg, +// opts: test.fields.opts, +// inMem: test.fields.inMem, +// dim: test.fields.dim, +// alen: test.fields.alen, +// lim: test.fields.lim, +// dur: test.fields.dur, +// sdur: test.fields.sdur, +// minLit: test.fields.minLit, +// maxLit: test.fields.maxLit, +// litFactor: test.fields.litFactor, +// enableProactiveGC: test.fields.enableProactiveGC, +// enableCopyOnWrite: test.fields.enableCopyOnWrite, +// podName: test.fields.podName, +// podNamespace: test.fields.podNamespace, +// path: test.fields.path, +// tmpPath: test.fields.tmpPath, +// oldPath: test.fields.oldPath, +// basePath: test.fields.basePath, +// brokenPath: test.fields.brokenPath, +// poolSize: test.fields.poolSize, +// radius: test.fields.radius, +// epsilon: test.fields.epsilon, +// idelay: test.fields.idelay, +// dcd: test.fields.dcd, +// kvsdbConcurrency: test.fields.kvsdbConcurrency, +// historyLimit: test.fields.historyLimit, +// isReadReplica: test.fields.isReadReplica, +// enableExportIndexInfo: test.fields.enableExportIndexInfo, +// exportIndexInfoDuration: test.fields.exportIndexInfoDuration, +// patcher: test.fields.patcher, +// enableStatistics: test.fields.enableStatistics, +// statisticsCache: test.fields.statisticsCache, +// } // -// err := migrate(test.args.ctx, test.args.path) +// err := n.prepareFolders(test.args.ctx) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -1872,9 +2432,11 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_prepareFolders(t *testing.T) { +// func Test_ngt_load(t *testing.T) { // type args struct { -// ctx context.Context +// ctx context.Context +// path string +// opts []core.Option // } // type fields struct { // core core.NGT @@ -1950,6 +2512,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // ctx:nil, +// path:"", +// opts:nil, // }, // fields: fields { // core:nil, @@ -2018,6 +2582,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // ctx:nil, +// path:"", +// opts:nil, // }, // fields: fields { // core:nil, @@ -2146,7 +2712,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.prepareFolders(test.args.ctx) +// err := n.load(test.args.ctx, test.args.path, test.args.opts...) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -2154,11 +2720,9 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_load(t *testing.T) { +// func Test_ngt_backupBroken(t *testing.T) { // type args struct { -// ctx context.Context -// path string -// opts []core.Option +// ctx context.Context // } // type fields struct { // core core.NGT @@ -2234,8 +2798,6 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // ctx:nil, -// path:"", -// opts:nil, // }, // fields: fields { // core:nil, @@ -2304,8 +2866,6 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // ctx:nil, -// path:"", -// opts:nil, // }, // fields: fields { // core:nil, @@ -2434,7 +2994,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.load(test.args.ctx, test.args.path, test.args.opts...) +// err := n.backupBroken(test.args.ctx) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -2442,9 +3002,11 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_backupBroken(t *testing.T) { +// func Test_ngt_rebuild(t *testing.T) { // type args struct { -// ctx context.Context +// ctx context.Context +// path string +// opts []core.Option // } // type fields struct { // core core.NGT @@ -2520,6 +3082,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // ctx:nil, +// path:"", +// opts:nil, // }, // fields: fields { // core:nil, @@ -2588,6 +3152,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // ctx:nil, +// path:"", +// opts:nil, // }, // fields: fields { // core:nil, @@ -2716,7 +3282,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.backupBroken(test.args.ctx) +// err := n.rebuild(test.args.ctx, test.args.path, test.args.opts...) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -2724,10 +3290,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_rebuild(t *testing.T) { +// func Test_ngt_initNGT(t *testing.T) { // type args struct { -// ctx context.Context -// path string // opts []core.Option // } // type fields struct { @@ -2803,8 +3367,6 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // { // name: "test_case_1", // args: args { -// ctx:nil, -// path:"", // opts:nil, // }, // fields: fields { @@ -2873,8 +3435,6 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // return test { // name: "test_case_2", // args: args { -// ctx:nil, -// path:"", // opts:nil, // }, // fields: fields { @@ -3004,7 +3564,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.rebuild(test.args.ctx, test.args.path, test.args.opts...) +// err := n.initNGT(test.args.opts...) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -3012,9 +3572,11 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_initNGT(t *testing.T) { +// func Test_ngt_loadKVS(t *testing.T) { // type args struct { -// opts []core.Option +// ctx context.Context +// path string +// timeout time.Duration // } // type fields struct { // core core.NGT @@ -3089,7 +3651,9 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // { // name: "test_case_1", // args: args { -// opts:nil, +// ctx:nil, +// path:"", +// timeout:nil, // }, // fields: fields { // core:nil, @@ -3157,7 +3721,9 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // return test { // name: "test_case_2", // args: args { -// opts:nil, +// ctx:nil, +// path:"", +// timeout:nil, // }, // fields: fields { // core:nil, @@ -3286,7 +3852,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.initNGT(test.args.opts...) +// err := n.loadKVS(test.args.ctx, test.args.path, test.args.timeout) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -3294,11 +3860,9 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_loadKVS(t *testing.T) { +// func Test_ngt_Start(t *testing.T) { // type args struct { -// ctx context.Context -// path string -// timeout time.Duration +// ctx context.Context // } // type fields struct { // core core.NGT @@ -3350,20 +3914,20 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache atomic.Pointer[payload.Info_Index_Statistics] // } // type want struct { -// err error +// want <-chan error // } // type test struct { // name string // args args // fields fields // want want -// checkFunc func(want, error) error +// checkFunc func(want, <-chan error) error // beforeFunc func(*testing.T, args) // afterFunc func(*testing.T, args) // } -// defaultCheckFunc := func(w want, err error) error { -// if !errors.Is(err, w.err) { -// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// defaultCheckFunc := func(w want, got <-chan error) error { +// if !reflect.DeepEqual(got, w.want) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) // } // return nil // } @@ -3374,8 +3938,6 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // ctx:nil, -// path:"", -// timeout:nil, // }, // fields: fields { // core:nil, @@ -3444,8 +4006,6 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // ctx:nil, -// path:"", -// timeout:nil, // }, // fields: fields { // core:nil, @@ -3574,17 +4134,21 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.loadKVS(test.args.ctx, test.args.path, test.args.timeout) -// if err := checkFunc(test.want, err); err != nil { +// got := n.Start(test.args.ctx) +// if err := checkFunc(test.want, got); err != nil { // tt.Errorf("error = %v", err) // } // }) // } // } // -// func Test_ngt_Start(t *testing.T) { +// func Test_ngt_Search(t *testing.T) { // type args struct { -// ctx context.Context +// ctx context.Context +// vec []float32 +// size uint32 +// epsilon float32 +// radius float32 // } // type fields struct { // core core.NGT @@ -3636,20 +4200,24 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache atomic.Pointer[payload.Info_Index_Statistics] // } // type want struct { -// want <-chan error +// wantRes *payload.Search_Response +// err error // } // type test struct { // name string // args args // fields fields // want want -// checkFunc func(want, <-chan error) error +// checkFunc func(want, *payload.Search_Response, error) error // beforeFunc func(*testing.T, args) // afterFunc func(*testing.T, args) // } -// defaultCheckFunc := func(w want, got <-chan error) error { -// if !reflect.DeepEqual(got, w.want) { -// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want) +// defaultCheckFunc := func(w want, gotRes *payload.Search_Response, err error) error { +// if !errors.Is(err, w.err) { +// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) +// } +// if !reflect.DeepEqual(gotRes, w.wantRes) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotRes, w.wantRes) // } // return nil // } @@ -3660,6 +4228,10 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // ctx:nil, +// vec:nil, +// size:0, +// epsilon:0, +// radius:0, // }, // fields: fields { // core:nil, @@ -3728,6 +4300,10 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // ctx:nil, +// vec:nil, +// size:0, +// epsilon:0, +// radius:0, // }, // fields: fields { // core:nil, @@ -3856,18 +4432,18 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// got := n.Start(test.args.ctx) -// if err := checkFunc(test.want, got); err != nil { +// gotRes, err := n.Search(test.args.ctx, test.args.vec, test.args.size, test.args.epsilon, test.args.radius) +// if err := checkFunc(test.want, gotRes, err); err != nil { // tt.Errorf("error = %v", err) // } // }) // } // } // -// func Test_ngt_Search(t *testing.T) { +// func Test_ngt_SearchByID(t *testing.T) { // type args struct { // ctx context.Context -// vec []float32 +// uuid string // size uint32 // epsilon float32 // radius float32 @@ -3922,7 +4498,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache atomic.Pointer[payload.Info_Index_Statistics] // } // type want struct { -// wantRes *payload.Search_Response +// wantVec []float32 +// wantDst *payload.Search_Response // err error // } // type test struct { @@ -3930,16 +4507,19 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // args args // fields fields // want want -// checkFunc func(want, *payload.Search_Response, error) error +// checkFunc func(want, []float32, *payload.Search_Response, error) error // beforeFunc func(*testing.T, args) // afterFunc func(*testing.T, args) // } -// defaultCheckFunc := func(w want, gotRes *payload.Search_Response, err error) error { +// defaultCheckFunc := func(w want, gotVec []float32, gotDst *payload.Search_Response, err error) error { // if !errors.Is(err, w.err) { // return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) // } -// if !reflect.DeepEqual(gotRes, w.wantRes) { -// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotRes, w.wantRes) +// if !reflect.DeepEqual(gotVec, w.wantVec) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotVec, w.wantVec) +// } +// if !reflect.DeepEqual(gotDst, w.wantDst) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotDst, w.wantDst) // } // return nil // } @@ -3950,7 +4530,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // ctx:nil, -// vec:nil, +// uuid:"", // size:0, // epsilon:0, // radius:0, @@ -4022,7 +4602,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // ctx:nil, -// vec:nil, +// uuid:"", // size:0, // epsilon:0, // radius:0, @@ -4154,21 +4734,19 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// gotRes, err := n.Search(test.args.ctx, test.args.vec, test.args.size, test.args.epsilon, test.args.radius) -// if err := checkFunc(test.want, gotRes, err); err != nil { +// gotVec, gotDst, err := n.SearchByID(test.args.ctx, test.args.uuid, test.args.size, test.args.epsilon, test.args.radius) +// if err := checkFunc(test.want, gotVec, gotDst, err); err != nil { // tt.Errorf("error = %v", err) // } // }) // } // } // -// func Test_ngt_SearchByID(t *testing.T) { +// func Test_ngt_LinearSearch(t *testing.T) { // type args struct { -// ctx context.Context -// uuid string -// size uint32 -// epsilon float32 -// radius float32 +// ctx context.Context +// vec []float32 +// size uint32 // } // type fields struct { // core core.NGT @@ -4220,8 +4798,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache atomic.Pointer[payload.Info_Index_Statistics] // } // type want struct { -// wantVec []float32 -// wantDst *payload.Search_Response +// wantRes *payload.Search_Response // err error // } // type test struct { @@ -4229,19 +4806,16 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // args args // fields fields // want want -// checkFunc func(want, []float32, *payload.Search_Response, error) error +// checkFunc func(want, *payload.Search_Response, error) error // beforeFunc func(*testing.T, args) // afterFunc func(*testing.T, args) // } -// defaultCheckFunc := func(w want, gotVec []float32, gotDst *payload.Search_Response, err error) error { +// defaultCheckFunc := func(w want, gotRes *payload.Search_Response, err error) error { // if !errors.Is(err, w.err) { // return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) // } -// if !reflect.DeepEqual(gotVec, w.wantVec) { -// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotVec, w.wantVec) -// } -// if !reflect.DeepEqual(gotDst, w.wantDst) { -// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotDst, w.wantDst) +// if !reflect.DeepEqual(gotRes, w.wantRes) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotRes, w.wantRes) // } // return nil // } @@ -4252,10 +4826,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // ctx:nil, -// uuid:"", +// vec:nil, // size:0, -// epsilon:0, -// radius:0, // }, // fields: fields { // core:nil, @@ -4324,10 +4896,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // ctx:nil, -// uuid:"", +// vec:nil, // size:0, -// epsilon:0, -// radius:0, // }, // fields: fields { // core:nil, @@ -4456,18 +5026,18 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// gotVec, gotDst, err := n.SearchByID(test.args.ctx, test.args.uuid, test.args.size, test.args.epsilon, test.args.radius) -// if err := checkFunc(test.want, gotVec, gotDst, err); err != nil { +// gotRes, err := n.LinearSearch(test.args.ctx, test.args.vec, test.args.size) +// if err := checkFunc(test.want, gotRes, err); err != nil { // tt.Errorf("error = %v", err) // } // }) // } // } // -// func Test_ngt_LinearSearch(t *testing.T) { +// func Test_ngt_LinearSearchByID(t *testing.T) { // type args struct { // ctx context.Context -// vec []float32 +// uuid string // size uint32 // } // type fields struct { @@ -4520,7 +5090,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache atomic.Pointer[payload.Info_Index_Statistics] // } // type want struct { -// wantRes *payload.Search_Response +// wantVec []float32 +// wantDst *payload.Search_Response // err error // } // type test struct { @@ -4528,16 +5099,19 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // args args // fields fields // want want -// checkFunc func(want, *payload.Search_Response, error) error +// checkFunc func(want, []float32, *payload.Search_Response, error) error // beforeFunc func(*testing.T, args) // afterFunc func(*testing.T, args) // } -// defaultCheckFunc := func(w want, gotRes *payload.Search_Response, err error) error { +// defaultCheckFunc := func(w want, gotVec []float32, gotDst *payload.Search_Response, err error) error { // if !errors.Is(err, w.err) { // return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) // } -// if !reflect.DeepEqual(gotRes, w.wantRes) { -// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotRes, w.wantRes) +// if !reflect.DeepEqual(gotVec, w.wantVec) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotVec, w.wantVec) +// } +// if !reflect.DeepEqual(gotDst, w.wantDst) { +// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotDst, w.wantDst) // } // return nil // } @@ -4548,7 +5122,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // ctx:nil, -// vec:nil, +// uuid:"", // size:0, // }, // fields: fields { @@ -4618,7 +5192,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // ctx:nil, -// vec:nil, +// uuid:"", // size:0, // }, // fields: fields { @@ -4748,19 +5322,18 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// gotRes, err := n.LinearSearch(test.args.ctx, test.args.vec, test.args.size) -// if err := checkFunc(test.want, gotRes, err); err != nil { +// gotVec, gotDst, err := n.LinearSearchByID(test.args.ctx, test.args.uuid, test.args.size) +// if err := checkFunc(test.want, gotVec, gotDst, err); err != nil { // tt.Errorf("error = %v", err) // } // }) // } // } // -// func Test_ngt_LinearSearchByID(t *testing.T) { +// func Test_ngt_Insert(t *testing.T) { // type args struct { -// ctx context.Context // uuid string -// size uint32 +// vec []float32 // } // type fields struct { // core core.NGT @@ -4812,29 +5385,21 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache atomic.Pointer[payload.Info_Index_Statistics] // } // type want struct { -// wantVec []float32 -// wantDst *payload.Search_Response -// err error +// err error // } // type test struct { // name string // args args // fields fields // want want -// checkFunc func(want, []float32, *payload.Search_Response, error) error +// checkFunc func(want, error) error // beforeFunc func(*testing.T, args) // afterFunc func(*testing.T, args) // } -// defaultCheckFunc := func(w want, gotVec []float32, gotDst *payload.Search_Response, err error) error { +// defaultCheckFunc := func(w want, err error) error { // if !errors.Is(err, w.err) { // return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) // } -// if !reflect.DeepEqual(gotVec, w.wantVec) { -// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotVec, w.wantVec) -// } -// if !reflect.DeepEqual(gotDst, w.wantDst) { -// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotDst, w.wantDst) -// } // return nil // } // tests := []test{ @@ -4843,9 +5408,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // { // name: "test_case_1", // args: args { -// ctx:nil, // uuid:"", -// size:0, +// vec:nil, // }, // fields: fields { // core:nil, @@ -4913,9 +5477,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // return test { // name: "test_case_2", // args: args { -// ctx:nil, // uuid:"", -// size:0, +// vec:nil, // }, // fields: fields { // core:nil, @@ -5044,18 +5607,19 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// gotVec, gotDst, err := n.LinearSearchByID(test.args.ctx, test.args.uuid, test.args.size) -// if err := checkFunc(test.want, gotVec, gotDst, err); err != nil { +// err := n.Insert(test.args.uuid, test.args.vec) +// if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } // }) // } // } // -// func Test_ngt_Insert(t *testing.T) { +// func Test_ngt_InsertWithTime(t *testing.T) { // type args struct { // uuid string // vec []float32 +// t int64 // } // type fields struct { // core core.NGT @@ -5132,6 +5696,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // args: args { // uuid:"", // vec:nil, +// t:0, // }, // fields: fields { // core:nil, @@ -5201,6 +5766,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // args: args { // uuid:"", // vec:nil, +// t:0, // }, // fields: fields { // core:nil, @@ -5329,7 +5895,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.Insert(test.args.uuid, test.args.vec) +// err := n.InsertWithTime(test.args.uuid, test.args.vec, test.args.t) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -5337,11 +5903,12 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_InsertWithTime(t *testing.T) { +// func Test_ngt_insert(t *testing.T) { // type args struct { -// uuid string -// vec []float32 -// t int64 +// uuid string +// vec []float32 +// t int64 +// validation bool // } // type fields struct { // core core.NGT @@ -5419,6 +5986,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // uuid:"", // vec:nil, // t:0, +// validation:false, // }, // fields: fields { // core:nil, @@ -5489,6 +6057,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // uuid:"", // vec:nil, // t:0, +// validation:false, // }, // fields: fields { // core:nil, @@ -5617,7 +6186,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.InsertWithTime(test.args.uuid, test.args.vec, test.args.t) +// err := n.insert(test.args.uuid, test.args.vec, test.args.t, test.args.validation) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -5625,12 +6194,9 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_insert(t *testing.T) { +// func Test_ngt_InsertMultiple(t *testing.T) { // type args struct { -// uuid string -// vec []float32 -// t int64 -// validation bool +// vecs map[string][]float32 // } // type fields struct { // core core.NGT @@ -5705,10 +6271,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // { // name: "test_case_1", // args: args { -// uuid:"", -// vec:nil, -// t:0, -// validation:false, +// vecs:nil, // }, // fields: fields { // core:nil, @@ -5776,10 +6339,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // return test { // name: "test_case_2", // args: args { -// uuid:"", -// vec:nil, -// t:0, -// validation:false, +// vecs:nil, // }, // fields: fields { // core:nil, @@ -5908,7 +6468,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.insert(test.args.uuid, test.args.vec, test.args.t, test.args.validation) +// err := n.InsertMultiple(test.args.vecs) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -5916,9 +6476,10 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_InsertMultiple(t *testing.T) { +// func Test_ngt_InsertMultipleWithTime(t *testing.T) { // type args struct { // vecs map[string][]float32 +// t int64 // } // type fields struct { // core core.NGT @@ -5994,6 +6555,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // vecs:nil, +// t:0, // }, // fields: fields { // core:nil, @@ -6062,6 +6624,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // vecs:nil, +// t:0, // }, // fields: fields { // core:nil, @@ -6190,7 +6753,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.InsertMultiple(test.args.vecs) +// err := n.InsertMultipleWithTime(test.args.vecs, test.args.t) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -6198,10 +6761,11 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_InsertMultipleWithTime(t *testing.T) { +// func Test_ngt_insertMultiple(t *testing.T) { // type args struct { -// vecs map[string][]float32 -// t int64 +// vecs map[string][]float32 +// now int64 +// validation bool // } // type fields struct { // core core.NGT @@ -6277,7 +6841,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // vecs:nil, -// t:0, +// now:0, +// validation:false, // }, // fields: fields { // core:nil, @@ -6346,7 +6911,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // vecs:nil, -// t:0, +// now:0, +// validation:false, // }, // fields: fields { // core:nil, @@ -6475,7 +7041,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.InsertMultipleWithTime(test.args.vecs, test.args.t) +// err := n.insertMultiple(test.args.vecs, test.args.now, test.args.validation) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -6483,11 +7049,10 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_insertMultiple(t *testing.T) { +// func Test_ngt_Update(t *testing.T) { // type args struct { -// vecs map[string][]float32 -// now int64 -// validation bool +// uuid string +// vec []float32 // } // type fields struct { // core core.NGT @@ -6562,9 +7127,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // { // name: "test_case_1", // args: args { -// vecs:nil, -// now:0, -// validation:false, +// uuid:"", +// vec:nil, // }, // fields: fields { // core:nil, @@ -6632,9 +7196,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // return test { // name: "test_case_2", // args: args { -// vecs:nil, -// now:0, -// validation:false, +// uuid:"", +// vec:nil, // }, // fields: fields { // core:nil, @@ -6763,7 +7326,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.insertMultiple(test.args.vecs, test.args.now, test.args.validation) +// err := n.Update(test.args.uuid, test.args.vec) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -6771,10 +7334,11 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_Update(t *testing.T) { +// func Test_ngt_UpdateWithTime(t *testing.T) { // type args struct { // uuid string // vec []float32 +// t int64 // } // type fields struct { // core core.NGT @@ -6851,6 +7415,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // args: args { // uuid:"", // vec:nil, +// t:0, // }, // fields: fields { // core:nil, @@ -6920,6 +7485,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // args: args { // uuid:"", // vec:nil, +// t:0, // }, // fields: fields { // core:nil, @@ -7048,7 +7614,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.Update(test.args.uuid, test.args.vec) +// err := n.UpdateWithTime(test.args.uuid, test.args.vec, test.args.t) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -7056,7 +7622,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_UpdateWithTime(t *testing.T) { +// func Test_ngt_update(t *testing.T) { // type args struct { // uuid string // vec []float32 @@ -7336,7 +7902,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.UpdateWithTime(test.args.uuid, test.args.vec, test.args.t) +// err := n.update(test.args.uuid, test.args.vec, test.args.t) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -7344,11 +7910,9 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_update(t *testing.T) { +// func Test_ngt_UpdateMultiple(t *testing.T) { // type args struct { -// uuid string -// vec []float32 -// t int64 +// vecs map[string][]float32 // } // type fields struct { // core core.NGT @@ -7423,9 +7987,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // { // name: "test_case_1", // args: args { -// uuid:"", -// vec:nil, -// t:0, +// vecs:nil, // }, // fields: fields { // core:nil, @@ -7493,9 +8055,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // return test { // name: "test_case_2", // args: args { -// uuid:"", -// vec:nil, -// t:0, +// vecs:nil, // }, // fields: fields { // core:nil, @@ -7624,7 +8184,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.update(test.args.uuid, test.args.vec, test.args.t) +// err := n.UpdateMultiple(test.args.vecs) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -7632,9 +8192,10 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_UpdateMultiple(t *testing.T) { +// func Test_ngt_UpdateMultipleWithTime(t *testing.T) { // type args struct { // vecs map[string][]float32 +// t int64 // } // type fields struct { // core core.NGT @@ -7710,6 +8271,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // vecs:nil, +// t:0, // }, // fields: fields { // core:nil, @@ -7778,6 +8340,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // vecs:nil, +// t:0, // }, // fields: fields { // core:nil, @@ -7906,7 +8469,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.UpdateMultiple(test.args.vecs) +// err := n.UpdateMultipleWithTime(test.args.vecs, test.args.t) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -7914,7 +8477,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_UpdateMultipleWithTime(t *testing.T) { +// func Test_ngt_updateMultiple(t *testing.T) { // type args struct { // vecs map[string][]float32 // t int64 @@ -8191,7 +8754,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.UpdateMultipleWithTime(test.args.vecs, test.args.t) +// err := n.updateMultiple(test.args.vecs, test.args.t) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -8199,10 +8762,11 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_updateMultiple(t *testing.T) { +// func Test_ngt_UpdateTimestamp(t *testing.T) { // type args struct { -// vecs map[string][]float32 -// t int64 +// uuid string +// ts int64 +// force bool // } // type fields struct { // core core.NGT @@ -8277,8 +8841,9 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // { // name: "test_case_1", // args: args { -// vecs:nil, -// t:0, +// uuid:"", +// ts:0, +// force:false, // }, // fields: fields { // core:nil, @@ -8346,8 +8911,9 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // return test { // name: "test_case_2", // args: args { -// vecs:nil, -// t:0, +// uuid:"", +// ts:0, +// force:false, // }, // fields: fields { // core:nil, @@ -8476,7 +9042,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.updateMultiple(test.args.vecs, test.args.t) +// err := n.UpdateTimestamp(test.args.uuid, test.args.ts, test.args.force) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -8484,11 +9050,9 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_UpdateTimestamp(t *testing.T) { +// func Test_ngt_Delete(t *testing.T) { // type args struct { -// uuid string -// ts int64 -// force bool +// uuid string // } // type fields struct { // core core.NGT @@ -8564,8 +9128,6 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // uuid:"", -// ts:0, -// force:false, // }, // fields: fields { // core:nil, @@ -8634,8 +9196,6 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // uuid:"", -// ts:0, -// force:false, // }, // fields: fields { // core:nil, @@ -8764,7 +9324,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.UpdateTimestamp(test.args.uuid, test.args.ts, test.args.force) +// err := n.Delete(test.args.uuid) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -8772,9 +9332,10 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_Delete(t *testing.T) { +// func Test_ngt_DeleteWithTime(t *testing.T) { // type args struct { // uuid string +// t int64 // } // type fields struct { // core core.NGT @@ -8850,6 +9411,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // uuid:"", +// t:0, // }, // fields: fields { // core:nil, @@ -8918,6 +9480,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // uuid:"", +// t:0, // }, // fields: fields { // core:nil, @@ -9046,7 +9609,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.Delete(test.args.uuid) +// err := n.DeleteWithTime(test.args.uuid, test.args.t) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -9054,10 +9617,11 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_DeleteWithTime(t *testing.T) { +// func Test_ngt_delete(t *testing.T) { // type args struct { -// uuid string -// t int64 +// uuid string +// t int64 +// validation bool // } // type fields struct { // core core.NGT @@ -9134,6 +9698,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // args: args { // uuid:"", // t:0, +// validation:false, // }, // fields: fields { // core:nil, @@ -9203,6 +9768,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // args: args { // uuid:"", // t:0, +// validation:false, // }, // fields: fields { // core:nil, @@ -9331,7 +9897,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.DeleteWithTime(test.args.uuid, test.args.t) +// err := n.delete(test.args.uuid, test.args.t, test.args.validation) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -9339,11 +9905,9 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_delete(t *testing.T) { +// func Test_ngt_DeleteMultiple(t *testing.T) { // type args struct { -// uuid string -// t int64 -// validation bool +// uuids []string // } // type fields struct { // core core.NGT @@ -9418,9 +9982,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // { // name: "test_case_1", // args: args { -// uuid:"", -// t:0, -// validation:false, +// uuids:nil, // }, // fields: fields { // core:nil, @@ -9488,9 +10050,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // return test { // name: "test_case_2", // args: args { -// uuid:"", -// t:0, -// validation:false, +// uuids:nil, // }, // fields: fields { // core:nil, @@ -9619,7 +10179,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.delete(test.args.uuid, test.args.t, test.args.validation) +// err := n.DeleteMultiple(test.args.uuids...) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -9627,9 +10187,10 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_DeleteMultiple(t *testing.T) { +// func Test_ngt_DeleteMultipleWithTime(t *testing.T) { // type args struct { // uuids []string +// t int64 // } // type fields struct { // core core.NGT @@ -9705,6 +10266,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // uuids:nil, +// t:0, // }, // fields: fields { // core:nil, @@ -9773,6 +10335,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // uuids:nil, +// t:0, // }, // fields: fields { // core:nil, @@ -9901,7 +10464,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.DeleteMultiple(test.args.uuids...) +// err := n.DeleteMultipleWithTime(test.args.uuids, test.args.t) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -9909,10 +10472,11 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_DeleteMultipleWithTime(t *testing.T) { +// func Test_ngt_deleteMultiple(t *testing.T) { // type args struct { -// uuids []string -// t int64 +// uuids []string +// now int64 +// validation bool // } // type fields struct { // core core.NGT @@ -9988,7 +10552,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_1", // args: args { // uuids:nil, -// t:0, +// now:0, +// validation:false, // }, // fields: fields { // core:nil, @@ -10057,7 +10622,8 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // name: "test_case_2", // args: args { // uuids:nil, -// t:0, +// now:0, +// validation:false, // }, // fields: fields { // core:nil, @@ -10186,7 +10752,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.DeleteMultipleWithTime(test.args.uuids, test.args.t) +// err := n.deleteMultiple(test.args.uuids, test.args.now, test.args.validation) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -10194,11 +10760,9 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_deleteMultiple(t *testing.T) { +// func Test_ngt_RegenerateIndexes(t *testing.T) { // type args struct { -// uuids []string -// now int64 -// validation bool +// ctx context.Context // } // type fields struct { // core core.NGT @@ -10273,9 +10837,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // { // name: "test_case_1", // args: args { -// uuids:nil, -// now:0, -// validation:false, +// ctx:nil, // }, // fields: fields { // core:nil, @@ -10343,9 +10905,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // return test { // name: "test_case_2", // args: args { -// uuids:nil, -// now:0, -// validation:false, +// ctx:nil, // }, // fields: fields { // core:nil, @@ -10474,7 +11034,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.deleteMultiple(test.args.uuids, test.args.now, test.args.validation) +// err := n.RegenerateIndexes(test.args.ctx) // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } @@ -10482,10 +11042,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // } // -// func Test_ngt_RegenerateIndexes(t *testing.T) { -// type args struct { -// ctx context.Context -// } +// func Test_ngt_loadStatistics(t *testing.T) { // type fields struct { // core core.NGT // eg errgroup.Group @@ -10540,12 +11097,11 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // } // type test struct { // name string -// args args // fields fields // want want // checkFunc func(want, error) error -// beforeFunc func(*testing.T, args) -// afterFunc func(*testing.T, args) +// beforeFunc func(*testing.T) +// afterFunc func(*testing.T) // } // defaultCheckFunc := func(w want, err error) error { // if !errors.Is(err, w.err) { @@ -10558,9 +11114,6 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // /* // { // name: "test_case_1", -// args: args { -// ctx:nil, -// }, // fields: fields { // core:nil, // eg:nil, @@ -10612,10 +11165,10 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // }, // want: want{}, // checkFunc: defaultCheckFunc, -// beforeFunc: func(t *testing.T, args args) { +// beforeFunc: func(t *testing.T,) { // t.Helper() // }, -// afterFunc: func(t *testing.T, args args) { +// afterFunc: func(t *testing.T,) { // t.Helper() // }, // }, @@ -10626,9 +11179,6 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // func() test { // return test { // name: "test_case_2", -// args: args { -// ctx:nil, -// }, // fields: fields { // core:nil, // eg:nil, @@ -10680,10 +11230,10 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // }, // want: want{}, // checkFunc: defaultCheckFunc, -// beforeFunc: func(t *testing.T, args args) { +// beforeFunc: func(t *testing.T,) { // t.Helper() // }, -// afterFunc: func(t *testing.T, args args) { +// afterFunc: func(t *testing.T,) { // t.Helper() // }, // } @@ -10697,10 +11247,10 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // tt.Parallel() // defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) // if test.beforeFunc != nil { -// test.beforeFunc(tt, test.args) +// test.beforeFunc(tt) // } // if test.afterFunc != nil { -// defer test.afterFunc(tt, test.args) +// defer test.afterFunc(tt) // } // checkFunc := test.checkFunc // if test.checkFunc == nil { @@ -10756,7 +11306,7 @@ func createRandomData(num int, cfg *createRandomDataConfig) []index { // statisticsCache: test.fields.statisticsCache, // } // -// err := n.RegenerateIndexes(test.args.ctx) +// err := n.loadStatistics() // if err := checkFunc(test.want, err); err != nil { // tt.Errorf("error = %v", err) // } diff --git a/pkg/discoverer/k8s/handler/grpc/option.go b/pkg/discoverer/k8s/handler/grpc/option.go index 9a7280bcff..b18a7f0a3e 100644 --- a/pkg/discoverer/k8s/handler/grpc/option.go +++ b/pkg/discoverer/k8s/handler/grpc/option.go @@ -18,11 +18,10 @@ package grpc import ( - "os" - "github.com/vdaas/vald/internal/errors" "github.com/vdaas/vald/internal/log" "github.com/vdaas/vald/internal/net" + "github.com/vdaas/vald/internal/os" "github.com/vdaas/vald/pkg/discoverer/k8s/service" ) diff --git a/pkg/gateway/filter/handler/grpc/option.go b/pkg/gateway/filter/handler/grpc/option.go index f3e96f0b64..0d240a6d5d 100644 --- a/pkg/gateway/filter/handler/grpc/option.go +++ b/pkg/gateway/filter/handler/grpc/option.go @@ -18,7 +18,6 @@ package grpc import ( - "os" "runtime" "github.com/vdaas/vald/internal/client/v1/client/filter/egress" @@ -26,6 +25,7 @@ import ( "github.com/vdaas/vald/internal/client/v1/client/vald" "github.com/vdaas/vald/internal/log" "github.com/vdaas/vald/internal/net" + "github.com/vdaas/vald/internal/os" "github.com/vdaas/vald/internal/sync/errgroup" ) diff --git a/pkg/gateway/lb/handler/grpc/option.go b/pkg/gateway/lb/handler/grpc/option.go index aa1d3b8ecd..2e97e25115 100644 --- a/pkg/gateway/lb/handler/grpc/option.go +++ b/pkg/gateway/lb/handler/grpc/option.go @@ -18,12 +18,12 @@ package grpc import ( - "os" "runtime" "time" "github.com/vdaas/vald/internal/log" "github.com/vdaas/vald/internal/net" + "github.com/vdaas/vald/internal/os" "github.com/vdaas/vald/internal/sync/errgroup" "github.com/vdaas/vald/internal/timeutil" "github.com/vdaas/vald/pkg/gateway/lb/service" diff --git a/pkg/gateway/mirror/handler/grpc/option.go b/pkg/gateway/mirror/handler/grpc/option.go index 5832e37be9..e2d14869db 100644 --- a/pkg/gateway/mirror/handler/grpc/option.go +++ b/pkg/gateway/mirror/handler/grpc/option.go @@ -14,12 +14,12 @@ package grpc import ( - "os" "runtime" "github.com/vdaas/vald/internal/errors" "github.com/vdaas/vald/internal/log" "github.com/vdaas/vald/internal/net" + "github.com/vdaas/vald/internal/os" "github.com/vdaas/vald/internal/sync/errgroup" "github.com/vdaas/vald/pkg/gateway/mirror/service" ) diff --git a/pkg/gateway/mirror/service/gateway_test.go b/pkg/gateway/mirror/service/gateway_test.go index 526132ecd0..ed53443040 100644 --- a/pkg/gateway/mirror/service/gateway_test.go +++ b/pkg/gateway/mirror/service/gateway_test.go @@ -200,7 +200,7 @@ package service // } // } // -// func Test_gateway_ForwardedContext(t *testing.T) { +// func Test_gateway_forwardedContext(t *testing.T) { // type args struct { // ctx context.Context // podName string @@ -301,7 +301,7 @@ package service // podName: test.fields.podName, // } // -// got := g.ForwardedContext(test.args.ctx, test.args.podName) +// got := g.forwardedContext(test.args.ctx, test.args.podName) // if err := checkFunc(test.want, got); err != nil { // tt.Errorf("error = %v", err) // } diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 7f3a192f22..d8b61afc05 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -144,9 +144,9 @@ checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "async-stream" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" dependencies = [ "async-stream-impl", "futures-core", @@ -155,9 +155,9 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", @@ -217,12 +217,12 @@ dependencies = [ [[package]] name = "axum" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f43644eed690f5374f1af436ecd6aea01cd201f6fbdf0178adaf6907afb2cec" +checksum = "504e3947307ac8326a5437504c517c4b56716c9d98fac0028c2acc7ca47d70ae" dependencies = [ "async-trait", - "axum-core 0.4.4", + "axum-core 0.4.5", "bytes", "futures-util", "http 1.1.0", @@ -261,9 +261,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6b8ba012a258d63c9adfa28b9ddcf66149da6f986c5b5452e629d5ee64bf00" +checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" dependencies = [ "async-trait", "bytes", @@ -364,7 +364,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" dependencies = [ "memchr", - "regex-automata 0.4.7", + "regex-automata 0.4.8", "serde", ] @@ -429,7 +429,7 @@ dependencies = [ "humantime", "ignore", "im-rc", - "indexmap 2.5.0", + "indexmap 2.6.0", "itertools 0.12.1", "jobserver", "lazycell", @@ -565,9 +565,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.22" +version = "1.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9540e661f81799159abee814118cc139a2004b3a3aa3ea37724a1b66530b90e0" +checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938" dependencies = [ "jobserver", "libc", @@ -582,24 +582,24 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.5.18" +version = "4.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" +checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.18" +version = "4.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" +checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b" dependencies = [ "anstream", "anstyle", "clap_lex", "strsim", - "terminal_size", + "terminal_size 0.4.0", ] [[package]] @@ -769,9 +769,9 @@ checksum = "026ac6ceace6298d2c557ef5ed798894962296469ec7842288ea64674201a2d1" [[package]] name = "curl" -version = "0.4.46" +version = "0.4.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e2161dd6eba090ff1594084e95fd67aeccf04382ffea77999ea94ed42ec67b6" +checksum = "d9fb4d13a1be2b58f14d60adba57c9834b78c62fd86c3e76a148f732686e9265" dependencies = [ "curl-sys", "libc", @@ -784,9 +784,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.76+curl-8.10.1" +version = "0.4.77+curl-8.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00462dbe9cbb9344e1b2be34d9094d74e3b8aac59a883495b335eafd02e25120" +checksum = "f469e8a5991f277a208224f6c7ad72ecb5f986e36d09ae1f2c1bb9259478a480" dependencies = [ "cc", "libc", @@ -1978,8 +1978,8 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -2005,7 +2005,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.5.0", + "indexmap 2.6.0", "slab", "tokio", "tokio-util", @@ -2024,7 +2024,7 @@ dependencies = [ "futures-core", "futures-sink", "http 1.1.0", - "indexmap 2.5.0", + "indexmap 2.6.0", "slab", "tokio", "tokio-util", @@ -2047,6 +2047,12 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + [[package]] name = "hashlink" version = "0.9.1" @@ -2162,9 +2168,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" @@ -2287,7 +2293,7 @@ dependencies = [ "globset", "log", "memchr", - "regex-automata 0.4.7", + "regex-automata 0.4.8", "same-file", "walkdir", "winapi-util", @@ -2319,12 +2325,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.0", ] [[package]] @@ -2626,7 +2632,7 @@ dependencies = [ "supports-color", "supports-hyperlinks", "supports-unicode", - "terminal_size", + "terminal_size 0.3.0", "textwrap", "thiserror", "unicode-width", @@ -2776,9 +2782,12 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" +dependencies = [ + "portable-atomic", +] [[package]] name = "opener" @@ -3080,6 +3089,12 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +[[package]] +name = "portable-atomic" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" + [[package]] name = "powerfmt" version = "0.2.0" @@ -3238,23 +3253,23 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355ae415ccd3a04315d3f8246e86d67689ea74d88d915576e1589a351062a13b" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -3268,13 +3283,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -3285,9 +3300,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" @@ -3717,9 +3732,9 @@ checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -3771,9 +3786,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", "fastrand", @@ -3801,6 +3816,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "terminal_size" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" +dependencies = [ + "rustix", + "windows-sys 0.59.0", +] + [[package]] name = "textwrap" version = "0.16.1" @@ -3981,7 +4006,7 @@ version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.6.0", "serde", "serde_spanned", "toml_datetime", @@ -4023,7 +4048,7 @@ checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52" dependencies = [ "async-stream", "async-trait", - "axum 0.7.6", + "axum 0.7.7", "base64 0.22.1", "bytes", "h2 0.4.6", diff --git a/versions/CMAKE_VERSION b/versions/CMAKE_VERSION index 7061f71e70..5f448421f9 100644 --- a/versions/CMAKE_VERSION +++ b/versions/CMAKE_VERSION @@ -1 +1 @@ -3.30.3 +3.30.4 diff --git a/versions/GO_VERSION b/versions/GO_VERSION index 49e0a31d49..14bee92c9e 100644 --- a/versions/GO_VERSION +++ b/versions/GO_VERSION @@ -1 +1 @@ -1.23.1 +1.23.2 diff --git a/versions/HDF5_VERSION b/versions/HDF5_VERSION index 85b169d0cb..2248db12d7 100644 --- a/versions/HDF5_VERSION +++ b/versions/HDF5_VERSION @@ -1 +1 @@ -hdf5_1.14.4.3 +hdf5_1.14.5 diff --git a/versions/JAEGER_OPERATOR_VERSION b/versions/JAEGER_OPERATOR_VERSION index 5f46e11eed..4b9cd6e7dc 100644 --- a/versions/JAEGER_OPERATOR_VERSION +++ b/versions/JAEGER_OPERATOR_VERSION @@ -1 +1 @@ -2.56.0 +2.57.0 diff --git a/versions/actions/CODECOV_CODECOV_ACTION b/versions/actions/CODECOV_CODECOV_ACTION index a84947d6ff..6016e8addc 100644 --- a/versions/actions/CODECOV_CODECOV_ACTION +++ b/versions/actions/CODECOV_CODECOV_ACTION @@ -1 +1 @@ -4.5.0 +4.6.0