ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
    • Supported Driver Versions
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Search Ask AI
ScyllaDB Docs ScyllaDB Node.js Driver API Reference Classes TokenRange
For AI agents: a documentation index is available at https://nodejs-rs-driver.docs.scylladb.com/v0.7.1/llms.txt. A Markdown version of this page is at https://nodejs-rs-driver.docs.scylladb.com/v0.7.1/api/TokenRange.md.

TokenRange¶

TokenRange()

Represents a range of tokens on a Cassandra ring.

A range is start-exclusive and end-inclusive. It is empty when start and end are the same token, except if that is the minimum token, in which case the range covers the whole ring (this is consistent with the behavior of CQL range queries).

Note that CQL does not handle wrapping. To query all partitions in a range, see unwrap.

Constructor¶

new TokenRange()

Source

token.ts, line 135

Methods¶

compare(other)

Returns 0 if the values are equal, otherwise compares against start, if start is equal, compares against end.

Parameters:
Name Type Description
other

Range to compare with.

Source

token.ts, line 278

contains(token)

Whether this range contains a given Token.

Parameters:
Name Type Description
token

Token to check for.

Source

token.ts, line 235

Returns:

Whether or not the Token is in this range.

equals(other)

Determines if the input range is equivalent to this one.

Parameters:
Name Type Description
other

Range to compare with.

Source

token.ts, line 263

Returns:

Whether or not the ranges are equal.

isEmpty()

A range is empty when start and end are the same token, except if that is the minimum token, in which case the range covers the whole ring. This is consistent with the behavior of CQL range queries.

Source

token.ts, line 193

Returns:

Whether this range is empty.

isWrappedAround()

A range wraps around the end of the ring when the start token is greater than the end token and the end token is not the minimum token.

Source

token.ts, line 204

Returns:

Whether this range wraps around.

splitEvenly(numberOfSplits)

Splits this range into a number of smaller ranges of equal "size" (referring to the number of tokens, not the actual amount of data).

Splitting an empty range is not permitted. But not that, in edge cases, splitting a range might produce one or more empty ranges.

Parameters:
Name Type Description
numberOfSplits

Number of splits to make.

Source

token.ts, line 155

Throws:

If splitting an empty range.

Type
Error
Returns:

Split ranges.

unwrap()

Splits this range into a list of two non-wrapping ranges.

This will return the range itself if it is non-wrapped, or two ranges otherwise.

This is useful for CQL range queries, which do not handle wrapping.

Source

token.ts, line 219

Returns:

The list of non-wrapping ranges.

Was this page helpful?

PREVIOUS
Token
NEXT
Vertex
  • Create an issue
  • Edit this page

On this page

  • TokenRange
    • Constructor
    • Methods
ScyllaDB Node.js Driver
Search Ask AI
  • v0.7.1
    • main
    • v0.7.1
    • v0.6.1
  • Getting Started
  • Statements
    • Executing CQL Statements - Best Practices
    • Unprepared Statements
    • Batch Statements
    • Parameterized queries
  • Fetching Large Result Sets
  • Schema Metadata
  • Topology
  • Replicas
  • Query Tracing
  • Logging
  • Policies
    • Load Balancing
    • Retry Policies
  • Authentication
  • Client Routes (Private Networking)
  • Shutdown
  • Migration Guide
  • API Reference
    • Modules
      • auth
        • AuthProvider
        • Authenticator
        • PlainTextAuthProvider
      • datastax
        • graph
        • search
      • errors
        • ArgumentError
        • AuthenticationError
        • BusyConnectionError
        • DriverInternalError
        • NoHostAvailableError
        • NotSupportedError
        • OperationTimedOutError
        • ResponseError
      • geometry
      • mapping
        • DefaultTableMappings
        • Mapper
        • ModelBatchItem
        • ModelMapper
        • Result
        • UnderscoreCqlToCamelCaseMappings
        • TableMappings
      • metrics
        • DefaultMetrics
        • ClientMetrics
      • policies
        • addressResolution
          • AddressTranslator
          • EC2MultiRegionTranslator
          • MappingAddressTranslator
        • loadBalancing
          • AllowListPolicy
          • DCAwareRoundRobinPolicy
          • DefaultLoadBalancingPolicy
          • LegacyDefaultLoadBalancingPolicy
          • LoadBalancingConfig
          • LoadBalancingPolicy
          • RoundRobinPolicy
          • TokenAwarePolicy
        • reconnection
          • ConstantReconnectionPolicy
          • ExponentialReconnectionPolicy
          • ReconnectionPolicy
        • retry
          • FallthroughRetryPolicy
          • RetryPolicy
        • timestampGeneration
          • MonotonicTimestampGenerator
          • TimestampGenerator
      • tracker
        • RequestLogger
        • RequestTracker
      • types
        • BigDecimal
        • Duration
        • InetAddress
        • Integer
        • LocalDate
        • ResultStream
        • Row
        • TimeUuid
        • Tuple
        • Uuid
    • Classes
      • Client
      • ColumnInfo
      • ConstantSpeculativeExecutionPolicy
      • DateRange
      • DateRangeBound
      • DseGssapiAuthProvider
      • DsePlainTextAuthProvider
      • Edge
      • Element
      • Encoder
      • EncoderMembers
      • ExecutionOptions
      • ExecutionProfile
      • FrameReader
      • FrameWriter
      • GraphResultSet
      • HashSet
      • LineString
      • NoSpeculativeExecutionPolicy
      • Path
      • Point
      • Polygon
      • PreparedInfo
      • Property
      • ResultColumnsCache
      • ResultSet
      • RustResult
      • RustSession
      • SpeculativeExecutionPolicy
      • SslOptions
      • Token
      • TokenRange
      • Vertex
      • VertexProperty
      • module-metadata-LocalStrategy
    • Interfaces
    • Events
    • Global Functions and Constants
Docs Tutorials University Contact Us About Us
© 2026 ScyllaDB | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 23 Oct 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.3