Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove NoOpResolver #830

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions api/resolver/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package resolver

import (
"context"
"errors"
"fmt"
"sync"

Expand Down Expand Up @@ -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)
Expand Down
14 changes: 0 additions & 14 deletions api/resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
9 changes: 2 additions & 7 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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`. | |
roman-khimov marked this conversation as resolved.
Show resolved Hide resolved
| `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. |
Expand Down
Loading