resolver

package
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound shows the container not found by name.
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type Container added in v0.28.0

type Container struct {
	// contains filtered or unexported fields
}

Container is a wrapper for the Resolver. It allows to update resolvers in runtime, without service restarting.

The Container should be used like regular Resolver.

func NewContainer added in v0.28.0

func NewContainer(ctx context.Context, endpoint string) (*Container, error)

NewContainer is a constructor for the Container.

func (*Container) Resolve added in v0.28.0

func (r *Container) Resolve(ctx context.Context, name string) (cid.ID, error)

Resolve looks up the container id by its name via NNS contract. The method calls inline resolver.

func (*Container) UpdateResolvers added in v0.28.0

func (r *Container) UpdateResolvers(ctx context.Context, endpoint string) error

UpdateResolvers allows to update resolver in runtime. Resolvers will be created from scratch.

type NNSResolver

type NNSResolver struct {
	// contains filtered or unexported fields
}

NNSResolver allows to resolve container id by its name.

func NewNNSResolver

func NewNNSResolver(reader *rpcNNS.ContractReader) *NNSResolver

NewNNSResolver is a constructor for the NNSResolver.

func (*NNSResolver) Resolve added in v0.28.0

func (r *NNSResolver) Resolve(_ context.Context, name string) (cid.ID, error)

Resolve looks up the container id by its name via NNS contract.

type Resolver added in v0.25.0

type Resolver interface {
	Resolve(ctx context.Context, containerName string) (cid.ID, error)
}

Resolver allows to map container ID by container name.

func NewResolver

func NewResolver(ctx context.Context, endpoint string) (Resolver, error)

NewResolver returns resolver depending on corresponding endpoint.

If endpoint is empty, error will be returned.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL