From bb3dc1d1b16d3633bee1df381b737199a18ab0ca Mon Sep 17 00:00:00 2001 From: Evgenii Baidakov Date: Fri, 22 Sep 2023 11:37:53 +0400 Subject: [PATCH 1/2] resolver: Remove NoOpResolver closes #813 Signed-off-by: Evgenii Baidakov --- api/resolver/init.go | 5 +++-- api/resolver/resolver.go | 14 -------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/api/resolver/init.go b/api/resolver/init.go index 34707416..05bc8626 100644 --- a/api/resolver/init.go +++ b/api/resolver/init.go @@ -2,6 +2,7 @@ package resolver import ( "context" + "errors" "fmt" "sync" @@ -61,10 +62,10 @@ func NewContainer(ctx context.Context, endpoint string) (*Container, error) { // NewResolver returns resolver depending on corresponding endpoint. // -// If endpoint is empty, [NoOpResolver] will be returned. +// If endpoint is empty, error will be returned. func NewResolver(ctx context.Context, endpoint string) (Resolver, error) { if endpoint == "" { - return NewNoOpResolver(), nil + return nil, errors.New("endpoint must be set") } cl, err := rpcClient(ctx, endpoint) diff --git a/api/resolver/resolver.go b/api/resolver/resolver.go index 94e9ab58..53b1c122 100644 --- a/api/resolver/resolver.go +++ b/api/resolver/resolver.go @@ -54,17 +54,3 @@ func (r *NNSResolver) Resolve(_ context.Context, name string) (cid.ID, error) { func nnsContainerDomain(name string) string { return fmt.Sprintf("%s.%s", name, defaultZone) } - -// NoOpResolver is a special resolver for situation when [NNSResolver] can't be created. -type NoOpResolver struct { -} - -// NewNoOpResolver is a constructor for the NoOpResolver. -func NewNoOpResolver() *NoOpResolver { - return &NoOpResolver{} -} - -// Resolve always returns [ErrNotFound]. -func (r *NoOpResolver) Resolve(_ context.Context, _ string) (cid.ID, error) { - return cid.ID{}, ErrNotFound -} From 621107566829397dd304a0dd76225e2d56886787 Mon Sep 17 00:00:00 2001 From: Evgenii Baidakov Date: Tue, 26 Sep 2023 09:26:37 +0400 Subject: [PATCH 2/2] docs: Remove resolve_order mentioning Signed-off-by: Evgenii Baidakov --- docs/configuration.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index f946de3f..3cf92b47 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -66,11 +66,10 @@ Using these flag you can configure only one address. To set multiple addresses u ### RPC endpoint and resolving of bucket names -To set RPC endpoint specify a value of parameter `-r` or `--rpc_endpoint`. The parameter is **required if** another -parameter's `--resolve_order` value contains `nns`. +To set RPC endpoint specify a value of parameter `-r` or `--rpc_endpoint`. This endpoint must be set. ```shell -$ neofs-s3-gw --rpc_endpoint http://morph-chain.neofs.devenv:30333/ --resolve_order nns,dns +$ neofs-s3-gw --rpc_endpoint http://morph-chain.neofs.devenv:30333/ ``` ### Processing of requests @@ -175,9 +174,6 @@ listen_domains: - s3dev2.neofs.devenv rpc_endpoint: http://morph-chain.neofs.devenv:30333 -resolve_order: - - nns - - dns connect_timeout: 10s stream_timeout: 10s @@ -197,7 +193,6 @@ allowed_access_key_id_prefixes: |----------------------------------|------------|---------------|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `listen_domains` | `[]string` | | | Domains to be able to use virtual-hosted-style access to bucket. | | `rpc_endpoint` | `string` | yes | | The address of the RPC host to which the gateway connects to resolve bucket names (required to use the `nns` resolver). | -| `resolve_order` | `[]string` | yes | `[dns]` | Order of bucket name resolvers to use. Available resolvers: `dns`, `nns`. | | | `connect_timeout` | `duration` | | `10s` | Timeout to connect to a node. | | `stream_timeout` | `duration` | | `10s` | Timeout for individual operations in streaming RPC. | | `healthcheck_timeout` | `duration` | | `15s` | Timeout to check node health during rebalance. |