Scylla Documentation Logo Documentation
  • Server
    • Scylla Open Source
    • Scylla Enterprise
    • Scylla Alternator
  • Cloud
    • Scylla Cloud
    • Scylla Cloud Docs
  • Tools
    • Scylla Manager
    • Scylla Monitoring Stack
    • Scylla Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
Download
Menu
Scylla Java Driver Manual API conventions

API conventions¶

In previous versions, the driver relied solely on Java visibility rules: everything was either private or part of the public API. This made it hard to cleanly organize the code, and things ended up all together in one monolithic package; it also created a dilemma between providing useful hooks for advanced users, or keeping them hidden to limit the API surface.

Starting with 4.0, we adopt a package naming convention to address those issues:

  • Everything under com.datastax.oss.driver.api is part of the “official” public API of the driver, intended for regular client applications to execute queries. It follows semantic versioning: binary compatibility is guaranteed across minor and patch versions.

  • Everything under com.datastax.oss.driver.internal is the “internal” API, intended primarily for internal communication between driver components, and secondarily for advanced customization. If you use it from your code, the rules are:

    1. with great power comes great responsibility: this stuff is more involved, and has the potential to break the driver. You should probably have some familiarity with the source code.

    2. backward compatibility is “best-effort” only: we’ll try to preserve it as much as possible, but it’s not formally guaranteed.

The public API never exposes internal types (this is enforced automatically by our build). You’ll generally have to go through an explicit cast:

import com.datastax.oss.driver.api.core.context.DriverContext;

import com.datastax.oss.driver.internal.core.context.InternalDriverContext;
import com.datastax.oss.driver.internal.core.metadata.TopologyEvent;

// Public API:
DriverContext context = session.getContext();

// Switch to the internal API to force a node down:
InternalDriverContext internalContext = (InternalDriverContext) context;
InetSocketAddress address = new InetSocketAddress("127.0.0.1", 9042);
internalContext.getEventBus().fire(TopologyEvent.forceDown(address));

So the risk of unintentionally using the internal API is very low. To double-check, you can always grep import com.datastax.oss.driver.internal in your source files.

PREVIOUS
Manual
NEXT
Case sensitivity
  • 4.13.0.x
    • 4.13.0.x
    • 4.12.0.x
    • 4.11.1.x
    • 4.10.0.x
    • 4.7.2.x
    • 3.11.2.x
    • 3.11.0.x
    • 3.10.2.x
    • 3.7.2.x
  • Java Driver for Scylla and Apache Cassandra®
  • API Documentation
  • Manual
    • API conventions
    • Case sensitivity
    • Core driver
      • Address resolution
      • Asynchronous programming
      • Authentication
      • Bill of Materials (BOM)
      • Compression
      • Configuration
        • Reference configuration
      • Control connection
      • Custom codecs
      • Detachable types
      • Using the driver in GraalVM native images
      • Query idempotence
      • Integration
      • Load balancing
      • Logging
      • Metadata
        • Node metadata
        • Schema metadata
        • Token metadata
      • Metrics
      • Native protocol
      • Non-blocking programming
      • Paging
      • Performance
      • Connection pooling
      • Query timestamps
      • Reactive Style Programming
      • Reconnection
      • Request tracker
      • Retries
      • Using the shaded JAR
      • Speculative query execution
      • SSL
      • Statements
        • Batch statements
        • Per-query keyspace
        • Prepared statements
        • Simple statements
      • Temporal types
      • Request throttling
      • Query tracing
      • Tuples
      • User-defined types
    • Developer docs
      • Administrative tasks
      • Common infrastructure
        • Concurrency
        • Driver context
        • Event bus
      • Native protocol layer
      • Netty pipeline
      • Request execution
    • Mapper
      • Integration
        • Kotlin
        • Lombok
        • Java 14 Records
        • Scala
      • DAOs
        • Custom result types
        • Delete methods
        • GetEntity methods
        • Increment methods
        • Insert methods
        • Null saving strategy
        • Query methods
        • Query provider methods
        • Select methods
        • SetEntity methods
        • Statement attributes
        • Update methods
      • Entities
      • Mapper interface
    • OSGi
    • Query builder
      • Conditions
      • DELETE
      • Idempotence in the query builder
      • INSERT
      • Relations
      • Schema builder
        • Aggregate
        • Function
        • Index
        • Keyspace
        • Materialized View
        • Table
        • Type
      • SELECT
      • Terms
      • TRUNCATE
      • UPDATE
  • Upgrade guide
  • Frequently asked questions
  • Changelog
  • Create an issue
  • Edit this page
Logo
Docs Contact Us About Us
Mail List Icon Slack Icon
© 2022, ScyllaDB. All rights reserved.
Last updated on 25 May 2022.
Powered by Sphinx 4.3.2 & ScyllaDB Theme 1.2.2