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 RustSession
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/RustSession.md.

RustSession¶

RustSession()

The native session of the driver.

Rust gives the session to JS as an External, not as an instance of a native class. A method call on an instance of a native class costs napi_unwrap and a borrow check of napi-rs. JS uses the session in each execution, so this cost adds up. This class gives the session the same methods that the native class had. Each method calls one Rust function with the External.

This class also owns the values frames of the session. Its methods take the values, encode them into a frame, and pass the frame to Rust. A frame is a view of one shared FrameWriter buffer, and the next frame overwrites it. Thus, these rules keep concurrent requests from sending each other's values:

  • A frame never leaves this class. Callers cannot keep one across an await.
  • Each method that writes a frame is not async. Thus, await between writing the frame and the native call is a compile error. Do not make these methods async.
  • Rust copies the frame before the native call returns.

Constructor¶

new RustSession()

Source

rust-session.ts, line 42

Members¶

inner

The native session, for the Rust functions that take it as an argument.

Source

rust-session.ts, line 67

Methods¶

batch(types, params)

Parameters:
Name Type Description
types

The expected types, one list for each statement.

params

The values, one array for each statement.

Source

rust-session.ts, line 141

batchPrepared(types, params)

Parameters:
Name Type Description
types

The expected types, one list for each statement.

params

The values, one array for each statement.

Source

rust-session.ts, line 159

computeToken(components)

Parameters:
Name Type Description
components

The partition key values, already encoded. null is null, and undefined is unset.

Source

rust-session.ts, line 201

(async, static) create(encoder)

Creates a session based on the provided session options.

Parameters:
Name Type Description
encoder

Encodes the values of the requests of this session.

Source

rust-session.ts, line 59

Was this page helpful?

PREVIOUS
RustResult
NEXT
SpeculativeExecutionPolicy
  • Create an issue
  • Edit this page

On this page

  • RustSession
    • Constructor
    • Members
    • 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