From b6d94ec9a528c75d44384e03fb52747eee81807e Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Sat, 23 Jan 2021 16:28:12 +0300 Subject: [PATCH] Fixes around `get_by_attribute` Before, `attr_val` ignores attribute values that contains slashes in it value, now it's fixed. Update to v0.3.2 with fixing status of connection pool. Added debug log message when object not found, for debug reasons. Update .test.env variables prefix, it was changed in one of previous releases. Signed-off-by: Evgeniy Kulikov --- .test.env | 36 ++++++++++++++++++------------------ app.go | 5 +++-- go.mod | 2 +- go.sum | 4 ++-- receive.go | 1 + 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.test.env b/.test.env index c3ac45d..569bfda 100644 --- a/.test.env +++ b/.test.env @@ -1,19 +1,19 @@ -GW_VERBOSE=--true -GW_KEY=generated +HTTP_GW_VERBOSE=--true +HTTP_GW_KEY=generated -GW_LISTEN_ADDRESS=0.0.0.0:8087 -GW_LOGGER_LEVEL=debug -GW_CONNECT_TIMEOUT=60s -GW_REQUEST_TIMEOUT=300s -GW_KEEPALIVE_TIMEOUT=300s -GW_KEEPALIVE_TIME=120s -GW_KEEPALIVE_PERMIT_WITHOUT_STREAM=True -GW_CONN_TTL=1h -GW_PEERS_0_WEIGHT=1.0 -GW_PEERS_1_WEIGHT=0.125 -GW_PEERS_2_WEIGHT=0.125 -GW_PEERS_3_WEIGHT=0.125 -GW_PEERS_4_WEIGHT=0.125 -GW_PEERS_5_WEIGHT=0.125 -GW_PEERS_6_WEIGHT=0.125 -GW_PEERS_7_WEIGHT=0.125 \ No newline at end of file +HTTP_GW_LISTEN_ADDRESS=0.0.0.0:8087 +HTTP_GW_LOGGER_LEVEL=debug +HTTP_GW_CONNECT_TIMEOUT=60s +HTTP_GW_REQUEST_TIMEOUT=300s +HTTP_GW_KEEPALIVE_TIMEOUT=300s +HTTP_GW_KEEPALIVE_TIME=120s +HTTP_GW_KEEPALIVE_PERMIT_WITHOUT_STREAM=True +HTTP_GW_CONN_TTL=1h +HTTP_GW_PEERS_0_WEIGHT=1.0 +HTTP_GW_PEERS_1_WEIGHT=0.125 +HTTP_GW_PEERS_2_WEIGHT=0.125 +HTTP_GW_PEERS_3_WEIGHT=0.125 +HTTP_GW_PEERS_4_WEIGHT=0.125 +HTTP_GW_PEERS_5_WEIGHT=0.125 +HTTP_GW_PEERS_6_WEIGHT=0.125 +HTTP_GW_PEERS_7_WEIGHT=0.125 \ No newline at end of file diff --git a/app.go b/app.go index 17909e7..4b56ac3 100644 --- a/app.go +++ b/app.go @@ -176,8 +176,9 @@ func (a *app) Serve(ctx context.Context) { a.log.Info("enabled /get/{cid}/{oid}") r.GET("/get/{cid}/{oid}", a.byAddress) - a.log.Info("enabled /get_by_attribute/{cid}/{attr_key}/{attr_val}") - r.GET("/get_by_attribute/{cid}/{attr_key}/{attr_val}", a.byAttribute) + + a.log.Info("enabled /get_by_attribute/{cid}/{attr_key}/{attr_val:*}") + r.GET("/get_by_attribute/{cid}/{attr_key}/{attr_val:*}", a.byAttribute) // attaching /-/(ready,healthy) attachHealthy(r, a.pool.Status) diff --git a/go.mod b/go.mod index 33834cc..0b1e740 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.15 require ( github.com/fasthttp/router v1.3.5 - github.com/nspcc-dev/cdn-sdk v0.3.1 + github.com/nspcc-dev/cdn-sdk v0.3.2 github.com/nspcc-dev/neofs-api-go v1.22.1 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.9.0 diff --git a/go.sum b/go.sum index 8ea2a6a..125b0ce 100644 --- a/go.sum +++ b/go.sum @@ -294,8 +294,8 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/nspcc-dev/cdn-sdk v0.3.1 h1:8aDktq8vkzv/KUF1isSe6sUQiDGn6CG1k0Y/zaNn1LA= -github.com/nspcc-dev/cdn-sdk v0.3.1/go.mod h1:Wiw3oQjT2F+8ZRt8VnC34ZrSuCDvijyxc1p7bWmcSvk= +github.com/nspcc-dev/cdn-sdk v0.3.2 h1:R3OCj9yF1PKxPr/HQWTriNOHfsIq/wvSeGYnYkDtVAo= +github.com/nspcc-dev/cdn-sdk v0.3.2/go.mod h1:Wiw3oQjT2F+8ZRt8VnC34ZrSuCDvijyxc1p7bWmcSvk= github.com/nspcc-dev/dbft v0.0.0-20191205084618-dacb1a30c254/go.mod h1:w1Ln2aT+dBlPhLnuZhBV+DfPEdS2CHWWLp5JTScY3bw= github.com/nspcc-dev/dbft v0.0.0-20191209120240-0d6b7568d9ae/go.mod h1:3FjXOoHmA51EGfb5GS/HOv7VdmngNRTssSeQ729dvGY= github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxxg0Bfm6P92lY5eDSLYfp06XOdL8KAVgXjVk= diff --git a/receive.go b/receive.go index a290b79..5139252 100644 --- a/receive.go +++ b/receive.go @@ -183,6 +183,7 @@ func (a *app) byAttribute(c *fasthttp.RequestCtx) { c.Error("something went wrong", fasthttp.StatusBadRequest) return } else if len(ids) == 0 { + log.Debug("object not found") c.Error("not found", fasthttp.StatusNotFound) return }