Table of Contents

Class InMemoryConfigProvider

Namespace
Yarp.ReverseProxy.Configuration
Assembly
Yarp.ReverseProxy.dll

Provides an implementation of IProxyConfigProvider to support config being generated by code.

public sealed class InMemoryConfigProvider : IProxyConfigProvider
Inheritance
InMemoryConfigProvider
Implements
Inherited Members

Constructors

InMemoryConfigProvider(IReadOnlyList<RouteConfig>, IReadOnlyList<ClusterConfig>)

Creates a new instance.

public InMemoryConfigProvider(IReadOnlyList<RouteConfig> routes, IReadOnlyList<ClusterConfig> clusters)

Parameters

routes IReadOnlyList<RouteConfig>
clusters IReadOnlyList<ClusterConfig>

InMemoryConfigProvider(IReadOnlyList<RouteConfig>, IReadOnlyList<ClusterConfig>, string)

Creates a new instance, specifying a revision id of the configuration.

public InMemoryConfigProvider(IReadOnlyList<RouteConfig> routes, IReadOnlyList<ClusterConfig> clusters, string revisionId)

Parameters

routes IReadOnlyList<RouteConfig>
clusters IReadOnlyList<ClusterConfig>
revisionId string

Methods

GetConfig()

Implementation of the IProxyConfigProvider.GetConfig method to supply the current snapshot of configuration

public IProxyConfig GetConfig()

Returns

IProxyConfig

An immutable snapshot of the current configuration state

Update(IReadOnlyList<RouteConfig>, IReadOnlyList<ClusterConfig>)

Swaps the config state with a new snapshot of the configuration, then signals that the old one is outdated.

public void Update(IReadOnlyList<RouteConfig> routes, IReadOnlyList<ClusterConfig> clusters)

Parameters

routes IReadOnlyList<RouteConfig>
clusters IReadOnlyList<ClusterConfig>

Update(IReadOnlyList<RouteConfig>, IReadOnlyList<ClusterConfig>, string)

Swaps the config state with a new snapshot of the configuration, then signals that the old one is outdated.

public void Update(IReadOnlyList<RouteConfig> routes, IReadOnlyList<ClusterConfig> clusters, string revisionId)

Parameters

routes IReadOnlyList<RouteConfig>
clusters IReadOnlyList<ClusterConfig>
revisionId string