abstract-ns 0.2.4

Abstract name service traits for use with futures (and tokio)

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

MemResolver

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

Router

A helper which allows to resolve different names by different means

RouterBuilder

A builder/fluent interface to create a Router

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