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

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

  1. The Distance(Host) method is inherited from the child policy.
  2. The host yielded by the NewQueryPlan(String, IStatement) method will first return the Local replicas for the statement, based on the RoutingKey.
Inheritance Hierarchy
SystemObject
  CassandraTokenAwarePolicy

Namespace: Cassandra
Assembly: Cassandra (in Cassandra.dll) Version: 3.4.0
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