Click or drag to resize
TokenAwarePolicy Class
A wrapper load balancing policy that add token awareness to a child policy.

This policy encapsulates another policy. The resulting policy works in the following way:

Do note that only replica for which the child policy distance method returns HostDistance.Local will be considered having priority. For example, if you wrap DCAwareRoundRobinPolicy with this token aware policy, replicas from remote data centers may only be returned after all the host of the local data center.

Inheritance Hierarchy
SystemObject
  CassandraTokenAwarePolicy

Namespace: Cassandra
Assembly: Cassandra (in Cassandra.dll) Version: 3.0.9 (git 5ca22bb)
Syntax
C#
public class TokenAwarePolicy : ILoadBalancingPolicy

The TokenAwarePolicy type exposes the following members.

Constructors
  NameDescription
Public methodTokenAwarePolicy
Creates a new TokenAware policy that wraps the provided child load balancing policy.
Top
Methods
  NameDescription
Public methodDistance
Return the HostDistance for the provided host.
Public methodInitialize
Public methodNewQueryPlan
Returns the hosts to use for a new query.

The returned plan will first return replicas (whose HostDistance for the child policy is Local) for the query if it can determine them (i.e. mainly if IStatement.RoutingKey is not null). Following what it will return the plan of the child policy.

Top
See Also