Crate abstract_ns [] [src]

Abstract traits for name service library

Here are small breakdown:

  • Name is currently an alias to &str (but it may change in future)
  • Address is a structure which address resolves to. It's more than just a SocketAddr you have used to, but there is Address::pick_one() which does quick and dirty solution
  • Resolver is a structure which is a configured resolver. You may use many different resolvers in your application. Use Resolver::resolve(name) to get a future Resolver::subscribe(name) to get a stream of updates.
  • MemResolver is an in-memory hash table for addresses you may use for tests
  • Router is a way to specify different sources for different names, for example serve *.consul from local consul, other things from conventional DNS servers

Structs

Address

Address that nameservice has returned

AddressBuilder

A builder interface for Address

AddressIter

Iterates over individual SocketAddr's (IPs) in the WeightedSet (i.e. a set of addresses having the same priority).

MemResolver

A stub resolver that resolves names from in-memory hash table

PriorityIter

Iterator over Address that returns a set of addresses of the same priority on each iteration

Router

A helper which allows to resolve different names by different means

RouterBuilder

A builder/fluent interface to create a Router

StaticStream

A stream that resolves to a static addresss and never updates

Union

Represents a stream that is the result of union_stream()

WeightedSet

A structure that represents a set of addresses of the same priority

Enums

Error

A generic name resolution error

Traits

Resolver

Main trait that does name resolution

Functions

union_addresses

Union Address values into another address

union_stream

Get the stream that emits address that is a union (superset) of all adderesses of underlying streams

Type Definitions

Name

A type alias that represents a name resolved by a name service

Weight

A type alias for a weight for each name in an address