public abstract class Snapshot extends Object
Snapshot is a data class that contains an internally consistent snapshot of xDS resources. Snapshots should
have distinct versions per node group.| Constructor and Description |
|---|
Snapshot() |
| Modifier and Type | Method and Description |
|---|---|
abstract SnapshotResources<Cds.Cluster> |
clusters()
Returns all cluster items in the CDS payload.
|
static Snapshot |
create(Iterable<Cds.Cluster> clusters,
Iterable<Eds.ClusterLoadAssignment> endpoints,
Iterable<Lds.Listener> listeners,
Iterable<Rds.RouteConfiguration> routes,
Iterable<Cert.Secret> secrets,
String version)
Returns a new
Snapshot instance that is versioned uniformly across all resources. |
static Snapshot |
create(Iterable<Cds.Cluster> clusters,
String clustersVersion,
Iterable<Eds.ClusterLoadAssignment> endpoints,
String endpointsVersion,
Iterable<Lds.Listener> listeners,
String listenersVersion,
Iterable<Rds.RouteConfiguration> routes,
String routesVersion,
Iterable<Cert.Secret> secrets,
String secretsVersion)
Returns a new
Snapshot instance that has separate versions for each resource type. |
static Snapshot |
createEmpty(String version)
Creates an empty snapshot with the given version.
|
abstract SnapshotResources<Eds.ClusterLoadAssignment> |
endpoints()
Returns all endpoint items in the EDS payload.
|
void |
ensureConsistent()
Asserts that all dependent resources are included in the snapshot.
|
abstract SnapshotResources<Lds.Listener> |
listeners()
Returns all listener items in the LDS payload.
|
Map<String,? extends Message> |
resources(String typeUrl)
Returns the resources with the given type.
|
abstract SnapshotResources<Rds.RouteConfiguration> |
routes()
Returns all route items in the RDS payload.
|
abstract SnapshotResources<Cert.Secret> |
secrets()
Returns all secret items in the SDS payload.
|
String |
version(String typeUrl)
Returns the version in this snapshot for the given resource type.
|
public static Snapshot create(Iterable<Cds.Cluster> clusters, Iterable<Eds.ClusterLoadAssignment> endpoints, Iterable<Lds.Listener> listeners, Iterable<Rds.RouteConfiguration> routes, Iterable<Cert.Secret> secrets, String version)
Snapshot instance that is versioned uniformly across all resources.clusters - the cluster resources in this snapshotendpoints - the endpoint resources in this snapshotlisteners - the listener resources in this snapshotroutes - the route resources in this snapshotversion - the version associated with all resources in this snapshotpublic static Snapshot create(Iterable<Cds.Cluster> clusters, String clustersVersion, Iterable<Eds.ClusterLoadAssignment> endpoints, String endpointsVersion, Iterable<Lds.Listener> listeners, String listenersVersion, Iterable<Rds.RouteConfiguration> routes, String routesVersion, Iterable<Cert.Secret> secrets, String secretsVersion)
Snapshot instance that has separate versions for each resource type.clusters - the cluster resources in this snapshotclustersVersion - the version of the cluster resourcesendpoints - the endpoint resources in this snapshotendpointsVersion - the version of the endpoint resourceslisteners - the listener resources in this snapshotlistenersVersion - the version of the listener resourcesroutes - the route resources in this snapshotroutesVersion - the version of the route resourcespublic static Snapshot createEmpty(String version)
version - the version of the snapshot resourcespublic abstract SnapshotResources<Cds.Cluster> clusters()
public abstract SnapshotResources<Eds.ClusterLoadAssignment> endpoints()
public abstract SnapshotResources<Lds.Listener> listeners()
public abstract SnapshotResources<Rds.RouteConfiguration> routes()
public abstract SnapshotResources<Cert.Secret> secrets()
public void ensureConsistent()
throws SnapshotConsistencyException
Note that clusters and listeners are requested without name references, so Envoy will accept the snapshot list of clusters as-is, even if it does not match all references found in xDS.
SnapshotConsistencyException - if the snapshot is not consistentpublic Map<String,? extends Message> resources(String typeUrl)
typeUrl - the URL for the requested resource typeCopyright © 2018 The Envoy Project. All rights reserved.