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 <kim@nspcc.ru>
This commit is contained in:
Evgeniy Kulikov 2021-01-23 16:28:12 +03:00
parent 52812f7869
commit b6d94ec9a5
No known key found for this signature in database
GPG key ID: BF6AEE0A2A699BF2
5 changed files with 25 additions and 23 deletions

View file

@ -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
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

5
app.go
View file

@ -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)

2
go.mod
View file

@ -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

4
go.sum
View file

@ -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=

View file

@ -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
}