├── .asf.yaml ├── .circleci └── config.yml ├── .gitignore ├── CHANGES.txt ├── CONTRIBUTING.md ├── LICENSE.txt ├── NEWS.txt ├── NOTICE.txt ├── README.md ├── adapters ├── adapters-base │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── cassandra │ │ │ └── sidecar │ │ │ └── adapters │ │ │ └── base │ │ │ ├── CassandraAdapter.java │ │ │ ├── CassandraClusterMembershipOperations.java │ │ │ ├── CassandraFactory.java │ │ │ ├── CassandraMetricsOperations.java │ │ │ ├── CassandraStorageOperations.java │ │ │ ├── CassandraTableOperations.java │ │ │ ├── NodeInfo.java │ │ │ ├── RingProvider.java │ │ │ ├── TokenRangeReplicaProvider.java │ │ │ ├── data │ │ │ ├── CompositeDataUtil.java │ │ │ ├── ProgressInfo.java │ │ │ ├── SessionInfo.java │ │ │ ├── StreamState.java │ │ │ └── StreamSummary.java │ │ │ ├── db │ │ │ ├── ConnectedClientStats.java │ │ │ ├── ConnectedClientStatsDatabaseAccessor.java │ │ │ ├── ConnectedClientStatsSummary.java │ │ │ └── schema │ │ │ │ └── ConnectedClientsSchema.java │ │ │ ├── exception │ │ │ └── OperationUnavailableException.java │ │ │ └── jmx │ │ │ ├── ClusterMembershipJmxOperations.java │ │ │ ├── EndpointSnitchJmxOperations.java │ │ │ ├── GossipDependentStorageJmxOperations.java │ │ │ ├── MetricsJmxOperations.java │ │ │ ├── StorageJmxOperations.java │ │ │ ├── StreamManagerJmxOperations.java │ │ │ └── TableJmxOperations.java │ │ └── test │ │ └── java │ │ └── org │ │ └── apache │ │ └── cassandra │ │ └── sidecar │ │ └── adapters │ │ └── base │ │ ├── TokenRangeReplicaProviderTest.java │ │ └── db │ │ └── ConnectedClientStatsTest.java └── adapters-cassandra41 │ ├── build.gradle │ └── src │ └── main │ └── java │ └── org │ └── apache │ └── cassandra │ └── sidecar │ └── adapters │ └── cassandra41 │ ├── Cassandra41Adapter.java │ ├── Cassandra41Factory.java │ └── Cassandra41StorageOperations.java ├── build.gradle ├── checkstyle.xml ├── client-common ├── build.gradle └── src │ ├── main │ └── java │ │ └── org │ │ └── apache │ │ └── cassandra │ │ └── sidecar │ │ ├── client │ │ ├── SidecarInstance.java │ │ └── SidecarInstanceImpl.java │ │ └── common │ │ ├── ApiEndpointsV1.java │ │ ├── DataObjectBuilder.java │ │ ├── data │ │ ├── ConsistencyConfig.java │ │ ├── ConsistencyLevel.java │ │ ├── ConsistencyVerificationResult.java │ │ ├── OperationalJobStatus.java │ │ ├── RestoreJobConstants.java │ │ ├── RestoreJobProgressFetchPolicy.java │ │ ├── RestoreJobSecrets.java │ │ ├── RestoreJobStatus.java │ │ ├── SSTableImportOptions.java │ │ └── StorageCredentials.java │ │ ├── exceptions │ │ └── RangeException.java │ │ ├── http │ │ ├── SidecarHttpHeaderNames.java │ │ └── SidecarHttpResponseStatus.java │ │ ├── request │ │ ├── AbortRestoreJobRequest.java │ │ ├── AllServicesConfigRequest.java │ │ ├── CassandraJmxHealthRequest.java │ │ ├── CassandraNativeHealthRequest.java │ │ ├── CleanSSTableUploadSessionRequest.java │ │ ├── ClearSnapshotRequest.java │ │ ├── ConnectedClientStatsRequest.java │ │ ├── CreateRestoreJobRequest.java │ │ ├── CreateRestoreJobSliceRequest.java │ │ ├── CreateSnapshotRequest.java │ │ ├── DeleteServiceConfigRequest.java │ │ ├── GossipHealthRequest.java │ │ ├── GossipInfoRequest.java │ │ ├── ImportSSTableRequest.java │ │ ├── JsonRequest.java │ │ ├── JsonResponseBytesDecoder.java │ │ ├── ListCdcSegmentsRequest.java │ │ ├── ListOperationalJobsRequest.java │ │ ├── ListSnapshotFilesRequest.java │ │ ├── NodeDecommissionRequest.java │ │ ├── NodeSettingsRequest.java │ │ ├── OperationalJobRequest.java │ │ ├── ReportSchemaRequest.java │ │ ├── Request.java │ │ ├── ResponseBytesDecoder.java │ │ ├── RestoreJobProgressRequest.java │ │ ├── RestoreJobSummaryRequest.java │ │ ├── RingRequest.java │ │ ├── SSTableComponentRequest.java │ │ ├── SchemaRequest.java │ │ ├── Service.java │ │ ├── SidecarHealthRequest.java │ │ ├── SnapshotRequest.java │ │ ├── StreamCdcSegmentRequest.java │ │ ├── StreamStatsRequest.java │ │ ├── TableStatsRequest.java │ │ ├── TimeSkewRequest.java │ │ ├── TokenRangeReplicasRequest.java │ │ ├── UpdateRestoreJobRequest.java │ │ ├── UpdateServiceConfigRequest.java │ │ ├── UploadSSTableRequest.java │ │ ├── UploadableRequest.java │ │ └── data │ │ │ ├── AbortRestoreJobRequestPayload.java │ │ │ ├── AllServicesConfigPayload.java │ │ │ ├── CreateRestoreJobRequestPayload.java │ │ │ ├── CreateSliceRequestPayload.java │ │ │ ├── Digest.java │ │ │ ├── MD5Digest.java │ │ │ ├── RestoreJobProgressRequestParams.java │ │ │ ├── UpdateCdcServiceConfigPayload.java │ │ │ ├── UpdateRestoreJobRequestPayload.java │ │ │ └── XXHash32Digest.java │ │ ├── response │ │ ├── ConnectedClientStatsResponse.java │ │ ├── GossipInfoResponse.java │ │ ├── HealthResponse.java │ │ ├── ListCdcSegmentsResponse.java │ │ ├── ListOperationalJobsResponse.java │ │ ├── ListSnapshotFilesResponse.java │ │ ├── NodeSettings.java │ │ ├── OperationalJobResponse.java │ │ ├── RingResponse.java │ │ ├── SSTableImportResponse.java │ │ ├── SSTableUploadResponse.java │ │ ├── SchemaResponse.java │ │ ├── StreamStatsResponse.java │ │ ├── TableStatsResponse.java │ │ ├── TimeSkewResponse.java │ │ ├── TokenRangeReplicasResponse.java │ │ └── data │ │ │ ├── CdcSegmentInfo.java │ │ │ ├── ClientConnectionEntry.java │ │ │ ├── CreateRestoreJobResponsePayload.java │ │ │ ├── RestoreJobProgressResponsePayload.java │ │ │ ├── RestoreJobSummaryResponsePayload.java │ │ │ ├── RestoreRangeJson.java │ │ │ ├── RingEntry.java │ │ │ └── StreamsProgressStats.java │ │ └── utils │ │ ├── HttpRange.java │ │ ├── Preconditions.java │ │ ├── StringUtils.java │ │ └── TimeUtils.java │ ├── test │ └── java │ │ └── org │ │ └── apache │ │ └── cassandra │ │ └── sidecar │ │ └── common │ │ ├── data │ │ ├── RestoreJobProgressFetchPolicyTest.java │ │ └── RestoreJobStatusTest.java │ │ ├── http │ │ └── SidecarHttpResponseStatusTest.java │ │ ├── request │ │ ├── CreateRestoreJobRequestPayloadTest.java │ │ ├── CreateSliceRequestPayloadTest.java │ │ ├── RestoreJobProgressRequestTest.java │ │ ├── UpdateRestoreJobRequestPayloadTest.java │ │ └── data │ │ │ └── AbortRestoreJobRequestPayloadTest.java │ │ ├── response │ │ ├── GossipInfoResponseTest.java │ │ ├── ListCdcSegmentsResponseTest.java │ │ └── RingResponseTest.java │ │ └── utils │ │ ├── HttpRangeTest.java │ │ └── TimeUtilsTest.java │ └── testFixtures │ └── java │ └── org │ └── apache │ └── cassandra │ └── sidecar │ └── foundation │ └── RestoreJobSecretsGen.java ├── client ├── README.md ├── build.gradle └── src │ ├── main │ └── java │ │ └── org │ │ └── apache │ │ └── cassandra │ │ └── sidecar │ │ └── client │ │ ├── HttpClient.java │ │ ├── HttpClientConfig.java │ │ ├── HttpResponse.java │ │ ├── HttpResponseImpl.java │ │ ├── RequestContext.java │ │ ├── RequestExecutor.java │ │ ├── SidecarClient.java │ │ ├── SidecarClientBlobRestoreExtension.java │ │ ├── SidecarClientConfig.java │ │ ├── SidecarClientConfigImpl.java │ │ ├── SidecarInstancesProvider.java │ │ ├── SimpleSidecarInstancesProvider.java │ │ ├── StreamBuffer.java │ │ ├── StreamConsumer.java │ │ ├── exception │ │ ├── ResourceNotFoundException.java │ │ ├── RetriesExhaustedException.java │ │ └── UnexpectedStatusCodeException.java │ │ ├── retry │ │ ├── BasicRetryPolicy.java │ │ ├── CreateRestoreJobRetryPolicy.java │ │ ├── ExponentialBackoffRetryPolicy.java │ │ ├── IgnoreConflictRetryPolicy.java │ │ ├── NoRetryPolicy.java │ │ ├── OncePerInstanceRetryPolicy.java │ │ ├── RetryAction.java │ │ ├── RetryPolicy.java │ │ └── RunnableOnStatusCodeRetryPolicy.java │ │ └── selection │ │ ├── InstanceSelectionPolicy.java │ │ ├── OrderedInstanceSelectionPolicy.java │ │ ├── RandomInstanceSelectionPolicy.java │ │ └── SingleInstanceSelectionPolicy.java │ ├── test │ └── java │ │ └── org │ │ └── apache │ │ └── cassandra │ │ └── sidecar │ │ └── client │ │ ├── HttpClientConfigTest.java │ │ ├── SidecarClientConfigTest.java │ │ ├── SidecarInstanceImplTest.java │ │ ├── SidecarInstanceTest.java │ │ ├── SimpleSidecarInstancesProviderTest.java │ │ ├── StreamBufferTest.java │ │ ├── request │ │ ├── JsonRequestTest.java │ │ └── JsonResponseBytesDecoderTest.java │ │ ├── retry │ │ ├── BasicRetryPolicyTest.java │ │ ├── ExponentialBackoffRetryPolicyTest.java │ │ ├── IgnoreConflictRetryPolicyTest.java │ │ ├── NoRetryPolicyTest.java │ │ └── RunnableOnStatusCodeRetryPolicyTest.java │ │ └── selection │ │ ├── OrderedInstanceSelectionPolicyTest.java │ │ ├── RandomInstanceSelectionPolicyTest.java │ │ └── SingleInstanceSelectionPolicyTest.java │ └── testFixtures │ ├── java │ └── org │ │ └── apache │ │ └── cassandra │ │ └── sidecar │ │ └── client │ │ ├── SidecarClientTest.java │ │ └── request │ │ ├── BaseRequestTest.java │ │ ├── FullSchemaRequestTestParameters.java │ │ ├── GossipInfoRequestTestParameters.java │ │ ├── ListSnapshotFilesRequestTestParameters.java │ │ ├── NodeSettingsRequestTestParameters.java │ │ ├── RequestExecutorTest.java │ │ ├── RequestTestParameters.java │ │ ├── RingRequestForKeyspaceTestParameters.java │ │ ├── RingRequestTestParameters.java │ │ ├── SchemaRequestTestParameters.java │ │ └── TimeSkewRequestTestParameters.java │ └── resources │ └── sstables │ └── nb-1-big-TOC.txt ├── conf ├── logback.xml └── sidecar.yaml ├── docs ├── build.gradle └── src │ ├── development.adoc │ └── user.adoc ├── examples ├── README.md └── conf │ └── sidecar-ccm.yaml ├── gradle.properties ├── gradle ├── common │ ├── integrationTestTask.gradle │ ├── java11Options.gradle │ └── publishing.gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── ide └── idea │ ├── codeStyleSettings.xml │ └── copyright │ ├── Apache_License_2_0.xml │ └── profiles_settings.xml ├── integration-framework ├── build.gradle └── src │ ├── main │ └── java │ │ └── org │ │ └── apache │ │ └── cassandra │ │ ├── distributed │ │ └── impl │ │ │ └── CassandraCluster.java │ │ ├── sidecar │ │ └── testing │ │ │ ├── LocalhostResolver.java │ │ │ ├── MtlsTestHelper.java │ │ │ ├── QualifiedName.java │ │ │ ├── SharedClusterIntegrationTestBase.java │ │ │ ├── SharedExecutorNettyOptions.java │ │ │ └── TemporaryCqlSessionProvider.java │ │ └── testing │ │ ├── ClusterBuilderConfiguration.java │ │ ├── IClusterExtension.java │ │ ├── IsolatedDTestClassLoaderWrapper.java │ │ ├── Partitioner.java │ │ ├── TestTokenSupplier.java │ │ ├── TestUtils.java │ │ ├── TestVersion.java │ │ └── TestVersionSupplier.java │ └── test │ └── java │ └── org │ └── apache │ └── cassandra │ └── sidecar │ └── testing │ └── LocalhostResolverTest.java ├── integration-tests ├── build.gradle └── src │ └── integrationTest │ └── org │ └── apache │ └── cassandra │ └── sidecar │ ├── health │ └── SidecarPeerDownDetectorIntegrationTest.java │ ├── routes │ ├── CassandraSchemaRouteIntegrationTest.java │ ├── CassandraStatsIntegrationTest.java │ ├── CdcConfigIntegrationTest.java │ └── RoutesIntegrationTest.java │ └── testing │ └── SharedClusterSidecarIntegrationTestBase.java ├── scripts ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── build-dtest-jars.sh ├── build-shaded-dtest-jar-local.sh ├── functions.sh ├── install-shaded-dtest-jar-local.sh ├── mvnw └── relocate-dtest-dependencies.pom ├── server-common ├── build.gradle └── src │ ├── main │ └── java │ │ ├── com │ │ └── datastax │ │ │ └── driver │ │ │ └── core │ │ │ └── DriverUtils.java │ │ └── org │ │ └── apache │ │ └── cassandra │ │ └── sidecar │ │ ├── common │ │ └── server │ │ │ ├── CQLSessionProvider.java │ │ │ ├── ClusterMembershipOperations.java │ │ │ ├── ICassandraAdapter.java │ │ │ ├── ICassandraFactory.java │ │ │ ├── JmxClient.java │ │ │ ├── MetricsOperations.java │ │ │ ├── MinimumVersion.java │ │ │ ├── StorageOperations.java │ │ │ ├── TableOperations.java │ │ │ ├── ThrowingRunnable.java │ │ │ ├── cluster │ │ │ └── locator │ │ │ │ ├── Partitioner.java │ │ │ │ ├── Partitioners.java │ │ │ │ ├── Token.java │ │ │ │ ├── TokenRange.java │ │ │ │ └── TokenRangeReplicas.java │ │ │ ├── data │ │ │ ├── Name.java │ │ │ ├── QualifiedTableName.java │ │ │ └── RestoreRangeStatus.java │ │ │ ├── dns │ │ │ └── DnsResolver.java │ │ │ ├── exceptions │ │ │ ├── JmxAuthenticationException.java │ │ │ ├── NodeBootstrappingException.java │ │ │ ├── OperationalJobException.java │ │ │ └── SnapshotAlreadyExistsException.java │ │ │ └── utils │ │ │ ├── ByteUtils.java │ │ │ ├── DriverUtils.java │ │ │ ├── DurationSpec.java │ │ │ ├── GossipInfoParser.java │ │ │ ├── IOUtils.java │ │ │ ├── MillisecondBoundConfiguration.java │ │ │ ├── MinuteBoundConfiguration.java │ │ │ ├── SecondBoundConfiguration.java │ │ │ ├── SidecarVersionProvider.java │ │ │ ├── StringUtils.java │ │ │ └── ThrowableUtils.java │ │ ├── db │ │ ├── DataObjectMappingException.java │ │ ├── DatabaseAccessor.java │ │ └── schema │ │ │ ├── AbstractSchema.java │ │ │ ├── CassandraSystemTableSchema.java │ │ │ └── TableSchema.java │ │ └── exceptions │ │ ├── CassandraUnavailableException.java │ │ ├── SchemaUnavailableException.java │ │ └── SidecarSchemaModificationException.java │ ├── test │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── cassandra │ │ │ └── sidecar │ │ │ └── common │ │ │ └── server │ │ │ ├── JmxClientTest.java │ │ │ ├── cluster │ │ │ └── locator │ │ │ │ ├── PartitionersTest.java │ │ │ │ ├── TokenRangeReplicasTest.java │ │ │ │ ├── TokenRangeTest.java │ │ │ │ └── TokenTest.java │ │ │ ├── data │ │ │ ├── NameTest.java │ │ │ └── RestoreRangeStatusTest.java │ │ │ └── utils │ │ │ ├── ByteUtilsTest.java │ │ │ ├── GossipInfoParserTest.java │ │ │ ├── StringUtilsTest.java │ │ │ └── ThrowableUtilsTest.java │ └── resources │ │ └── testJmxPassword.properties │ └── testFixtures │ └── java │ └── org │ └── apache │ └── cassandra │ └── sidecar │ └── common │ ├── MockCassandraFactory.java │ └── ResourceUtils.java ├── server ├── build.gradle └── src │ ├── main │ ├── java │ │ ├── com │ │ │ └── google │ │ │ │ └── common │ │ │ │ └── util │ │ │ │ └── concurrent │ │ │ │ └── SidecarRateLimiter.java │ │ └── org │ │ │ └── apache │ │ │ └── cassandra │ │ │ └── sidecar │ │ │ ├── CassandraSidecarDaemon.java │ │ │ ├── acl │ │ │ ├── AdminIdentityResolver.java │ │ │ ├── AuthCache.java │ │ │ ├── IdentityToRoleCache.java │ │ │ ├── authentication │ │ │ │ ├── AuthenticationHandlerFactory.java │ │ │ │ ├── AuthenticationHandlerFactoryRegistry.java │ │ │ │ ├── CassandraIdentityExtractor.java │ │ │ │ ├── JwtAuthenticationHandlerFactory.java │ │ │ │ ├── JwtParameterExtractor.java │ │ │ │ ├── JwtParameters.java │ │ │ │ ├── JwtRoleProcessor.java │ │ │ │ ├── JwtRoleProcessorImpl.java │ │ │ │ ├── MutualTlsAuthenticationHandler.java │ │ │ │ ├── MutualTlsAuthenticationHandlerFactory.java │ │ │ │ └── ReloadingJwtAuthenticationHandler.java │ │ │ └── authorization │ │ │ │ ├── AllowAllAuthorizationProvider.java │ │ │ │ ├── AuthorizationParameterValidateHandler.java │ │ │ │ ├── AuthorizationWithAdminBypassHandler.java │ │ │ │ ├── BasicPermissions.java │ │ │ │ ├── CassandraPermissions.java │ │ │ │ ├── CompositePermission.java │ │ │ │ ├── DataResourceScope.java │ │ │ │ ├── DomainAwarePermission.java │ │ │ │ ├── FeaturePermission.java │ │ │ │ ├── Permission.java │ │ │ │ ├── PermissionFactory.java │ │ │ │ ├── PermissionFactoryImpl.java │ │ │ │ ├── ResourceScope.java │ │ │ │ ├── ResourceScopes.java │ │ │ │ ├── RoleAuthorizationsCache.java │ │ │ │ ├── RoleBasedAuthorizationProvider.java │ │ │ │ ├── StandardPermission.java │ │ │ │ └── SuperUserCache.java │ │ │ ├── cdc │ │ │ ├── CdcConfig.java │ │ │ ├── CdcConfigImpl.java │ │ │ └── CdcLogCache.java │ │ │ ├── cluster │ │ │ ├── CQLSessionProviderImpl.java │ │ │ ├── CassandraAdapterDelegate.java │ │ │ ├── ConsistencyVerifier.java │ │ │ ├── ConsistencyVerifiers.java │ │ │ ├── InstancesMetadata.java │ │ │ ├── InstancesMetadataImpl.java │ │ │ ├── driver │ │ │ │ └── SidecarLoadBalancingPolicy.java │ │ │ ├── instance │ │ │ │ ├── InstanceMetadata.java │ │ │ │ └── InstanceMetadataImpl.java │ │ │ └── locator │ │ │ │ ├── CachedLocalTokenRanges.java │ │ │ │ ├── InstanceSetByDc.java │ │ │ │ └── LocalTokenRangesProvider.java │ │ │ ├── codecs │ │ │ └── SidecarInstanceCodec.java │ │ │ ├── concurrent │ │ │ ├── ConcurrencyLimiter.java │ │ │ ├── ExecutorPools.java │ │ │ └── TaskExecutorPool.java │ │ │ ├── config │ │ │ ├── AccessControlConfiguration.java │ │ │ ├── CacheConfiguration.java │ │ │ ├── CassandraInputValidationConfiguration.java │ │ │ ├── CdcConfiguration.java │ │ │ ├── ClusterLeaseClaimConfiguration.java │ │ │ ├── CoordinationConfiguration.java │ │ │ ├── DriverConfiguration.java │ │ │ ├── FileSystemOptionsConfiguration.java │ │ │ ├── InstanceConfiguration.java │ │ │ ├── JmxConfiguration.java │ │ │ ├── KeyStoreConfiguration.java │ │ │ ├── MetricsConfiguration.java │ │ │ ├── MetricsFilteringConfiguration.java │ │ │ ├── ParameterizedClassConfiguration.java │ │ │ ├── PeriodicTaskConfiguration.java │ │ │ ├── RandomInitialDelayDelta.java │ │ │ ├── RestoreJobConfiguration.java │ │ │ ├── S3ClientConfiguration.java │ │ │ ├── S3ProxyConfiguration.java │ │ │ ├── SSTableImportConfiguration.java │ │ │ ├── SSTableSnapshotConfiguration.java │ │ │ ├── SSTableUploadConfiguration.java │ │ │ ├── SchemaKeyspaceConfiguration.java │ │ │ ├── SchemaReportingConfiguration.java │ │ │ ├── ServiceConfiguration.java │ │ │ ├── SidecarClientConfiguration.java │ │ │ ├── SidecarConfiguration.java │ │ │ ├── SidecarPeerHealthConfiguration.java │ │ │ ├── SslConfiguration.java │ │ │ ├── ThrottleConfiguration.java │ │ │ ├── TrafficShapingConfiguration.java │ │ │ ├── VertxConfiguration.java │ │ │ ├── VertxMetricsConfiguration.java │ │ │ ├── WorkerPoolConfiguration.java │ │ │ └── yaml │ │ │ │ ├── AccessControlConfigurationImpl.java │ │ │ │ ├── CacheConfigurationImpl.java │ │ │ │ ├── CassandraInputValidationConfigurationImpl.java │ │ │ │ ├── CdcConfigurationImpl.java │ │ │ │ ├── ClusterLeaseClaimConfigurationImpl.java │ │ │ │ ├── CoordinationConfigurationImpl.java │ │ │ │ ├── DriverConfigurationImpl.java │ │ │ │ ├── FileSystemOptionsConfigurationImpl.java │ │ │ │ ├── InstanceConfigurationImpl.java │ │ │ │ ├── JmxConfigurationImpl.java │ │ │ │ ├── KeyStoreConfigurationImpl.java │ │ │ │ ├── MetricsConfigurationImpl.java │ │ │ │ ├── MetricsFilteringConfigurationImpl.java │ │ │ │ ├── ParameterizedClassConfigurationImpl.java │ │ │ │ ├── PeriodicTaskConfigurationImpl.java │ │ │ │ ├── RestoreJobConfigurationImpl.java │ │ │ │ ├── S3ClientConfigurationImpl.java │ │ │ │ ├── S3ProxyConfigurationImpl.java │ │ │ │ ├── SSTableImportConfigurationImpl.java │ │ │ │ ├── SSTableSnapshotConfigurationImpl.java │ │ │ │ ├── SSTableUploadConfigurationImpl.java │ │ │ │ ├── SchemaKeyspaceConfigurationImpl.java │ │ │ │ ├── SchemaReportingConfigurationImpl.java │ │ │ │ ├── ServiceConfigurationImpl.java │ │ │ │ ├── SidecarClientConfigurationImpl.java │ │ │ │ ├── SidecarConfigurationImpl.java │ │ │ │ ├── SidecarPeerHealthConfigurationImpl.java │ │ │ │ ├── SslConfigurationImpl.java │ │ │ │ ├── ThrottleConfigurationImpl.java │ │ │ │ ├── TrafficShapingConfigurationImpl.java │ │ │ │ ├── VertxConfigurationImpl.java │ │ │ │ ├── VertxMetricsConfigurationImpl.java │ │ │ │ └── WorkerPoolConfigurationImpl.java │ │ │ ├── coordination │ │ │ ├── AbstractTokenZeroOfKeyspaceElectorateMembership.java │ │ │ ├── CassandraClientTokenRingProvider.java │ │ │ ├── ClusterLease.java │ │ │ ├── ClusterLeaseClaimTask.java │ │ │ ├── DynamicSidecarInstancesProvider.java │ │ │ ├── ElectorateMembership.java │ │ │ ├── ExecuteOnClusterLeaseholderOnly.java │ │ │ ├── InnerDcTokenAdjacentPeerProvider.java │ │ │ ├── MostReplicatedKeyspaceTokenZeroElectorateMembership.java │ │ │ ├── SidecarHttpHealthProvider.java │ │ │ ├── SidecarInternalTokenZeroElectorateMembership.java │ │ │ ├── SidecarPeerHealthMonitorTask.java │ │ │ ├── SidecarPeerHealthProvider.java │ │ │ ├── SidecarPeerProvider.java │ │ │ └── TokenRingProvider.java │ │ │ ├── datahub │ │ │ ├── ClusterToAspectConverter.java │ │ │ ├── ClusterToDataPlatformInfoConverter.java │ │ │ ├── ClusterToDataPlatformInstancePropertiesConverter.java │ │ │ ├── EmitterFactory.java │ │ │ ├── HttpEmitter.java │ │ │ ├── IdentifiersProvider.java │ │ │ ├── JsonEmitter.java │ │ │ ├── KeyspaceToAspectConverter.java │ │ │ ├── KeyspaceToBrowsePathsV2Converter.java │ │ │ ├── KeyspaceToContainerPropertiesConverter.java │ │ │ ├── KeyspaceToDataPlatformInstanceConverter.java │ │ │ ├── KeyspaceToSubTypesConverter.java │ │ │ ├── MetadataToAspectConverter.java │ │ │ ├── SchemaReporter.java │ │ │ ├── SchemaReportingTask.java │ │ │ ├── TableToAspectConverter.java │ │ │ ├── TableToBrowsePathsConverter.java │ │ │ ├── TableToBrowsePathsV2Converter.java │ │ │ ├── TableToContainerConverter.java │ │ │ ├── TableToDataPlatformInstanceConverter.java │ │ │ ├── TableToDatasetPropertiesConverter.java │ │ │ ├── TableToSchemaMetadataConverter.java │ │ │ └── TableToSubTypesConverter.java │ │ │ ├── db │ │ │ ├── CdcConfigAccessor.java │ │ │ ├── ConfigAccessor.java │ │ │ ├── ConfigAccessorFactory.java │ │ │ ├── ConfigAccessorImpl.java │ │ │ ├── KafkaConfigAccessor.java │ │ │ ├── RestoreJob.java │ │ │ ├── RestoreJobDatabaseAccessor.java │ │ │ ├── RestoreRange.java │ │ │ ├── RestoreRangeDatabaseAccessor.java │ │ │ ├── RestoreSlice.java │ │ │ ├── RestoreSliceDatabaseAccessor.java │ │ │ ├── ServiceConfig.java │ │ │ ├── SidecarLeaseDatabaseAccessor.java │ │ │ ├── SidecarPermissionsDatabaseAccessor.java │ │ │ ├── SystemAuthDatabaseAccessor.java │ │ │ ├── SystemViewsDatabaseAccessor.java │ │ │ └── schema │ │ │ │ ├── ConfigsSchema.java │ │ │ │ ├── RestoreJobsSchema.java │ │ │ │ ├── RestoreRangesSchema.java │ │ │ │ ├── RestoreSlicesSchema.java │ │ │ │ ├── SidecarInternalKeyspace.java │ │ │ │ ├── SidecarLeaseSchema.java │ │ │ │ ├── SidecarRolePermissionsSchema.java │ │ │ │ ├── SidecarSchema.java │ │ │ │ ├── SidecarSchemaInitializer.java │ │ │ │ ├── SystemAuthSchema.java │ │ │ │ └── SystemViewsSchema.java │ │ │ ├── exceptions │ │ │ ├── ConfigurationException.java │ │ │ ├── InsufficientStorageException.java │ │ │ ├── NoSuchCassandraInstanceException.java │ │ │ ├── OperationalJobConflictException.java │ │ │ ├── RestoreJobException.java │ │ │ ├── RestoreJobExceptions.java │ │ │ └── RestoreJobFatalException.java │ │ │ ├── handlers │ │ │ ├── AbstractHandler.java │ │ │ ├── AccessProtected.java │ │ │ ├── CassandraHealthHandler.java │ │ │ ├── ConnectedClientStatsHandler.java │ │ │ ├── DiskSpaceProtectionHandler.java │ │ │ ├── FileStreamHandler.java │ │ │ ├── GossipHealthHandler.java │ │ │ ├── GossipInfoHandler.java │ │ │ ├── JsonErrorHandler.java │ │ │ ├── KeyspaceRingHandler.java │ │ │ ├── KeyspaceSchemaHandler.java │ │ │ ├── ListOperationalJobsHandler.java │ │ │ ├── NodeDecommissionHandler.java │ │ │ ├── OperationalJobHandler.java │ │ │ ├── ReportSchemaHandler.java │ │ │ ├── RingHandler.java │ │ │ ├── SchemaHandler.java │ │ │ ├── StreamSSTableComponentHandler.java │ │ │ ├── StreamStatsHandler.java │ │ │ ├── TableStatsHandler.java │ │ │ ├── TimeSkewHandler.java │ │ │ ├── TokenRangeReplicaMapHandler.java │ │ │ ├── cassandra │ │ │ │ └── NodeSettingsHandler.java │ │ │ ├── cdc │ │ │ │ ├── AllServiceConfigHandler.java │ │ │ │ ├── ConfigPayloadParams.java │ │ │ │ ├── DeleteServiceConfigHandler.java │ │ │ │ ├── ListCdcDirHandler.java │ │ │ │ ├── ServiceConfigValidator.java │ │ │ │ ├── StreamCdcSegmentHandler.java │ │ │ │ └── UpdateServiceConfigHandler.java │ │ │ ├── data │ │ │ │ ├── SSTableImportRequestParam.java │ │ │ │ ├── SSTableUploadRequestParam.java │ │ │ │ ├── SSTableUploads.java │ │ │ │ ├── SnapshotRequestParam.java │ │ │ │ └── StreamSSTableComponentRequestParam.java │ │ │ ├── restore │ │ │ │ ├── AbortRestoreJobHandler.java │ │ │ │ ├── CreateRestoreJobHandler.java │ │ │ │ ├── CreateRestoreSliceHandler.java │ │ │ │ ├── RestoreJobProgressHandler.java │ │ │ │ ├── RestoreJobSummaryHandler.java │ │ │ │ ├── RestoreRequestValidationHandler.java │ │ │ │ └── UpdateRestoreJobHandler.java │ │ │ ├── snapshots │ │ │ │ ├── ClearSnapshotHandler.java │ │ │ │ ├── CreateSnapshotHandler.java │ │ │ │ └── ListSnapshotHandler.java │ │ │ ├── sstableuploads │ │ │ │ ├── SSTableCleanupHandler.java │ │ │ │ ├── SSTableImportHandler.java │ │ │ │ └── SSTableUploadHandler.java │ │ │ └── validations │ │ │ │ └── ValidateTableExistenceHandler.java │ │ │ ├── job │ │ │ ├── NodeDecommissionJob.java │ │ │ ├── OperationalJob.java │ │ │ ├── OperationalJobManager.java │ │ │ └── OperationalJobTracker.java │ │ │ ├── logging │ │ │ └── SidecarLoggerHandler.java │ │ │ ├── metrics │ │ │ ├── CacheStatsCounter.java │ │ │ ├── DeltaGauge.java │ │ │ ├── FilteringMetricRegistry.java │ │ │ ├── MetricFilter.java │ │ │ ├── MetricRegistryFactory.java │ │ │ ├── NamedMetric.java │ │ │ ├── SidecarMetrics.java │ │ │ ├── SidecarMetricsImpl.java │ │ │ ├── StopWatch.java │ │ │ ├── instance │ │ │ │ ├── InstanceHealthMetrics.java │ │ │ │ ├── InstanceMetrics.java │ │ │ │ ├── InstanceMetricsImpl.java │ │ │ │ ├── InstanceResourceMetrics.java │ │ │ │ ├── InstanceRestoreMetrics.java │ │ │ │ ├── SSTableImportMetrics.java │ │ │ │ ├── StreamSSTableMetrics.java │ │ │ │ └── UploadSSTableMetrics.java │ │ │ └── server │ │ │ │ ├── CacheMetrics.java │ │ │ │ ├── CdcMetrics.java │ │ │ │ ├── CoordinationMetrics.java │ │ │ │ ├── HealthMetrics.java │ │ │ │ ├── ResourceMetrics.java │ │ │ │ ├── RestoreMetrics.java │ │ │ │ ├── SchemaMetrics.java │ │ │ │ ├── SchemaReportingMetrics.java │ │ │ │ ├── ServerMetrics.java │ │ │ │ └── ServerMetricsImpl.java │ │ │ ├── models │ │ │ └── HttpResponse.java │ │ │ ├── modules │ │ │ ├── ApiModule.java │ │ │ ├── AuthModule.java │ │ │ ├── CassandraOperationsModule.java │ │ │ ├── CdcModule.java │ │ │ ├── ConfigurationModule.java │ │ │ ├── CoordinationModule.java │ │ │ ├── ElectorateMembershipFactory.java │ │ │ ├── HealthCheckModule.java │ │ │ ├── RestoreJobModule.java │ │ │ ├── SSTablesAccessModule.java │ │ │ ├── SchedulingModule.java │ │ │ ├── SchemaReportingModule.java │ │ │ ├── SidecarModules.java │ │ │ ├── SidecarSchemaModule.java │ │ │ ├── TelemetryModule.java │ │ │ ├── UtilitiesModule.java │ │ │ ├── guice-best-practice.md │ │ │ └── multibindings │ │ │ │ ├── ClassKey.java │ │ │ │ ├── IdentityMultiBindingTypeResolver.java │ │ │ │ ├── KeyClassMapKey.java │ │ │ │ ├── MultiBindingTypeResolver.java │ │ │ │ ├── MultiBindingTypeResolverModule.java │ │ │ │ ├── MultiBindingUtils.java │ │ │ │ ├── PeriodicTaskMapKeys.java │ │ │ │ ├── RouteClassKey.java │ │ │ │ ├── TableSchemaMapKeys.java │ │ │ │ └── VertxRouteMapKeys.java │ │ │ ├── restore │ │ │ ├── HttpRangesIterator.java │ │ │ ├── RestoreJobConsistencyChecker.java │ │ │ ├── RestoreJobDiscoverer.java │ │ │ ├── RestoreJobManager.java │ │ │ ├── RestoreJobManagerGroup.java │ │ │ ├── RestoreJobProgress.java │ │ │ ├── RestoreJobProgressCollector.java │ │ │ ├── RestoreJobProgressCollectors.java │ │ │ ├── RestoreJobProgressTracker.java │ │ │ ├── RestoreJobUtil.java │ │ │ ├── RestoreProcessor.java │ │ │ ├── RestoreRangeHandler.java │ │ │ ├── RestoreRangeTask.java │ │ │ ├── RestoreSliceManifest.java │ │ │ ├── RingTopologyChangeListener.java │ │ │ ├── RingTopologyRefresher.java │ │ │ ├── StorageClient.java │ │ │ └── StorageClientPool.java │ │ │ ├── routes │ │ │ ├── RouteBuilder.java │ │ │ ├── RoutingContextUtils.java │ │ │ ├── RoutingOrder.java │ │ │ ├── SettableVertxRoute.java │ │ │ └── VertxRoute.java │ │ │ ├── server │ │ │ ├── HttpServerOptionsProvider.java │ │ │ ├── Server.java │ │ │ ├── ServerVerticle.java │ │ │ └── SidecarServerEvents.java │ │ │ ├── snapshots │ │ │ └── SnapshotPathBuilder.java │ │ │ ├── tasks │ │ │ ├── CdcRawDirectorySpaceCleaner.java │ │ │ ├── HealthCheckPeriodicTask.java │ │ │ ├── KeyStoreCheckPeriodicTask.java │ │ │ ├── PeriodicTask.java │ │ │ ├── PeriodicTaskExecutor.java │ │ │ ├── ScheduleDecision.java │ │ │ └── Task.java │ │ │ └── utils │ │ │ ├── AsyncFileDigestVerifier.java │ │ │ ├── AsyncFileSystemUtils.java │ │ │ ├── AuthUtils.java │ │ │ ├── BaseFileSystem.java │ │ │ ├── CacheFactory.java │ │ │ ├── CassandraInputValidator.java │ │ │ ├── CassandraVersionProvider.java │ │ │ ├── CdcUtil.java │ │ │ ├── DigestAlgorithm.java │ │ │ ├── DigestAlgorithmProvider.java │ │ │ ├── DigestVerifier.java │ │ │ ├── DigestVerifierFactory.java │ │ │ ├── EventBusUtils.java │ │ │ ├── FileStreamer.java │ │ │ ├── FileUtils.java │ │ │ ├── HttpExceptions.java │ │ │ ├── InstanceMetadataFetcher.java │ │ │ ├── JdkMd5DigestProvider.java │ │ │ ├── MD5DigestVerifier.java │ │ │ ├── MetadataUtils.java │ │ │ ├── MetricUtils.java │ │ │ ├── OperationalJobUtils.java │ │ │ ├── RequestUtils.java │ │ │ ├── SSTableImporter.java │ │ │ ├── SSTableUploader.java │ │ │ ├── SSTableUploadsPathBuilder.java │ │ │ ├── SidecarClientProvider.java │ │ │ ├── SimpleCassandraVersion.java │ │ │ ├── SslUtils.java │ │ │ ├── TimeProvider.java │ │ │ ├── TimeSkewInfo.java │ │ │ ├── XXHash32DigestVerifier.java │ │ │ └── XXHash32Provider.java │ └── resources │ │ └── docs │ │ └── index.html │ ├── test │ ├── containerTest │ │ └── org │ │ │ └── apache │ │ │ └── cassandra │ │ │ └── sidecar │ │ │ └── restore │ │ │ └── StorageClientTest.java │ ├── integration │ │ └── org │ │ │ └── apache │ │ │ └── cassandra │ │ │ ├── distributed │ │ │ └── impl │ │ │ │ └── AbstractClusterUtils.java │ │ │ ├── sidecar │ │ │ ├── acl │ │ │ │ ├── MutualTLSAuthenticationIntegrationTest.java │ │ │ │ └── RoleBasedAuthorizationIntegrationTest.java │ │ │ ├── cluster │ │ │ │ ├── driver │ │ │ │ │ └── SidecarLoadBalancingPolicyTest.java │ │ │ │ └── locator │ │ │ │ │ └── CqlSessionProviderIntegrationTest.java │ │ │ ├── common │ │ │ │ ├── CQLSessionProviderTest.java │ │ │ │ ├── DelegateIntegrationTest.java │ │ │ │ └── JmxClientIntegrationTest.java │ │ │ ├── coordination │ │ │ │ ├── ClusterLeaseClaimTaskIntegrationTest.java │ │ │ │ └── MostReplicatedKeyspaceTokenZeroElectorateMembershipIntegrationTest.java │ │ │ ├── datahub │ │ │ │ └── SchemaReporterIntegrationTest.java │ │ │ ├── db │ │ │ │ ├── RestoreJobDatabaseAccessorIntTest.java │ │ │ │ ├── RestoreRangeDatabaseAccessorIntTest.java │ │ │ │ ├── RestoreSliceDatabaseAccessorIntTest.java │ │ │ │ ├── SidecarSchemaIntTest.java │ │ │ │ └── SystemViewsDatabaseAccessorIntTest.java │ │ │ ├── restore │ │ │ │ ├── RestoreJobTestUtils.java │ │ │ │ └── jobdiscoverer │ │ │ │ │ ├── RestoreJobDiscovererNodeJoinedIntTest.java │ │ │ │ │ ├── RestoreJobDiscovererNodeJoiningIntTest.java │ │ │ │ │ ├── RestoreJobDiscovererNodeLeavingIntTest.java │ │ │ │ │ ├── RestoreJobDiscovererNodeLeftIntTest.java │ │ │ │ │ ├── RestoreJobDiscovererNodeMovedIntTest.java │ │ │ │ │ └── RestoreJobDiscovererNodeMovingIntTest.java │ │ │ ├── routes │ │ │ │ ├── NodeDecommissionIntegrationTest.java │ │ │ │ ├── RingHandlerIntegrationTest.java │ │ │ │ ├── StreamSSTableComponentHandlerIntegrationTest.java │ │ │ │ ├── StreamStatsIntegrationTest.java │ │ │ │ ├── snapshots │ │ │ │ │ ├── ClearSnapshotHandlerIntegrationTest.java │ │ │ │ │ ├── CreateSnapshotHandlerIntegrationTest.java │ │ │ │ │ └── ListSnapshotHandlerIntegrationTest.java │ │ │ │ ├── sstableuploads │ │ │ │ │ └── SSTableImportHandlerIntegrationTest.java │ │ │ │ └── tokenrange │ │ │ │ │ ├── BaseTokenRangeIntegrationTest.java │ │ │ │ │ ├── BasicGossipDisabledTest.java │ │ │ │ │ ├── BasicMultiDCRf3Test.java │ │ │ │ │ ├── BasicMultiDCSingleReplicatedTest.java │ │ │ │ │ ├── BasicRf1Test.java │ │ │ │ │ ├── BasicRf3Test.java │ │ │ │ │ ├── BasicUnknownKeyspaceTest.java │ │ │ │ │ ├── JoiningBaseTest.java │ │ │ │ │ ├── JoiningTest.java │ │ │ │ │ ├── JoiningTestDoubleCluster.java │ │ │ │ │ ├── JoiningTestMultiDC.java │ │ │ │ │ ├── JoiningTestMultiDCSingleReplicated.java │ │ │ │ │ ├── JoiningTestMultipleNodes.java │ │ │ │ │ ├── JoiningTestSingleNode.java │ │ │ │ │ ├── LeavingBaseTest.java │ │ │ │ │ ├── LeavingTest.java │ │ │ │ │ ├── LeavingTestMultiDC.java │ │ │ │ │ ├── LeavingTestMultiDCHalveCluster.java │ │ │ │ │ ├── MovingBaseTest.java │ │ │ │ │ ├── MovingMultiDCTest.java │ │ │ │ │ ├── MovingTest.java │ │ │ │ │ ├── ReplacementBaseTest.java │ │ │ │ │ ├── ReplacementMultiDCTest.java │ │ │ │ │ └── ReplacementTest.java │ │ │ └── testing │ │ │ │ ├── BootstrapBBUtils.java │ │ │ │ ├── CassandraSidecarTestContext.java │ │ │ │ ├── IntegrationTestBase.java │ │ │ │ ├── IntegrationTestModule.java │ │ │ │ ├── SharedExecutorNettyOptions.java │ │ │ │ ├── TestTokenSupplier.java │ │ │ │ └── bytebuddy │ │ │ │ ├── BBHelperJoiningNode.java │ │ │ │ ├── BBHelperLeavingNode.java │ │ │ │ └── BBHelperMovingNode.java │ │ │ └── testing │ │ │ ├── AbstractCassandraTestContext.java │ │ │ ├── AuthMode.java │ │ │ ├── CassandraIntegrationTest.java │ │ │ ├── CassandraTestContext.java │ │ │ ├── CassandraTestTemplate.java │ │ │ ├── ConfigurableCassandraTestContext.java │ │ │ ├── SimpleCassandraVersion.java │ │ │ ├── TestVersion.java │ │ │ └── TestVersionSupplier.java │ ├── java │ │ ├── com │ │ │ └── google │ │ │ │ └── common │ │ │ │ └── util │ │ │ │ └── concurrent │ │ │ │ └── SidecarRateLimiterTest.java │ │ └── org │ │ │ └── apache │ │ │ └── cassandra │ │ │ └── sidecar │ │ │ ├── AbstractHealthServiceTest.java │ │ │ ├── CassandraSidecarDaemonTest.java │ │ │ ├── ExecutorPoolsHelper.java │ │ │ ├── HealthServiceSslTest.java │ │ │ ├── HealthServiceTest.java │ │ │ ├── LoggerHandlerInjectionTest.java │ │ │ ├── MultibindingsMapKeyTestUtil.java │ │ │ ├── TestCassandraAdapterDelegate.java │ │ │ ├── TestModule.java │ │ │ ├── TestResourceReaper.java │ │ │ ├── TestSslModule.java │ │ │ ├── ThrottleTest.java │ │ │ ├── acl │ │ │ ├── CassandraIdentityExtractorTest.java │ │ │ ├── IdentityToRoleCacheTest.java │ │ │ ├── RoleAuthorizationsCacheTest.java │ │ │ ├── authentication │ │ │ │ ├── AuthenticationHandlerFactoryRegistryTest.java │ │ │ │ ├── JWTAuthenticationHandlerFactoryTest.java │ │ │ │ ├── JwtParameterExtractorTest.java │ │ │ │ ├── JwtRoleProcessorTest.java │ │ │ │ ├── MutualTLSAuthenticationHandlerTest.java │ │ │ │ ├── MutualTlsAuthenticationHandlerFactoryTest.java │ │ │ │ └── ReloadingJwtAuthenticationHandlerTest.java │ │ │ └── authorization │ │ │ │ ├── AdminIdentityResolverTest.java │ │ │ │ ├── AllowAllAuthorizationTest.java │ │ │ │ ├── CompositePermissionTest.java │ │ │ │ ├── FeaturePermissionTest.java │ │ │ │ ├── PermissionFactoryTest.java │ │ │ │ ├── PermissionTest.java │ │ │ │ ├── ResourceScopeTest.java │ │ │ │ ├── RoleBasedAuthorizationProviderTest.java │ │ │ │ └── SuperUserCacheTest.java │ │ │ ├── cdc │ │ │ ├── CDCLogCacheTest.java │ │ │ └── CdcConfigImplTest.java │ │ │ ├── cluster │ │ │ ├── CassandraClientTokenRingProviderTest.java │ │ │ ├── ConsistencyVerifiersTest.java │ │ │ ├── InstancesMetadataImplTest.java │ │ │ ├── instance │ │ │ │ └── InstanceMetadataImplTest.java │ │ │ └── locator │ │ │ │ └── InstanceSetByDcTest.java │ │ │ ├── codecs │ │ │ └── SidecarInstanceCodecTest.java │ │ │ ├── concurrent │ │ │ ├── ConcurrencyLimiterTest.java │ │ │ └── ExecutorPoolsTest.java │ │ │ ├── config │ │ │ ├── SidecarConfigurationTest.java │ │ │ └── yaml │ │ │ │ ├── InstanceConfigurationImplTest.java │ │ │ │ ├── SSTableUploadConfigurationImplTest.java │ │ │ │ ├── SslConfigurationImplTest.java │ │ │ │ ├── TimeBoundConfigurationImplTest.java │ │ │ │ └── TimeUnitBackwardsCompatibilityTest.java │ │ │ ├── coordination │ │ │ ├── ClusterLeaseClaimTaskTest.java │ │ │ ├── InnerDcTokenAdjacentPeerProviderTests.java │ │ │ └── MostReplicatedKeyspaceTokenZeroElectorateMembershipTest.java │ │ │ ├── data │ │ │ ├── SnapshotRequestParamTest.java │ │ │ └── StreamSSTableComponentRequestParamTest.java │ │ │ ├── datahub │ │ │ ├── IdentifiersProviderTest.java │ │ │ ├── SchemaReporterTest.java │ │ │ └── TestIdentifiers.java │ │ │ ├── db │ │ │ ├── BasicPermissionsDatabaseAccessorTest.java │ │ │ ├── ConfigAccessorImplTest.java │ │ │ ├── RestoreJobDatabaseAccessorTest.java │ │ │ ├── RestoreJobTest.java │ │ │ ├── RestoreSliceTest.java │ │ │ ├── SidecarSchemaTest.java │ │ │ ├── SystemAuthDatabaseAccessorTest.java │ │ │ └── SystemAuthSchemaTest.java │ │ │ ├── exceptions │ │ │ └── RestoreJobExceptionsTest.java │ │ │ ├── handlers │ │ │ ├── AbstractHandlerTest.java │ │ │ ├── CommonTest.java │ │ │ ├── ConnectedClientStatsHandlerTest.java │ │ │ ├── ExtractHostAddressWithoutPortTest.java │ │ │ ├── FileStreamHandlerTest.java │ │ │ ├── GossipHealthHandlerTest.java │ │ │ ├── GossipInfoHandlerTest.java │ │ │ ├── JsonErrorHandlerTest.java │ │ │ ├── ListOperationalJobsHandlerTest.java │ │ │ ├── NodeDecommissionHandlerTest.java │ │ │ ├── OperationalJobHandlerTest.java │ │ │ ├── ReportSchemaHandlerTest.java │ │ │ ├── RingHandlerTest.java │ │ │ ├── RouteBuilderTest.java │ │ │ ├── SchemaHandlerTest.java │ │ │ ├── StreamSSTableComponentHandlerTest.java │ │ │ ├── StreamStatsHandlerTest.java │ │ │ ├── TableStatsHandlerTest.java │ │ │ ├── TimeSkewInfoHandlerTest.java │ │ │ ├── VertxRoutingTest.java │ │ │ ├── cassandra │ │ │ │ └── NodeSettingsHandlerTest.java │ │ │ ├── cdc │ │ │ │ ├── ListCdcDirHandlerTest.java │ │ │ │ └── StreamCdcSegmentHandlerTest.java │ │ │ ├── restore │ │ │ │ ├── AbortRestoreJobHandlerTest.java │ │ │ │ ├── BaseRestoreJobTests.java │ │ │ │ ├── CreateRestoreJobHandlerTest.java │ │ │ │ ├── CreateRestoreSliceHandlerTest.java │ │ │ │ ├── RestoreJobProgressHandlerTest.java │ │ │ │ ├── RestoreJobSummaryHandlerTest.java │ │ │ │ └── UpdateRestoreJobHandlerTest.java │ │ │ ├── snapshots │ │ │ │ └── ListSnapshotHandlerTest.java │ │ │ └── sstableuploads │ │ │ │ ├── BaseUploadsHandlerTest.java │ │ │ │ ├── SSTableCleanupHandlerTest.java │ │ │ │ ├── SSTableImportHandlerTest.java │ │ │ │ └── SSTableUploadHandlerTest.java │ │ │ ├── job │ │ │ ├── OperationalJobManagerTest.java │ │ │ ├── OperationalJobTest.java │ │ │ └── OperationalJobTrackerTest.java │ │ │ ├── metrics │ │ │ ├── CacheStatsCounterTest.java │ │ │ ├── DeltaGaugeTest.java │ │ │ ├── FilteringMetricRegistryTest.java │ │ │ ├── InstanceHealthMetricsTest.java │ │ │ ├── NamedMetricTest.java │ │ │ └── SchemaMetricsTest.java │ │ │ ├── mocks │ │ │ ├── V30.java │ │ │ ├── V40.java │ │ │ └── V41.java │ │ │ ├── modules │ │ │ ├── ElectorateMembershipFactoryTest.java │ │ │ └── multibindings │ │ │ │ └── RouteClassKeyTest.java │ │ │ ├── restore │ │ │ ├── BaseRestoreJobProgressCollectorTest.java │ │ │ ├── HttpRangesIteratorTest.java │ │ │ ├── RestoreJobConsistencyCheckerTest.java │ │ │ ├── RestoreJobDiscovererTest.java │ │ │ ├── RestoreJobManagerTest.java │ │ │ ├── RestoreJobProgressCollectAllFailedAndPendingTest.java │ │ │ ├── RestoreJobProgressCollectAllTest.java │ │ │ ├── RestoreJobProgressCollectFirstFailedTest.java │ │ │ ├── RestoreJobUtilTest.java │ │ │ ├── RestoreProcessorTest.java │ │ │ ├── RestoreRangeTaskTest.java │ │ │ ├── RestoreRangeTest.java │ │ │ ├── RestoreSliceManifestTest.java │ │ │ ├── RingTopologyRefresherTest.java │ │ │ └── StorageClientPoolTest.java │ │ │ ├── server │ │ │ ├── ServerSSLTest.java │ │ │ ├── ServerTest.java │ │ │ └── SidecarModulesTest.java │ │ │ ├── snapshots │ │ │ ├── SnapshotPathBuilderTest.java │ │ │ └── SnapshotUtils.java │ │ │ ├── tasks │ │ │ ├── CdcRawDirectorySpaceCleanerTest.java │ │ │ ├── HealthCheckPeriodicTaskTest.java │ │ │ └── PeriodicTaskExecutorTest.java │ │ │ └── utils │ │ │ ├── AsyncFileSystemUtilsTest.java │ │ │ ├── AuthUtilsTest.java │ │ │ ├── CacheFactoryTest.java │ │ │ ├── CassandraInputValidatorTest.java │ │ │ ├── CdcUtilTest.java │ │ │ ├── DigestVerifierFactoryTest.java │ │ │ ├── EventBusUtilsTest.java │ │ │ ├── FileUtilsTest.java │ │ │ ├── InstanceMetadataFetcherTest.java │ │ │ ├── MD5DigestVerifierTest.java │ │ │ ├── MetricUtilsTest.java │ │ │ ├── RequestUtilsTest.java │ │ │ ├── SSTableImporterImportQueueTest.java │ │ │ ├── SSTableImporterOptionsTest.java │ │ │ ├── SSTableImporterTest.java │ │ │ ├── SidecarClientProviderTest.java │ │ │ ├── SimpleCassandraVersionProviderTest.java │ │ │ ├── SimpleCassandraVersionTest.java │ │ │ ├── TestFileUtils.java │ │ │ ├── TestMetricUtils.java │ │ │ ├── TimeSkewInfoTest.java │ │ │ └── XXHash32DigestVerifierTest.java │ └── resources │ │ ├── certs │ │ ├── ca.p12 │ │ ├── client_keystore.jks │ │ ├── client_keystore.p12 │ │ ├── expired_server_keystore.jks │ │ ├── expired_server_keystore.p12 │ │ ├── generate-certs.sh │ │ ├── generate-client-keystore.sh │ │ ├── generate-server-keystore.sh │ │ ├── server_keystore.jks │ │ ├── server_keystore.p12 │ │ ├── test.p12 │ │ ├── truststore.jks │ │ └── truststore.p12 │ │ ├── config │ │ ├── sidecar_cdc.yaml │ │ ├── sidecar_custom_allowable_time_skew.yaml │ │ ├── sidecar_driver_params.yaml │ │ ├── sidecar_file_permissions.yaml │ │ ├── sidecar_invalid_accesscontrol_config.yaml │ │ ├── sidecar_invalid_client_auth.yaml │ │ ├── sidecar_invalid_file_permissions.yaml │ │ ├── sidecar_invalid_metrics.yaml │ │ ├── sidecar_metrics.yaml │ │ ├── sidecar_metrics_empty_filters.yaml │ │ ├── sidecar_missing_jmx.yaml │ │ ├── sidecar_missing_sstable_snapshot.yaml │ │ ├── sidecar_multiple_instances.yaml │ │ ├── sidecar_no_local_instances.yaml │ │ ├── sidecar_schema_keyspace_configuration.yaml │ │ ├── sidecar_single_instance.yaml │ │ ├── sidecar_single_instance_non_zero_port.yaml │ │ ├── sidecar_ssl.yaml │ │ ├── sidecar_unrecognized_authenticator.yaml │ │ ├── sidecar_unrecognized_authorizer.yaml │ │ ├── sidecar_validation_configuration.yaml │ │ ├── sidecar_vertx_filesystem_options.yaml │ │ └── sidecar_with_single_multiple_instances.yaml │ │ ├── datahub │ │ ├── empty_cluster.json │ │ ├── empty_keyspace.json │ │ ├── empty_table.json │ │ ├── integration_test.json │ │ ├── primitive_types.json │ │ └── user_types.json │ │ ├── instance1 │ │ ├── cdc_raw │ │ │ ├── CommitLog-1-1.log │ │ │ ├── CommitLog-1-1_cdc.idx │ │ │ ├── CommitLog-1-2.log │ │ │ ├── CommitLog-1-2_cdc.idx │ │ │ └── CommitLog-1-3.log │ │ └── data │ │ │ └── TestKeyspace │ │ │ └── TestTable-54ea95cebba24e0aa9bee428e5d7160b │ │ │ └── snapshots │ │ │ └── TestSnapshot │ │ │ └── nb-1-big-Data.db │ │ ├── instance2 │ │ └── data │ │ │ └── TestKeyspace │ │ │ └── TestTable-54ea95cebba24e0aa9bee428e5d7160b │ │ │ └── snapshots │ │ │ └── TestSnapshot │ │ │ └── nb-1-big-Data.db │ │ ├── instance3 │ │ └── data │ │ │ └── TestKeyspace │ │ │ └── TestTable-54ea95cebba24e0aa9bee428e5d7160b │ │ │ └── snapshots │ │ │ └── TestSnapshot │ │ │ └── nb-1-big-Data.db │ │ ├── logback-in-jvm-dtest.xml │ │ ├── logback-test.xml │ │ ├── schema │ │ └── test_keyspace_schema.cql │ │ ├── sidecar.version │ │ ├── test_unzip.zip │ │ └── test_unzip_malformed.zip │ └── testFixtures │ └── java │ └── org │ └── apache │ └── cassandra │ └── sidecar │ ├── config │ └── yaml │ │ └── TestServiceConfiguration.java │ └── snapshots │ └── AbstractSnapshotPathBuilderTest.java ├── settings.gradle ├── spotbugs-exclude.xml ├── test-common ├── build.gradle └── src │ └── testFixtures │ └── java │ └── org │ └── apache │ └── cassandra │ └── testing │ └── utils │ ├── AssertionUtils.java │ └── tls │ ├── CertificateBuilder.java │ └── CertificateBundle.java ├── vertx-auth-mtls ├── build.gradle └── src │ ├── main │ └── java │ │ └── io │ │ └── vertx │ │ └── ext │ │ └── auth │ │ ├── authentication │ │ └── CertificateCredentials.java │ │ └── mtls │ │ ├── CertificateIdentityExtractor.java │ │ ├── CertificateValidator.java │ │ ├── MutualTlsAuthentication.java │ │ └── impl │ │ ├── AllowAllCertificateValidator.java │ │ ├── CertificateValidatorImpl.java │ │ ├── MutualTlsAuthenticationImpl.java │ │ ├── MutualTlsUser.java │ │ └── SpiffeIdentityExtractor.java │ └── test │ └── java │ └── io │ └── vertx │ └── ext │ └── auth │ ├── authentication │ └── CertificateCredentialsTest.java │ └── mtls │ └── impl │ ├── CertificateValidatorImplTest.java │ ├── MutualTlsAuthenticationProviderTest.java │ ├── MutualTlsUserTest.java │ └── SpiffeIdentityExtractorTest.java ├── vertx-client-shaded ├── build.gradle └── src │ └── test │ └── java │ └── org │ └── apache │ └── cassandra │ └── sidecar │ └── client │ └── test │ └── LibraryTest.java └── vertx-client ├── build.gradle └── src ├── main └── java │ └── org │ └── apache │ └── cassandra │ └── sidecar │ └── client │ ├── SidecarClientVertxRequestExecutor.java │ ├── StreamConsumerWriteStream.java │ ├── VertxHttpClient.java │ ├── VertxRequestExecutor.java │ └── VertxStreamBuffer.java └── test ├── java └── org │ └── apache │ └── cassandra │ └── sidecar │ └── client │ ├── StreamConsumerWriteStreamTest.java │ ├── VertxSidecarClientTest.java │ ├── VertxStreamBufferTest.java │ └── request │ └── BaseVertxRequestTest.java └── resources └── log4j2.xml /.asf.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | notifications: 19 | commits: commits@cassandra.apache.org 20 | issues: commits@cassandra.apache.org 21 | pullrequests: pr@cassandra.apache.org 22 | jira_options: link worklog 23 | 24 | github: 25 | description: "Sidecar for Apache Cassandra®" 26 | homepage: https://cassandra.apache.org/ 27 | enabled_merge_buttons: 28 | squash: true 29 | merge: false 30 | rebase: false 31 | features: 32 | wiki: false 33 | issues: false 34 | projects: false 35 | autolink_jira: 36 | - CASSANDRASC # Old name 37 | - CASSSIDECAR # New Apache project name 38 | - CASSANDRA 39 | protected_branches: 40 | trunk: 41 | required_status_checks: 42 | # strict means "Require branches to be up-to-date before merging", i.e. enforcing rebase for the head branch. 43 | strict: true 44 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | 3 | # C* 4 | .out/ 5 | build/ 6 | src/gen-java/ 7 | src/resources/org/apache/cassandra/config/ 8 | logs/ 9 | conf/hotspot_compiler 10 | doc/cql3/CQL.html 11 | 12 | # C* debs 13 | build-stamp 14 | build.properties 15 | debian/cassandra*debhelper* 16 | debian/cassandra*.substvars 17 | debian/cassandra/ 18 | debian/cassandra-tools/ 19 | debian/files 20 | 21 | # gitignore doesn't help with modified files - you may wish to: 22 | # git update-index --assume-unchanged test/data/serialization/2.0/db.RowMutation.bin 23 | # to undo: 24 | # git update-index --no-assume-unchanged test/data/serialization/2.0/db.RowMutation.bin 25 | 26 | # IntelliJ 27 | .idea/ 28 | *.eml 29 | *.iml 30 | *.ipr 31 | *.iws 32 | 33 | # Eclipse 34 | .classpath 35 | .project 36 | .metadata 37 | .settings/ 38 | local.properties 39 | 40 | # Cscope 41 | cscope.* 42 | 43 | # NetBeans 44 | nbbuild/ 45 | nbdist/ 46 | nbproject/ 47 | nb-configuration.xml 48 | nbactions.xml 49 | 50 | # Maven, etc. 51 | out/ 52 | target/ 53 | 54 | # General 55 | *.pyc 56 | *~ 57 | *.bak 58 | *.sw[o,p] 59 | *.tmp 60 | .DS_Store 61 | Thumbs.db 62 | 63 | # JSR223 64 | lib/jsr223/clojure/*.jar 65 | lib/jsr223/groovy/*.jar 66 | lib/jsr223/jaskell/*.jar 67 | lib/jsr223/jruby/*.jar 68 | lib/jsr223/jruby/jni 69 | lib/jsr223/jruby/ruby 70 | lib/jsr223/jython/*.jar 71 | lib/jsr223/jython/cachedir 72 | lib/jsr223/scala/*.jar 73 | 74 | /.ant-targets-build.xml 75 | 76 | src/dist/* 77 | *.logdir_IS_UNDEFINED 78 | 79 | # Files produce by jenv 80 | .java-version 81 | 82 | # Sidecar version - generated by build.gradle 83 | sidecar.version 84 | 85 | # Sidecar copyDist files copied to root directory 86 | agents 87 | bin 88 | conf 89 | lib 90 | 91 | # Local gradle cache 92 | .gradle 93 | 94 | dtest-jars 95 | scripts/dependency-reduced-pom.xml 96 | 97 | default-stylesheet.xsl 98 | -------------------------------------------------------------------------------- /NEWS.txt: -------------------------------------------------------------------------------- 1 | 0.1 2 | === 3 | 4 | New features 5 | ------------ 6 | - Restore capability to Sidecar, for Sidecar to allow restoring data from S3. 7 | - Cassandra Analytics Library Support by adding bulk endpoints for bulk reads and bulk writes. 8 | - Mutual TLS Authentication support. 9 | - Role-based access control authorization mechanism that honors the Cassandra's permissions 10 | to allow access to the service. 11 | - Health check APIs to determine the health of the native, JMX, Gossip, and service health 12 | - Bespoke endpoints that provide ability to access Cassandra operational stats and node management, 13 | including table stats, stream task monitoring, decommission of a node. 14 | - Sidecar Observability that captures metrics such as HTTP (number of requests created per route, 15 | response time taken endpoint wise); metrics per Cassandra instance maintained by Sidecar (instance 16 | specific restore metrics, instance specific stream and upload metrics). Server route metrics emitted 17 | by Vert.x. 18 | - Vert.x-based Client Library that supports accessing endpoints available in Sidecar, with advanced 19 | tunables for retries, backoff, timeouts, and other knobs. 20 | - Schema reporting and integration with Datahub. 21 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache Cassandra Sidecar 2 | Copyright 2023- The Apache Software Foundation 3 | 4 | This product includes software developed by The Apache Software 5 | Foundation (http://www.apache.org/). 6 | 7 | -------------------------------------------------------------------------------- /adapters/adapters-base/src/main/java/org/apache/cassandra/sidecar/adapters/base/data/StreamState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.adapters.base.data; 20 | 21 | import java.util.Arrays; 22 | import java.util.List; 23 | import java.util.stream.Collectors; 24 | import javax.management.openmbean.CompositeData; 25 | 26 | /** 27 | * Representation of the stream state data 28 | */ 29 | public class StreamState 30 | { 31 | private final List sessions; 32 | 33 | public StreamState(CompositeData data) 34 | { 35 | this.sessions = parseSessions((CompositeData[]) data.get("sessions")); 36 | } 37 | 38 | /** 39 | * @return the session info for the sessions in the stream stats data 40 | */ 41 | public List sessions() 42 | { 43 | return sessions; 44 | } 45 | 46 | private List parseSessions(CompositeData[] sessions) 47 | { 48 | return Arrays.stream(sessions).map(SessionInfo::new).collect(Collectors.toList()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /adapters/adapters-base/src/main/java/org/apache/cassandra/sidecar/adapters/base/data/StreamSummary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.adapters.base.data; 20 | 21 | import javax.management.openmbean.CompositeData; 22 | 23 | /** 24 | * Representation of the stream summary data 25 | */ 26 | public class StreamSummary 27 | { 28 | public final String tableId; 29 | 30 | /** 31 | * Number of files to transfer. Can be 0 if nothing to transfer for some streaming request. 32 | */ 33 | public final int files; 34 | public final long totalSize; 35 | 36 | public StreamSummary(CompositeData data) 37 | { 38 | this.tableId = (String) data.get("tableId"); 39 | this.files = (int) data.get("files"); 40 | this.totalSize = (long) data.get("totalSize"); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /adapters/adapters-base/src/main/java/org/apache/cassandra/sidecar/adapters/base/exception/OperationUnavailableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.adapters.base.exception; 20 | 21 | /** 22 | * Indicates that the operation is unavailable because a requirement for the operation has not been met 23 | */ 24 | public class OperationUnavailableException extends RuntimeException 25 | { 26 | public OperationUnavailableException(String errorMessage) 27 | { 28 | super(errorMessage); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /adapters/adapters-base/src/main/java/org/apache/cassandra/sidecar/adapters/base/jmx/ClusterMembershipJmxOperations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.adapters.base.jmx; 20 | 21 | /** 22 | * An interface that pulls a method from Cassandra Gossiper and Failure Detector proxies 23 | */ 24 | public interface ClusterMembershipJmxOperations 25 | { 26 | String FAILURE_DETECTOR_OBJ_NAME = "org.apache.cassandra.net:type=FailureDetector"; 27 | 28 | /** 29 | * Retrieves gossip info with ports included for the nodes 30 | * @return gossip info text 31 | */ 32 | String getAllEndpointStatesWithPort(); 33 | } 34 | -------------------------------------------------------------------------------- /adapters/adapters-base/src/main/java/org/apache/cassandra/sidecar/adapters/base/jmx/MetricsJmxOperations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.adapters.base.jmx; 20 | 21 | /** 22 | * An interface that pulls methods from the Cassandra Metrics Proxy 23 | */ 24 | public interface MetricsJmxOperations 25 | { 26 | String METRICS_OBJ_TYPE_KEYSPACE_TABLE_FORMAT = "org.apache.cassandra.metrics:type=Table,keyspace=%s,scope=%s,name=%s"; 27 | 28 | /** 29 | * Retrieves the value of the metric of type {@link com.codahale.metrics.Gauge} 30 | * @return the value of the Gauge metric 31 | */ 32 | Object getValue(); 33 | 34 | /** 35 | * Retrieves the value of the metric of type {@link com.codahale.metrics.Counter} 36 | * @return the value of the Counter metric 37 | */ 38 | long getCount(); 39 | } 40 | -------------------------------------------------------------------------------- /adapters/adapters-base/src/main/java/org/apache/cassandra/sidecar/adapters/base/jmx/StreamManagerJmxOperations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.adapters.base.jmx; 20 | 21 | import java.util.Set; 22 | import javax.management.openmbean.CompositeData; 23 | 24 | /** 25 | * An interface that pulls methods from the Cassandra Stream manager Proxy 26 | */ 27 | public interface StreamManagerJmxOperations 28 | { 29 | 30 | String STREAM_MANAGER_OBJ_NAME = "org.apache.cassandra.net:type=StreamManager"; 31 | 32 | /** 33 | * Returns the current snapshot of the progress of all ongoing streams. 34 | * @return the current state of streams as a set of JMX {@link CompositeData} instances. 35 | */ 36 | Set getCurrentStreams(); 37 | } 38 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/client/SidecarInstance.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.client; 20 | 21 | /** 22 | * Holds information about the Cassandra Sidecar Instance host and port 23 | */ 24 | public interface SidecarInstance 25 | { 26 | /** 27 | * @return the port where the Cassandra Sidecar instance is listening 28 | */ 29 | int port(); 30 | 31 | /** 32 | * @return the hostname where the Cassandra Sidecar instance is running 33 | */ 34 | String hostname(); 35 | } 36 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/DataObjectBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common; 20 | 21 | import java.util.function.Consumer; 22 | 23 | /** 24 | * Interface to build data objects 25 | * 26 | * @param type of builder 27 | * @param type of result from build 28 | */ 29 | public interface DataObjectBuilder, R> 30 | { 31 | /** 32 | * Self typing 33 | * 34 | * @return type of implementor class 35 | */ 36 | T self(); 37 | 38 | /** 39 | * Build into data object of type R 40 | * 41 | * @return data object type 42 | */ 43 | R build(); 44 | 45 | /** 46 | * Updates a field in the builder 47 | * 48 | * @param updater function to mutate fields 49 | * @return builder itself for chained invocation 50 | */ 51 | default T update(Consumer updater) 52 | { 53 | updater.accept(self()); 54 | return self(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/data/ConsistencyVerificationResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.data; 20 | 21 | /** 22 | * Verification result 23 | */ 24 | public enum ConsistencyVerificationResult 25 | { 26 | /** 27 | * the passed replicas have satisfied the consistency level 28 | */ 29 | SATISFIED, 30 | /** 31 | * no conclusion can be made yet 32 | */ 33 | PENDING, 34 | /** 35 | * the failed replicas have failed the consistency level 36 | */ 37 | FAILED, 38 | } 39 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/data/OperationalJobStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.data; 20 | 21 | /** 22 | * Encapsulates the states of the job lifecycle. 23 | * Operational jobs are the ones running on Cassandra, e.g. decommission, etc. 24 | */ 25 | public enum OperationalJobStatus 26 | { 27 | /** 28 | * The operational job is created 29 | */ 30 | CREATED, 31 | /** 32 | * The operational job is running on Cassandra 33 | */ 34 | RUNNING, 35 | /** 36 | * The operational job succeeds 37 | */ 38 | SUCCEEDED, 39 | /** 40 | * The operational job fails 41 | */ 42 | FAILED; 43 | 44 | public boolean isCompleted() 45 | { 46 | return this == SUCCEEDED || this == FAILED; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/exceptions/RangeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.exceptions; 20 | 21 | /** 22 | * Custom exception 23 | */ 24 | public class RangeException extends RuntimeException 25 | { 26 | public RangeException(String message) 27 | { 28 | super(message); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/http/SidecarHttpHeaderNames.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.http; 20 | 21 | /** 22 | * Custom header names for sidecar 23 | */ 24 | public final class SidecarHttpHeaderNames 25 | { 26 | /** 27 | * {@code "cassandra-content-xxhash32"} 28 | */ 29 | public static final String CONTENT_XXHASH32 = "cassandra-content-xxhash32"; 30 | /** 31 | * {@code "cassandra-content-xxhash32-seed"} 32 | */ 33 | public static final String CONTENT_XXHASH32_SEED = "cassandra-content-xxhash32-seed"; 34 | } 35 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/AllServicesConfigRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.cassandra.sidecar.common.request; 19 | 20 | import io.netty.handler.codec.http.HttpMethod; 21 | import org.apache.cassandra.sidecar.common.ApiEndpointsV1; 22 | import org.apache.cassandra.sidecar.common.request.data.AllServicesConfigPayload; 23 | 24 | /** 25 | * Represents a request for getting configurations for services from "configs" table inside 26 | * sidecar internal keyspace. 27 | */ 28 | public class AllServicesConfigRequest extends JsonRequest 29 | { 30 | /** 31 | * Constructs a Sidecar request with the given {@code requestURI}. Defaults to {@code ssl} enabled. 32 | */ 33 | public AllServicesConfigRequest() 34 | { 35 | super(ApiEndpointsV1.SERVICES_CONFIG_ROUTE); 36 | } 37 | 38 | @Override 39 | public HttpMethod method() 40 | { 41 | return HttpMethod.GET; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/CassandraJmxHealthRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | import io.netty.handler.codec.http.HttpMethod; 22 | import org.apache.cassandra.sidecar.common.ApiEndpointsV1; 23 | import org.apache.cassandra.sidecar.common.response.HealthResponse; 24 | 25 | /** 26 | * Represents a request to retrieve the connectivity health checks performed against the Cassandra JMX protocol 27 | */ 28 | public class CassandraJmxHealthRequest extends JsonRequest 29 | { 30 | /** 31 | * Constructs a request to retrieve the Cassandra JMX health 32 | */ 33 | public CassandraJmxHealthRequest() 34 | { 35 | super(ApiEndpointsV1.CASSANDRA_JMX_HEALTH_ROUTE); 36 | } 37 | 38 | /** 39 | * {@inheritDoc} 40 | */ 41 | @Override 42 | public HttpMethod method() 43 | { 44 | return HttpMethod.GET; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/CleanSSTableUploadSessionRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | import io.netty.handler.codec.http.HttpMethod; 22 | import org.apache.cassandra.sidecar.common.ApiEndpointsV1; 23 | 24 | /** 25 | * Represents a request to clean up the SSTable upload session 26 | */ 27 | public class CleanSSTableUploadSessionRequest extends Request 28 | { 29 | /** 30 | * Constructs a request with the provided {@code requestURI} 31 | * 32 | * @param uploadId the unique identifier for the upload 33 | */ 34 | public CleanSSTableUploadSessionRequest(String uploadId) 35 | { 36 | super(ApiEndpointsV1.SSTABLE_CLEANUP_ROUTE.replaceAll(ApiEndpointsV1.UPLOAD_ID_PATH_PARAM, uploadId)); 37 | } 38 | 39 | @Override 40 | public HttpMethod method() 41 | { 42 | return HttpMethod.DELETE; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/ConnectedClientStatsRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | import io.netty.handler.codec.http.HttpMethod; 22 | import org.apache.cassandra.sidecar.common.ApiEndpointsV1; 23 | import org.apache.cassandra.sidecar.common.response.ConnectedClientStatsResponse; 24 | 25 | /** 26 | * Represents a request get the stats related to the clients connected to the node 27 | */ 28 | public class ConnectedClientStatsRequest extends JsonRequest 29 | { 30 | /** 31 | * Constructs a request to retrieve the Cassandra node stats connected clients information 32 | */ 33 | public ConnectedClientStatsRequest() 34 | { 35 | super(ApiEndpointsV1.CONNECTED_CLIENT_STATS_ROUTE); 36 | } 37 | 38 | /** 39 | * {@inheritDoc} 40 | */ 41 | @Override 42 | public HttpMethod method() 43 | { 44 | return HttpMethod.GET; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/DeleteServiceConfigRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | import io.netty.handler.codec.http.HttpMethod; 22 | import org.apache.cassandra.sidecar.common.ApiEndpointsV1; 23 | 24 | /** 25 | * Represents a request for deleting configurations for a service from "configs" table inside 26 | * sidecar internal keyspace. 27 | */ 28 | public class DeleteServiceConfigRequest extends Request 29 | { 30 | /** 31 | * Constructs a Sidecar request with the given {@code requestURI}. Defaults to {@code ssl} enabled. 32 | */ 33 | public DeleteServiceConfigRequest(Service service) 34 | { 35 | super(ApiEndpointsV1.SERVICE_CONFIG_ROUTE.replaceAll(ApiEndpointsV1.SERVICE_PARAM, service.serviceName)); 36 | } 37 | 38 | @Override 39 | public HttpMethod method() 40 | { 41 | return HttpMethod.DELETE; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/GossipHealthRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | import io.netty.handler.codec.http.HttpMethod; 22 | import org.apache.cassandra.sidecar.common.ApiEndpointsV1; 23 | import org.apache.cassandra.sidecar.common.response.HealthResponse; 24 | 25 | /** 26 | * Request to get gossip health 27 | */ 28 | public class GossipHealthRequest extends JsonRequest 29 | { 30 | /** 31 | * Constructs a request to GET gossip health 32 | */ 33 | public GossipHealthRequest() 34 | { 35 | super(ApiEndpointsV1.GOSSIP_HEALTH_ROUTE); 36 | } 37 | 38 | /** 39 | * {@inheritDoc} 40 | */ 41 | @Override 42 | public HttpMethod method() 43 | { 44 | return HttpMethod.GET; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/GossipInfoRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | import io.netty.handler.codec.http.HttpMethod; 22 | import org.apache.cassandra.sidecar.common.ApiEndpointsV1; 23 | import org.apache.cassandra.sidecar.common.response.GossipInfoResponse; 24 | 25 | /** 26 | * Represents a request to retrieve the Cassandra gossip information 27 | */ 28 | public class GossipInfoRequest extends JsonRequest 29 | { 30 | /** 31 | * Constructs a request to retrieve the Cassandra gossip information 32 | */ 33 | public GossipInfoRequest() 34 | { 35 | super(ApiEndpointsV1.GOSSIP_INFO_ROUTE); 36 | } 37 | 38 | /** 39 | * {@inheritDoc} 40 | */ 41 | @Override 42 | public HttpMethod method() 43 | { 44 | return HttpMethod.GET; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/ListCdcSegmentsRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | import io.netty.handler.codec.http.HttpMethod; 22 | import org.apache.cassandra.sidecar.common.ApiEndpointsV1; 23 | import org.apache.cassandra.sidecar.common.response.ListCdcSegmentsResponse; 24 | 25 | /** 26 | * Represents a request for listing commit log files on an instance 27 | */ 28 | public class ListCdcSegmentsRequest extends JsonRequest 29 | { 30 | public ListCdcSegmentsRequest() 31 | { 32 | super(ApiEndpointsV1.LIST_CDC_SEGMENTS_ROUTE); 33 | } 34 | 35 | @Override 36 | public HttpMethod method() 37 | { 38 | return HttpMethod.GET; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/ListOperationalJobsRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | import io.netty.handler.codec.http.HttpMethod; 22 | import org.apache.cassandra.sidecar.common.ApiEndpointsV1; 23 | import org.apache.cassandra.sidecar.common.response.ListOperationalJobsResponse; 24 | 25 | /** 26 | * Represents a request to retrieve the list of async operational jobs 27 | */ 28 | public class ListOperationalJobsRequest extends JsonRequest 29 | { 30 | /** 31 | * Constructs a request to retrieve the list of running operational jobs 32 | */ 33 | public ListOperationalJobsRequest() 34 | { 35 | super(ApiEndpointsV1.LIST_OPERATIONAL_JOBS_ROUTE); 36 | } 37 | 38 | /** 39 | * {@inheritDoc} 40 | */ 41 | @Override 42 | public HttpMethod method() 43 | { 44 | return HttpMethod.GET; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/NodeDecommissionRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | import io.netty.handler.codec.http.HttpMethod; 22 | import org.apache.cassandra.sidecar.common.ApiEndpointsV1; 23 | import org.apache.cassandra.sidecar.common.response.OperationalJobResponse; 24 | 25 | /** 26 | * Represents a request to execute node decommission operation 27 | */ 28 | public class NodeDecommissionRequest extends JsonRequest 29 | { 30 | /** 31 | * Constructs a request to execute a node decommission operation 32 | */ 33 | public NodeDecommissionRequest() 34 | { 35 | super(ApiEndpointsV1.NODE_DECOMMISSION_ROUTE); 36 | } 37 | 38 | /** 39 | * {@inheritDoc} 40 | */ 41 | @Override 42 | public HttpMethod method() 43 | { 44 | return HttpMethod.PUT; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/NodeSettingsRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | import io.netty.handler.codec.http.HttpMethod; 22 | import org.apache.cassandra.sidecar.common.ApiEndpointsV1; 23 | import org.apache.cassandra.sidecar.common.response.NodeSettings; 24 | 25 | /** 26 | * Represents a request to retrieve the node settings 27 | */ 28 | public class NodeSettingsRequest extends JsonRequest 29 | { 30 | /** 31 | * Constructs a request to retrieve the node settings 32 | */ 33 | public NodeSettingsRequest() 34 | { 35 | super(ApiEndpointsV1.NODE_SETTINGS_ROUTE); 36 | } 37 | 38 | /** 39 | * {@inheritDoc} 40 | */ 41 | @Override 42 | public HttpMethod method() 43 | { 44 | return HttpMethod.GET; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/ReportSchemaRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | import io.netty.handler.codec.http.HttpMethod; 22 | import org.apache.cassandra.sidecar.common.ApiEndpointsV1; 23 | import org.apache.cassandra.sidecar.common.response.HealthResponse; 24 | 25 | /** 26 | * A request to trigger an immediate, synchronous schema conversion 27 | * and report regardless of the periodic task schedule or status 28 | */ 29 | public class ReportSchemaRequest extends JsonRequest 30 | { 31 | public ReportSchemaRequest() 32 | { 33 | super(ApiEndpointsV1.REPORT_SCHEMA_ROUTE); 34 | } 35 | 36 | @Override 37 | public HttpMethod method() 38 | { 39 | return HttpMethod.PUT; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/ResponseBytesDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | import java.io.IOException; 22 | 23 | /** 24 | * Decode response bytes into given java type {@code } 25 | * @param expected java type 26 | */ 27 | public interface ResponseBytesDecoder 28 | { 29 | /** 30 | * Decodes the provided {@code bytes} to an instance of the type {@code } 31 | * 32 | * @param bytes the raw bytes of the response 33 | * @return the decoded instance for the given {@code bytes}, or null for null input 34 | * @throws IOException when the decoder is unable to decode successfully 35 | */ 36 | T decode(byte[] bytes) throws IOException; 37 | } 38 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/Service.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.cassandra.sidecar.common.request; 19 | 20 | import java.util.Locale; 21 | 22 | /** 23 | * "configs" table inside internal sidecar keyspace stores configs for Kafka and CDC. ServiceConfig identifies 24 | * the service of the configs. 25 | */ 26 | public enum Service 27 | { 28 | KAFKA, 29 | CDC; 30 | public final String serviceName; 31 | 32 | Service() 33 | { 34 | this.serviceName = this.toString().toLowerCase(Locale.ENGLISH); 35 | } 36 | 37 | public static Service withName(String serviceName) 38 | { 39 | return valueOf(serviceName.toUpperCase(Locale.ENGLISH)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/SidecarHealthRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | import io.netty.handler.codec.http.HttpMethod; 22 | import org.apache.cassandra.sidecar.common.ApiEndpointsV1; 23 | import org.apache.cassandra.sidecar.common.response.HealthResponse; 24 | 25 | /** 26 | * Represents a request to retrieve the Sidecar health 27 | */ 28 | public class SidecarHealthRequest extends JsonRequest 29 | { 30 | /** 31 | * Constructs a request to retrieve the Sidecar health 32 | */ 33 | public SidecarHealthRequest() 34 | { 35 | super(ApiEndpointsV1.HEALTH_ROUTE); 36 | } 37 | 38 | /** 39 | * {@inheritDoc} 40 | */ 41 | @Override 42 | public HttpMethod method() 43 | { 44 | return HttpMethod.GET; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/StreamStatsRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | import io.netty.handler.codec.http.HttpMethod; 22 | import org.apache.cassandra.sidecar.common.ApiEndpointsV1; 23 | import org.apache.cassandra.sidecar.common.response.StreamStatsResponse; 24 | 25 | /** 26 | * Class response for the StreamsStats API 27 | */ 28 | public class StreamStatsRequest extends JsonRequest 29 | { 30 | /** 31 | * Constructs a request to retrieve the Cassandra node streaming stats information 32 | */ 33 | public StreamStatsRequest() 34 | { 35 | super(ApiEndpointsV1.STREAM_STATS_ROUTE); 36 | } 37 | 38 | /** 39 | * {@inheritDoc} 40 | */ 41 | public HttpMethod method() 42 | { 43 | return HttpMethod.GET; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/TimeSkewRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | import io.netty.handler.codec.http.HttpMethod; 22 | import org.apache.cassandra.sidecar.common.ApiEndpointsV1; 23 | import org.apache.cassandra.sidecar.common.response.TimeSkewResponse; 24 | 25 | /** 26 | * Represents a request to retrieve information from the time skew endpoint 27 | */ 28 | public class TimeSkewRequest extends JsonRequest 29 | { 30 | /** 31 | * Constructs a new request to retrieve information from the time skew endpoint 32 | */ 33 | public TimeSkewRequest() 34 | { 35 | super(ApiEndpointsV1.TIME_SKEW_ROUTE); 36 | } 37 | 38 | /** 39 | * {@inheritDoc} 40 | */ 41 | @Override 42 | public HttpMethod method() 43 | { 44 | return HttpMethod.GET; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/UploadableRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request; 20 | 21 | /** 22 | * A request that will upload the provided file to the service 23 | */ 24 | public interface UploadableRequest 25 | { 26 | /** 27 | * @return the path to the file to be uploaded 28 | */ 29 | String filename(); 30 | } 31 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/request/data/Digest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.request.data; 20 | 21 | import java.util.Map; 22 | 23 | /** 24 | * Interface that represents a checksum digest 25 | */ 26 | public interface Digest 27 | { 28 | /** 29 | * @return headers to be used in the HTTP request 30 | */ 31 | Map headers(); 32 | 33 | /** 34 | * @return the string representation of the digest 35 | */ 36 | String value(); 37 | 38 | /** 39 | * @return the name of the digest's algorithm 40 | */ 41 | String algorithm(); 42 | } 43 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/response/ListOperationalJobsResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.response; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | import com.fasterxml.jackson.annotation.JsonProperty; 25 | 26 | /** 27 | * Response structure of the list operational jobs API 28 | */ 29 | public class ListOperationalJobsResponse 30 | { 31 | private final List jobs; 32 | 33 | /** 34 | * Constructs a {@link ListOperationalJobsResponse} object. 35 | */ 36 | public ListOperationalJobsResponse() 37 | { 38 | this.jobs = new ArrayList<>(); 39 | } 40 | 41 | public void addJob(OperationalJobResponse job) 42 | { 43 | jobs.add(job); 44 | } 45 | 46 | @JsonProperty("jobs") 47 | public List jobs() 48 | { 49 | return jobs; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/response/RingResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.response; 20 | 21 | import java.math.BigInteger; 22 | import java.util.Comparator; 23 | import java.util.PriorityQueue; 24 | 25 | import org.apache.cassandra.sidecar.common.response.data.RingEntry; 26 | 27 | /** 28 | * Json format for ring response. It also sorts the entries on adding. 29 | */ 30 | public class RingResponse extends PriorityQueue 31 | { 32 | // sort by datacenter first and then by token 33 | private static final Comparator DEFAULT_COMPARATOR = 34 | Comparator.comparing(RingEntry::datacenter) 35 | .thenComparing(e -> new BigInteger(e.token())); 36 | 37 | // used by json deserialization 38 | public RingResponse() 39 | { 40 | this(4); 41 | } 42 | 43 | public RingResponse(int capacity) 44 | { 45 | super(capacity, DEFAULT_COMPARATOR); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/response/TimeSkewResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.response; 20 | 21 | import com.fasterxml.jackson.annotation.JsonCreator; 22 | import com.fasterxml.jackson.annotation.JsonInclude; 23 | import com.fasterxml.jackson.annotation.JsonProperty; 24 | 25 | /** 26 | * Data class to define the json format of time skew response. 27 | */ 28 | @JsonInclude(JsonInclude.Include.NON_NULL) 29 | public class TimeSkewResponse 30 | { 31 | public final long currentTime; 32 | public final int allowableSkewInMinutes; 33 | 34 | @JsonCreator 35 | public TimeSkewResponse(@JsonProperty("currentTime") long currentTime, 36 | @JsonProperty("allowableSkewInMinutes") int allowableSkewInMinutes) 37 | { 38 | this.currentTime = currentTime; 39 | this.allowableSkewInMinutes = allowableSkewInMinutes; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /client-common/src/main/java/org/apache/cassandra/sidecar/common/utils/StringUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.utils; 20 | 21 | import org.jetbrains.annotations.Nullable; 22 | 23 | /** 24 | * Collection of utility methods for String 25 | */ 26 | public class StringUtils 27 | { 28 | private StringUtils() 29 | { 30 | } 31 | 32 | /** 33 | * @param string string value to test 34 | * @return true when the string is null or its length is 0; false otherwise 35 | */ 36 | public static boolean isNullOrEmpty(@Nullable String string) 37 | { 38 | return string == null || string.isEmpty(); 39 | } 40 | 41 | /** 42 | * @param string string value to test 43 | * @return true only when the string is not null and its length is not 0; false otherwise 44 | */ 45 | public static boolean isNotEmpty(@Nullable String string) 46 | { 47 | return !isNullOrEmpty(string); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /client-common/src/test/java/org/apache/cassandra/sidecar/common/http/SidecarHttpResponseStatusTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.http; 20 | 21 | import org.junit.jupiter.api.Test; 22 | 23 | import static org.apache.cassandra.sidecar.common.http.SidecarHttpResponseStatus.CHECKSUM_MISMATCH; 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | /** 27 | * Unit tests for {@link SidecarHttpResponseStatus} 28 | */ 29 | class SidecarHttpResponseStatusTest 30 | { 31 | 32 | @Test 33 | void testInvalidChecksum() 34 | { 35 | assertThat(CHECKSUM_MISMATCH.code()).isEqualTo(455); 36 | assertThat(CHECKSUM_MISMATCH.reasonPhrase()).isEqualTo("Checksum Mismatch"); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /client/src/main/java/org/apache/cassandra/sidecar/client/SidecarInstancesProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.client; 20 | 21 | import java.util.List; 22 | 23 | /** 24 | * A class that provides the list of {@link SidecarInstance}s. This class allows for statically or dynamically 25 | * providing a list of instances. It is meant to support expansions and shrink of Cassandra clusters. 26 | */ 27 | public interface SidecarInstancesProvider 28 | { 29 | /** 30 | * @return the list of {@link SidecarInstance}s 31 | */ 32 | List instances(); 33 | } 34 | -------------------------------------------------------------------------------- /client/src/main/java/org/apache/cassandra/sidecar/client/StreamConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.client; 20 | 21 | 22 | /** 23 | * Represents a consumer for a stream, when using streaming for the Sidecar {@link HttpClient}. 24 | */ 25 | public interface StreamConsumer 26 | { 27 | /** 28 | * Called when the {@link StreamBuffer} is ready to be consumed. This method can be called multiple times as 29 | * data arrives and the {@link StreamBuffer} can be consumed. 30 | * 31 | * @param buffer the StreamBuffer that wraps the received data 32 | */ 33 | void onRead(final StreamBuffer buffer); 34 | 35 | /** 36 | * Called when the stream has completed 37 | */ 38 | void onComplete(); 39 | 40 | /** 41 | * Called when the stream has failed with the encountered {@link Throwable throwable}. 42 | * 43 | * @param throwable throwable 44 | */ 45 | void onError(final Throwable throwable); 46 | } 47 | -------------------------------------------------------------------------------- /client/src/main/java/org/apache/cassandra/sidecar/client/exception/ResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.client.exception; 20 | 21 | import org.apache.cassandra.sidecar.common.request.Request; 22 | 23 | /** 24 | * An exception raised when the HTTP resource is Not Found (A 404 Status Code response). 25 | */ 26 | public class ResourceNotFoundException extends RuntimeException 27 | { 28 | /** 29 | * Constructs a new exception for a request where the URI is not found on the remote server 30 | * 31 | * @param request the HTTP request 32 | */ 33 | public ResourceNotFoundException(Request request) 34 | { 35 | super(String.format("The resource for the request '%s' does not exist", request.requestURI())); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /client/src/main/java/org/apache/cassandra/sidecar/client/retry/RetryAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.client.retry; 20 | 21 | /** 22 | * An action called when a request is retried 23 | */ 24 | public interface RetryAction 25 | { 26 | /** 27 | * Notify that the request must be retried with {@code retryDelayMillis}. 28 | * 29 | * @param attempts the number of attempts for this request 30 | * @param retryDelayMillis the delay between retries in milliseconds 31 | */ 32 | void retry(int attempts, long retryDelayMillis); 33 | } 34 | -------------------------------------------------------------------------------- /client/src/main/java/org/apache/cassandra/sidecar/client/selection/InstanceSelectionPolicy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.client.selection; 20 | 21 | import org.apache.cassandra.sidecar.client.SidecarInstance; 22 | 23 | /** 24 | * Defines the selection policy for an instance 25 | */ 26 | public interface InstanceSelectionPolicy extends Iterable 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /client/src/test/java/org/apache/cassandra/sidecar/client/SidecarInstanceImplTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.client; 20 | 21 | /** 22 | * Unit tests for the {@link SidecarInstanceImpl} class 23 | */ 24 | class SidecarInstanceImplTest extends SidecarInstanceTest 25 | { 26 | @Override 27 | protected SidecarInstance newInstance(String hostname, int port) 28 | { 29 | return new SidecarInstanceImpl(hostname, port); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /client/src/test/java/org/apache/cassandra/sidecar/client/request/JsonRequestTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.client.request; 20 | 21 | 22 | import org.junit.jupiter.api.Test; 23 | 24 | import io.netty.handler.codec.http.HttpMethod; 25 | import org.apache.cassandra.sidecar.common.request.JsonRequest; 26 | import org.apache.cassandra.sidecar.common.response.NodeSettings; 27 | 28 | import static org.assertj.core.api.Assertions.assertThatExceptionOfType; 29 | 30 | class JsonRequestTest 31 | { 32 | @Test 33 | void testHeadersAreImmutable() 34 | { 35 | JsonRequest instance = new JsonRequest("https://cassandra-sidecar.com/api/test") 36 | { 37 | @Override 38 | public HttpMethod method() 39 | { 40 | return HttpMethod.GET; 41 | } 42 | }; 43 | 44 | assertThatExceptionOfType(UnsupportedOperationException.class) 45 | .isThrownBy(() -> instance.headers().put("not", "allowed")); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /client/src/testFixtures/java/org/apache/cassandra/sidecar/client/request/RequestTestParameters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.client.request; 20 | 21 | import org.apache.cassandra.sidecar.client.RequestContext; 22 | 23 | /** 24 | * An interface defining the request testing for the client 25 | * 26 | * @param the type 27 | */ 28 | public interface RequestTestParameters 29 | { 30 | RequestContext.Builder specificRequest(RequestContext.Builder requestContextBuilder); 31 | 32 | String okResponseBody(); 33 | 34 | String expectedEndpointPath(); 35 | 36 | void validateResponse(T responseObject); 37 | 38 | default String serverErrorResponseBody() 39 | { 40 | return "{\"error\":\"some error\"}"; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /client/src/testFixtures/resources/sstables/nb-1-big-TOC.txt: -------------------------------------------------------------------------------- 1 | Summary.db 2 | TOC.txt 3 | Statistics.db 4 | Filter.db 5 | Data.db 6 | CRC.db 7 | Digest.crc32 8 | Index.db 9 | -------------------------------------------------------------------------------- /docs/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | apply plugin: 'org.asciidoctor.jvm.convert' 21 | 22 | asciidoctor { 23 | sourceDir = file("src") 24 | outputDir = file("build") 25 | } 26 | -------------------------------------------------------------------------------- /docs/src/user.adoc: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | This is the documentation for the official Sidecar project for Apache Cassandra. 4 | 5 | NOTE: This documentation is only a placeholder at the moment and requires some love. 6 | 7 | ## Installation 8 | 9 | You will probably find it easiest to install the sidecar by using one of the system packages we have available. 10 | 11 | ## Setup 12 | 13 | If you've installed the sidecar via a DEB or RPM package you will be able to use systemd to start, stop etc. 14 | 15 | 16 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | version=0.2-SNAPSHOT 20 | junitVersion=5.9.2 21 | vertxVersion=4.5.13 22 | nettyVersion=4.1.118.Final 23 | guavaVersion=27.0.1-jre 24 | guiceVersion=4.2.3 25 | slf4jVersion=1.7.36 26 | jacksonVersion=2.14.3 27 | dtestApiVersion=0.0.17 28 | assertjCoreVersion=3.24.2 29 | # trunk is currently 5.1 - update when trunk moves 30 | dtestVersion=5.1 31 | dtestDependencyName=cassandra-dtest-local-all 32 | awsSdkVersion=2.26.12 33 | # The dep is to introduce xxhash impl 34 | commonsCodecVersion=1.16.1 35 | # openSSL 36 | boringSslVersion=2.0.61.Final 37 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cassandra-sidecar/00b431ad1d5051a1575a1d7f026e204f116487e0/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /ide/idea/copyright/Apache_License_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /ide/idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /integration-framework/src/main/java/org/apache/cassandra/testing/TestVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.testing; 20 | 21 | /** 22 | * Works with {@link TestVersionSupplier} 23 | */ 24 | public class TestVersion 25 | { 26 | private final String version; 27 | 28 | public TestVersion(String version) 29 | { 30 | this.version = version; 31 | } 32 | 33 | public String version() 34 | { 35 | return version; 36 | } 37 | 38 | @Override 39 | public String toString() 40 | { 41 | return "TestVersion{" + 42 | "version='" + version + '\'' + 43 | '}'; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /scripts/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cassandra-sidecar/00b431ad1d5051a1575a1d7f026e204f116487e0/scripts/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /scripts/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.8/apache-maven-3.8.8-bin.zip 18 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 19 | -------------------------------------------------------------------------------- /scripts/functions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | get_hostname() { 21 | if [[ $# -eq 0 ]] ; then 22 | echo 'An URI must be provided' 23 | exit 1 24 | fi 25 | 26 | # removes the scheme portion of the URI (i.e. https://, http://) 27 | hostname=$(echo "${1}" | sed -E 's/^\s*.*:\/\///g') 28 | # removes the first encounter of a forward slash / until the end of the string 29 | hostname=${hostname%%/*} 30 | # removes the first encounter of a colon : until the end of the string i.e git@github.com:apache -> git@github.com 31 | hostname=${hostname%%:*} 32 | # removes the username portion of an URI i.e. git@github.com -> github.com 33 | hostname=$(echo "${hostname}" | cut -d@ -f2-) 34 | 35 | echo "${hostname}" 36 | } 37 | 38 | test_get_hostname() { 39 | get_hostname "https://github.com/apache/cassandra-sidecar" # returns github.com 40 | get_hostname "git@github.com:apache/cassandra-sidecar.git" # returns github.com 41 | get_hostname # returns An URI must be provided message with exit code 1 42 | } 43 | -------------------------------------------------------------------------------- /server-common/src/main/java/org/apache/cassandra/sidecar/common/server/ClusterMembershipOperations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.server; 20 | 21 | /** 22 | * An interface that defines interactions about Cassandra cluster membership. 23 | */ 24 | public interface ClusterMembershipOperations 25 | { 26 | /** 27 | * Retrieves gossip info 28 | * 29 | * @return string contains the gossip info of all known nodes. 30 | */ 31 | String gossipInfo(); 32 | } 33 | -------------------------------------------------------------------------------- /server-common/src/main/java/org/apache/cassandra/sidecar/common/server/MinimumVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.server; 20 | 21 | import java.lang.annotation.Inherited; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | 25 | /** 26 | * Indicates the minimum version requires for this Cassandra implementation 27 | * The minimum version will be used to select the right Cassandra adapter 28 | */ 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Inherited 31 | public @interface MinimumVersion 32 | { 33 | String value(); 34 | } 35 | -------------------------------------------------------------------------------- /server-common/src/main/java/org/apache/cassandra/sidecar/common/server/ThrowingRunnable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.server; 20 | 21 | /** 22 | * Similar to {@link Runnable}, but it can throw {@link Exception} 23 | */ 24 | @FunctionalInterface 25 | public interface ThrowingRunnable 26 | { 27 | void run() throws Exception; 28 | } 29 | -------------------------------------------------------------------------------- /server-common/src/main/java/org/apache/cassandra/sidecar/common/server/cluster/locator/Partitioner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.server.cluster.locator; 20 | 21 | /** 22 | * A simplified mirror of {@code IPartitioner} in Cassandra 23 | */ 24 | public interface Partitioner 25 | { 26 | /** 27 | * @return the minimum token of the partitioner 28 | * 29 | * Note that the minimum token is not assigned to any data, i.e. excluded from the token ring 30 | */ 31 | Token minimumToken(); 32 | 33 | /** 34 | * @return the maximum token of the partitioner 35 | * 36 | * Note that the maximum token is included in the token ring 37 | */ 38 | Token maximumToken(); 39 | 40 | /** 41 | * @return name of the Partitioner 42 | */ 43 | default String name() 44 | { 45 | return this.getClass().getSimpleName(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /server-common/src/main/java/org/apache/cassandra/sidecar/common/server/exceptions/NodeBootstrappingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.server.exceptions; 20 | 21 | /** 22 | * Exception thrown when a node is bootstrapping while an operation cannot be performed when the node is bootstrapping 23 | */ 24 | public class NodeBootstrappingException extends RuntimeException 25 | { 26 | public NodeBootstrappingException(Exception inner) 27 | { 28 | super(inner); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /server-common/src/main/java/org/apache/cassandra/sidecar/common/server/exceptions/SnapshotAlreadyExistsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.server.exceptions; 20 | 21 | /** 22 | * Exception thrown when the snapshot with the same name already exists 23 | */ 24 | public class SnapshotAlreadyExistsException extends RuntimeException 25 | { 26 | public SnapshotAlreadyExistsException(Exception inner) 27 | { 28 | super(inner); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /server-common/src/main/java/org/apache/cassandra/sidecar/db/DataObjectMappingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.db; 20 | 21 | /** 22 | * Exception thrown during mapping a data object into/from database record 23 | */ 24 | public class DataObjectMappingException extends RuntimeException 25 | { 26 | public DataObjectMappingException(String message, Throwable cause) 27 | { 28 | super(message, cause); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /server-common/src/main/java/org/apache/cassandra/sidecar/db/schema/TableSchema.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.db.schema; 20 | 21 | import com.datastax.driver.core.KeyspaceMetadata; 22 | import com.datastax.driver.core.Metadata; 23 | import org.jetbrains.annotations.NotNull; 24 | 25 | /** 26 | * Abstract base schema class for table schema 27 | */ 28 | public abstract class TableSchema extends AbstractSchema 29 | { 30 | protected abstract String tableName(); 31 | 32 | @Override 33 | protected boolean exists(@NotNull Metadata metadata) 34 | { 35 | KeyspaceMetadata ksMetadata = metadata.getKeyspace(keyspaceName()); 36 | if (ksMetadata == null) 37 | return false; 38 | return ksMetadata.getTable(tableName()) != null; 39 | } 40 | 41 | @Override 42 | public String toString() 43 | { 44 | return keyspaceName() + '.' + tableName(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /server-common/src/main/java/org/apache/cassandra/sidecar/exceptions/SchemaUnavailableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.exceptions; 20 | 21 | /** 22 | * Exception thrown when {@link org.apache.cassandra.sidecar.db.schema.TableSchema} does not exist. 23 | * For instance, the connected Cassandra no longer has such table 24 | */ 25 | public class SchemaUnavailableException extends RuntimeException 26 | { 27 | public SchemaUnavailableException(String keyspace, String table) 28 | { 29 | super(makeErrorMessage(keyspace, table)); 30 | } 31 | 32 | private static String makeErrorMessage(String keyspace, String table) 33 | { 34 | return "Table " + keyspace + '.' + table + " does not exist"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /server-common/src/main/java/org/apache/cassandra/sidecar/exceptions/SidecarSchemaModificationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.exceptions; 20 | 21 | /** 22 | * Exception thrown when modifications to schema managed by Sidecar fail 23 | */ 24 | public class SidecarSchemaModificationException extends RuntimeException 25 | { 26 | public SidecarSchemaModificationException(String message, Throwable cause) 27 | { 28 | super(message, cause); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /server-common/src/test/java/org/apache/cassandra/sidecar/common/server/utils/StringUtilsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common.server.utils; 20 | 21 | import org.junit.jupiter.api.Test; 22 | 23 | import org.apache.cassandra.sidecar.common.utils.StringUtils; 24 | 25 | import static org.assertj.core.api.Assertions.assertThat; 26 | 27 | class StringUtilsTest 28 | { 29 | @Test 30 | void testEmpty() 31 | { 32 | String testStr = null; 33 | assertThat(StringUtils.isNullOrEmpty(testStr)).isTrue(); 34 | assertThat(StringUtils.isNotEmpty(testStr)).isFalse(); 35 | 36 | testStr = ""; 37 | assertThat(StringUtils.isNullOrEmpty(testStr)).isTrue(); 38 | assertThat(StringUtils.isNotEmpty(testStr)).isFalse(); 39 | 40 | testStr = "non-empty"; 41 | assertThat(StringUtils.isNullOrEmpty(testStr)).isFalse(); 42 | assertThat(StringUtils.isNotEmpty(testStr)).isTrue(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /server-common/src/test/resources/testJmxPassword.properties: -------------------------------------------------------------------------------- 1 | controlRole password 2 | -------------------------------------------------------------------------------- /server-common/src/testFixtures/java/org/apache/cassandra/sidecar/common/MockCassandraFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.common; 20 | 21 | import java.net.InetSocketAddress; 22 | 23 | import org.apache.cassandra.sidecar.common.server.CQLSessionProvider; 24 | import org.apache.cassandra.sidecar.common.server.ICassandraAdapter; 25 | import org.apache.cassandra.sidecar.common.server.ICassandraFactory; 26 | import org.apache.cassandra.sidecar.common.server.JmxClient; 27 | 28 | /** 29 | * 30 | */ 31 | public class MockCassandraFactory implements ICassandraFactory 32 | { 33 | @Override 34 | public ICassandraAdapter create(CQLSessionProvider session, 35 | JmxClient jmxClient, 36 | InetSocketAddress localNativeTransportAddress) 37 | { 38 | return null; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/acl/authentication/JwtRoleProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.acl.authentication; 20 | 21 | import java.util.List; 22 | 23 | import io.vertx.core.json.JsonObject; 24 | 25 | /** 26 | * Interface for processing cassandra roles from decode JWT tokens. 27 | */ 28 | public interface JwtRoleProcessor 29 | { 30 | /** 31 | * Processes list of cassandra roles held by a user, given decoded JWT token 32 | * 33 | * @param decodedToken the decoded JWT token as a JsonObject 34 | * @return cassandra roles associated with the JWT token 35 | */ 36 | List processRoles(JsonObject decodedToken); 37 | } 38 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/cluster/ConsistencyVerifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.apache.cassandra.sidecar.cluster; 18 | 19 | import java.util.Set; 20 | 21 | import org.apache.cassandra.sidecar.cluster.locator.InstanceSetByDc; 22 | import org.apache.cassandra.sidecar.common.data.ConsistencyVerificationResult; 23 | import org.jetbrains.annotations.NotNull; 24 | 25 | /** 26 | * Verifier to check the progress with the consistency level 27 | */ 28 | public interface ConsistencyVerifier 29 | { 30 | /** 31 | * Verify the current progress and conclude a result 32 | * 33 | * @param succeeded current instances succeed 34 | * @param failed current instances fail 35 | * @param all all participant instances considering the replication strategy; 36 | * instances are grouped by dc 37 | * @return result 38 | */ 39 | ConsistencyVerificationResult verify(@NotNull Set succeeded, @NotNull Set failed, @NotNull InstanceSetByDc all); 40 | } 41 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/config/ClusterLeaseClaimConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.config; 20 | 21 | /** 22 | * Exposes configuration in Sidecar for the cluster lease claim task 23 | */ 24 | public interface ClusterLeaseClaimConfiguration extends PeriodicTaskConfiguration, RandomInitialDelayDelta 25 | { 26 | /** 27 | * @return the name of the strategy used to determine the electorate membership 28 | */ 29 | String electorateMembershipStrategy(); 30 | } 31 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/config/CoordinationConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.config; 20 | 21 | /** 22 | * Configuration relevant to the coordination functionality of Sidecar 23 | */ 24 | public interface CoordinationConfiguration 25 | { 26 | /** 27 | * @return configuration parameters for the cluster lease claim task 28 | */ 29 | ClusterLeaseClaimConfiguration clusterLeaseClaimConfiguration(); 30 | } 31 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/config/JmxConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.config; 20 | 21 | import org.apache.cassandra.sidecar.common.server.utils.MillisecondBoundConfiguration; 22 | 23 | /** 24 | * General JMX connectivity configuration that is not instance-specific. 25 | */ 26 | public interface JmxConfiguration 27 | { 28 | /** 29 | * @return the maximum number of connection retry attempts to make before failing 30 | */ 31 | int maxRetries(); 32 | 33 | /** 34 | * @return the delay between retry attempts 35 | */ 36 | MillisecondBoundConfiguration retryDelay(); 37 | } 38 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/config/MetricsConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.config; 20 | 21 | import java.util.List; 22 | 23 | /** 24 | * Configuration needed for capturing metrics. 25 | */ 26 | public interface MetricsConfiguration 27 | { 28 | /** 29 | * @return global registry name to be used for registering sidecar metrics 30 | */ 31 | String registryName(); 32 | 33 | /** 34 | * @return configuration needed for capturing metrics released by Vert.x framework. 35 | */ 36 | VertxMetricsConfiguration vertxConfiguration(); 37 | 38 | /** 39 | * @return filters for metrics to be recorded 40 | */ 41 | List includeConfigurations(); 42 | 43 | /** 44 | * @return filters for excluding metrics during capture 45 | */ 46 | List excludeConfigurations(); 47 | } 48 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/config/MetricsFilteringConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.config; 20 | 21 | /** 22 | * Configuration needed for filtering metrics captured. 23 | */ 24 | public interface MetricsFilteringConfiguration 25 | { 26 | /** 27 | * @return type of metric filter. Possible values are regex, equals. 28 | */ 29 | String type(); 30 | 31 | /** 32 | * @return pattern supported by the filter. 33 | */ 34 | String value(); 35 | } 36 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/config/ParameterizedClassConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.config; 20 | 21 | import java.util.Map; 22 | 23 | import org.jetbrains.annotations.Nullable; 24 | 25 | /** 26 | * Encapsulates configuration needed for classes that can be initialized with a given class name using the 27 | * configured optional parameters 28 | */ 29 | public interface ParameterizedClassConfiguration 30 | { 31 | /** 32 | * @return class name of class to be created with given configuration 33 | */ 34 | String className(); 35 | 36 | /** 37 | * @return parameters that will be used for creating an object of given class name 38 | */ 39 | @Nullable 40 | Map namedParameters(); 41 | } 42 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/config/S3ProxyConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.config; 20 | 21 | import java.net.URI; 22 | 23 | /** 24 | * Configuration for S3 proxy. 25 | */ 26 | public interface S3ProxyConfiguration 27 | { 28 | /** 29 | * @return proxy URI 30 | */ 31 | URI proxy(); 32 | 33 | /** 34 | * @return proxy username 35 | */ 36 | String username(); 37 | 38 | /** 39 | * @return proxy password 40 | */ 41 | String password(); 42 | 43 | /** 44 | * Optional/nullable; only used for testing. Specify the override so the s3 client can connect to local S3 45 | * testing server. 46 | * 47 | * @return the S3 client override used for testing only 48 | */ 49 | URI endpointOverride(); 50 | 51 | default boolean isPresent() 52 | { 53 | return proxy() != null; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/config/SSTableImportConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.config; 20 | 21 | /** 22 | * Configuration for the SSTable Import functionality 23 | */ 24 | public interface SSTableImportConfiguration extends PeriodicTaskConfiguration 25 | { 26 | /** 27 | * @return the configuration for the cache used for SSTable Import requests 28 | */ 29 | CacheConfiguration cacheConfiguration(); 30 | } 31 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/config/SSTableSnapshotConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.config; 20 | 21 | /** 22 | * Configuration for the SSTable Snapshots functionality 23 | */ 24 | public interface SSTableSnapshotConfiguration 25 | { 26 | /** 27 | * @return the configuration for the cache used for SSTable snapshot list of files 28 | */ 29 | CacheConfiguration snapshotListCacheConfiguration(); 30 | } 31 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/config/SidecarPeerHealthConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.config; 20 | 21 | import org.apache.cassandra.sidecar.common.server.utils.MillisecondBoundConfiguration; 22 | 23 | /** 24 | * Configuration for Sidecar peers health checks 25 | */ 26 | public interface SidecarPeerHealthConfiguration extends PeriodicTaskConfiguration 27 | { 28 | /** 29 | * @return the number of maximum retries to be performed during a Sidecar peer health check 30 | */ 31 | int maxRetries(); 32 | 33 | /** 34 | * @return the delay between Sidecar peer health checks retries 35 | */ 36 | MillisecondBoundConfiguration retryDelay(); 37 | } 38 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/config/ThrottleConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.config; 20 | 21 | import org.apache.cassandra.sidecar.common.server.utils.SecondBoundConfiguration; 22 | 23 | /** 24 | * The traffic shaping configuration options for the service 25 | */ 26 | public interface ThrottleConfiguration 27 | { 28 | /** 29 | * @return rate at which stream requests will be accepted. 30 | */ 31 | long rateLimitStreamRequestsPerSecond(); 32 | 33 | /** 34 | * @return timeout used to determine when to stop retrying stream requests when stream requests are throttled. 35 | */ 36 | SecondBoundConfiguration timeout(); 37 | } 38 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/config/VertxConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.config; 20 | 21 | import org.jetbrains.annotations.Nullable; 22 | 23 | /** 24 | * Encapsulates vert.x configuration 25 | */ 26 | public interface VertxConfiguration 27 | { 28 | /** 29 | * @return vert.x file system configuration 30 | */ 31 | @Nullable FileSystemOptionsConfiguration filesystemOptionsConfiguration(); 32 | } 33 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/config/VertxMetricsConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.config; 20 | 21 | /** 22 | * Holds configuration needed for enabling metrics capture in Vert.x framework, for analyzing from Sidecar. 23 | */ 24 | public interface VertxMetricsConfiguration 25 | { 26 | /** 27 | * @return boolean indicating whether metrics captured is enabled for Vert.x 28 | */ 29 | boolean enabled(); 30 | 31 | /** 32 | * @return boolean indicating whether Vert.x metrics will be exposed via JMX 33 | */ 34 | boolean exposeViaJMX(); 35 | 36 | /** 37 | * @return JMX domain to be used when metrics are exposed via JMX 38 | */ 39 | String jmxDomainName(); 40 | } 41 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/config/WorkerPoolConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.config; 20 | 21 | import org.apache.cassandra.sidecar.common.server.utils.MillisecondBoundConfiguration; 22 | 23 | /** 24 | * Encapsulates configurations for the worker pool 25 | */ 26 | public interface WorkerPoolConfiguration 27 | { 28 | /** 29 | * @return the name of the worker pool 30 | */ 31 | String workerPoolName(); 32 | 33 | /** 34 | * @return the size of the worker pool 35 | */ 36 | int workerPoolSize(); 37 | 38 | /** 39 | * @return the maximum execution time for the worker pool 40 | */ 41 | MillisecondBoundConfiguration workerMaxExecutionTime(); 42 | } 43 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/coordination/ElectorateMembership.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.coordination; 20 | 21 | /** 22 | * An interface that defines if the local Sidecar instance should participate during the choosing of a single 23 | * instance executor process. 24 | */ 25 | public interface ElectorateMembership 26 | { 27 | /** 28 | * @return {@code true} if the local Sidecar instance is a member of the electorate, {@code false} otherwise 29 | */ 30 | boolean isMember(); 31 | } 32 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/coordination/ExecuteOnClusterLeaseholderOnly.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.coordination; 20 | 21 | /** 22 | * A marker interface that defines an operation should be executed on the local Sidecar instance iff 23 | * the local Sidecar instance is the cluster leaseholder. 24 | */ 25 | public interface ExecuteOnClusterLeaseholderOnly 26 | { 27 | } 28 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/coordination/SidecarPeerHealthProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.coordination; 20 | 21 | 22 | import io.vertx.core.Future; 23 | import org.apache.cassandra.sidecar.client.SidecarInstance; 24 | 25 | /** 26 | * Interface to provide health information for other Sidecar instances 27 | */ 28 | public interface SidecarPeerHealthProvider 29 | { 30 | /** 31 | * Possible Health States 32 | */ 33 | enum Health 34 | { 35 | /** 36 | * Peer Sidecar is alive 37 | */ 38 | UP, 39 | 40 | /** 41 | * Peer Sidecar is not unreachable 42 | */ 43 | DOWN 44 | } 45 | 46 | /** 47 | * @param instance the instance where the health check will be executed 48 | * @return a future with the {@link Health} of the {@code instance} 49 | */ 50 | Future health(SidecarInstance instance); 51 | } 52 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/coordination/SidecarPeerProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.coordination; 20 | 21 | import java.util.Set; 22 | 23 | import org.apache.cassandra.sidecar.client.SidecarInstance; 24 | 25 | /** 26 | * Provides a set of Sidecar peers 27 | */ 28 | public interface SidecarPeerProvider 29 | { 30 | /** 31 | * @return a set of Sidecar peers 32 | */ 33 | Set get(); 34 | } 35 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/datahub/ClusterToAspectConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.datahub; 20 | 21 | import com.datastax.driver.core.Metadata; 22 | import com.linkedin.data.template.RecordTemplate; 23 | import datahub.event.MetadataChangeProposalWrapper; 24 | import org.jetbrains.annotations.NotNull; 25 | 26 | /** 27 | * Base abstract class for convertors that handle Cassandra clusters (DataHub instances) 28 | * 29 | * @param type of the aspect produced by this converter 30 | */ 31 | public abstract class ClusterToAspectConverter extends MetadataToAspectConverter 32 | { 33 | protected ClusterToAspectConverter(@NotNull IdentifiersProvider identifiers) 34 | { 35 | super(identifiers); 36 | } 37 | 38 | @NotNull 39 | public abstract MetadataChangeProposalWrapper convert(@NotNull Metadata cluster) throws Exception; 40 | } 41 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/datahub/EmitterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.cassandra.sidecar.datahub; 21 | 22 | import datahub.client.Emitter; 23 | import org.jetbrains.annotations.NotNull; 24 | 25 | /** 26 | * A functional interface that has to be extended in order to provide a new, 27 | * fresh instance of a DataHub {@link Emitter} for each schema reporting event 28 | */ 29 | @FunctionalInterface 30 | public interface EmitterFactory 31 | { 32 | @NotNull 33 | Emitter emitter(); 34 | } 35 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/exceptions/ConfigurationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.exceptions; 20 | 21 | /** 22 | * Exception thrown when an error occurs during configuration processing. It could be thrown when configuration is 23 | * missing, invalid or not supported. 24 | */ 25 | public class ConfigurationException extends RuntimeException 26 | { 27 | public ConfigurationException(String message) 28 | { 29 | super(message); 30 | } 31 | 32 | public ConfigurationException(String message, Throwable cause) 33 | { 34 | super(message, cause); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/exceptions/OperationalJobConflictException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.exceptions; 20 | 21 | import org.apache.cassandra.sidecar.common.server.exceptions.OperationalJobException; 22 | 23 | /** 24 | * When the operational job to be submitted is conflicting with another one that is running on Cassandra 25 | */ 26 | public class OperationalJobConflictException extends OperationalJobException 27 | { 28 | public OperationalJobConflictException(String message) 29 | { 30 | super(message); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/exceptions/RestoreJobException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.exceptions; 20 | 21 | /** 22 | * Exception thrown when operations related to restore data into Cassandra through Sidecar feature fails 23 | */ 24 | public class RestoreJobException extends Exception 25 | { 26 | public RestoreJobException(String message) 27 | { 28 | super(message); 29 | } 30 | 31 | public RestoreJobException(String message, Throwable cause) 32 | { 33 | super(message, cause); 34 | } 35 | 36 | /** 37 | * Indicate whether the failed operation is retryable 38 | * @return true 39 | */ 40 | public boolean retryable() 41 | { 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/exceptions/RestoreJobFatalException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.exceptions; 20 | 21 | /** 22 | * Exception thrown when operations related to restore data into Cassandra through Sidecar feature results in fatal 23 | * error and operation can't be retried 24 | */ 25 | public class RestoreJobFatalException extends RestoreJobException 26 | { 27 | public RestoreJobFatalException(String message) 28 | { 29 | super(message); 30 | } 31 | 32 | public RestoreJobFatalException(String message, Throwable cause) 33 | { 34 | super(message, cause); 35 | } 36 | 37 | /** 38 | * A fatal exception thrown during the restore job is not retryable 39 | * @return false 40 | */ 41 | @Override 42 | public boolean retryable() 43 | { 44 | return false; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/handlers/AccessProtected.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.handlers; 20 | 21 | import java.util.Set; 22 | 23 | import io.vertx.core.Handler; 24 | import io.vertx.ext.auth.authorization.Authorization; 25 | 26 | /** 27 | * Interface for authorized handler that defines the set of {@link Authorization}s required by the implementing 28 | * {@link Handler}. 29 | */ 30 | public interface AccessProtected 31 | { 32 | /** 33 | * @return the set of required authorizations 34 | */ 35 | Set requiredAuthorizations(); 36 | } 37 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/handlers/cdc/ConfigPayloadParams.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.cassandra.sidecar.handlers.cdc; 19 | 20 | /** 21 | * ConfigPayload parameters names 22 | */ 23 | public class ConfigPayloadParams 24 | { 25 | public static final String SERVICE = "service"; 26 | public static final String SERVICES = "services"; 27 | public static final String CONFIG = "config"; 28 | } 29 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/metrics/server/CacheMetrics.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.metrics.server; 20 | 21 | import com.codahale.metrics.MetricRegistry; 22 | import org.apache.cassandra.sidecar.metrics.CacheStatsCounter; 23 | 24 | import static org.apache.cassandra.sidecar.handlers.snapshots.ListSnapshotHandler.SNAPSHOT_CACHE_NAME; 25 | 26 | /** 27 | * Tracks metrics related to internal caches. 28 | */ 29 | public class CacheMetrics 30 | { 31 | public final CacheStatsCounter snapshotCacheMetrics; 32 | 33 | public CacheMetrics(MetricRegistry globalMetricRegistry) 34 | { 35 | snapshotCacheMetrics = new CacheStatsCounter(globalMetricRegistry, SNAPSHOT_CACHE_NAME); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/modules/multibindings/ClassKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.modules.multibindings; 20 | 21 | /** 22 | * Key for map bindings. Defines the type lower bound in {@link KeyClassMapKey} value 23 | */ 24 | public interface ClassKey {} 25 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/modules/multibindings/IdentityMultiBindingTypeResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.modules.multibindings; 20 | 21 | import java.util.Map; 22 | 23 | /** 24 | * A MultiBindingTypeResolver that resolves the bindings in the map binder to themselves. 25 | * @param bound value type 26 | */ 27 | public class IdentityMultiBindingTypeResolver implements MultiBindingTypeResolver 28 | { 29 | private final Map, V> mapBindings; 30 | 31 | public IdentityMultiBindingTypeResolver(Map, V> mapBindings) 32 | { 33 | this.mapBindings = mapBindings; // It is a no-op resolver. Pass the map as-is. 34 | } 35 | 36 | @Override 37 | public Map, V> resolve() 38 | { 39 | return mapBindings; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/modules/multibindings/KeyClassMapKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.modules.multibindings; 20 | 21 | import java.lang.annotation.Documented; 22 | import java.lang.annotation.ElementType; 23 | import java.lang.annotation.Retention; 24 | import java.lang.annotation.RetentionPolicy; 25 | import java.lang.annotation.Target; 26 | 27 | import com.google.inject.multibindings.MapKey; 28 | import com.google.inject.multibindings.ProvidesIntoMap; 29 | 30 | /** 31 | * Allows {@literal @}{@link ProvidesIntoMap} to specify a {@link ClassKey} class as map key. 32 | * The class must extends from {@link ClassKey} 33 | *

The annotation name {@link KeyClassMapKey} is read as "map key type is of {@link ClassKey} class" 34 | */ 35 | @MapKey(unwrapValue = true) 36 | @Documented 37 | @Target(ElementType.METHOD) 38 | @Retention(RetentionPolicy.RUNTIME) 39 | public @interface KeyClassMapKey 40 | { 41 | Class value(); 42 | } 43 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/modules/multibindings/MultiBindingTypeResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.modules.multibindings; 20 | 21 | import java.util.Map; 22 | 23 | import org.jetbrains.annotations.NotNull; 24 | 25 | /** 26 | * Resolves the types contained in map bindings created from {@link com.google.inject.multibindings.MapBinder} 27 | * Note that the key type of the map is {@code Class} in order to permit flexible extension 28 | * @param map binding value type 29 | */ 30 | public interface MultiBindingTypeResolver 31 | { 32 | /** 33 | * Resolves the types contained in map bindings created from {@link com.google.inject.multibindings.MapBinder} 34 | * 35 | * @return resolved map bindings. The returned value should never be null. 36 | */ 37 | @NotNull 38 | Map, V> resolve(); 39 | } 40 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/modules/multibindings/TableSchemaMapKeys.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.modules.multibindings; 20 | 21 | /** 22 | * Class keys in the {@link com.google.inject.multibindings.MapBinder} to {@link org.apache.cassandra.sidecar.db.schema.TableSchema} objects 23 | */ 24 | public interface TableSchemaMapKeys 25 | { 26 | interface ConfigsSchemaKey extends ClassKey {} 27 | interface RestoreJobsSchemaKey extends ClassKey {} 28 | interface RestoreRangesSchemaKey extends ClassKey {} 29 | interface RestoreSlicesSchemaKey extends ClassKey {} 30 | interface SidecarLeaseSchemaKey extends ClassKey {} 31 | interface SidecarRolePermissionsSchemaKey extends ClassKey {} 32 | interface SystemAuthSchemaKey extends ClassKey {} 33 | interface SystemViewsSchemaKey extends ClassKey {} 34 | } 35 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/restore/RestoreRangeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.restore; 20 | 21 | import io.vertx.core.Handler; 22 | import io.vertx.core.Promise; 23 | import org.apache.cassandra.sidecar.db.RestoreRange; 24 | 25 | /** 26 | * A handler that processes a restore slice 27 | */ 28 | public interface RestoreRangeHandler extends Handler> 29 | { 30 | /** 31 | * @return range the handler processes 32 | */ 33 | RestoreRange range(); 34 | 35 | /** 36 | * @return the elapsed time in nanoseconds if the task has started processing, -1 otherwise 37 | */ 38 | long elapsedInNanos(); 39 | } 40 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/routes/RoutingOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.routes; 20 | 21 | /** 22 | * Control the routing order when the precise ordering is desired. 23 | * For example, the auth handler should be evaluated the first, regardless of the declaration order. 24 | * The route order can be specified via {@linkplain io.vertx.ext.web.Route#order(int)}. 25 | * Note that routes can be specified with the same order value. In such case, the effective order is 26 | * determined by the declaration order in the code. See {@code org.apache.cassandra.sidecar.routes.VertxRoutingTest} 27 | */ 28 | public enum RoutingOrder 29 | { 30 | HIGHEST(Integer.MIN_VALUE), 31 | HIGHER(-2), 32 | HIGH(-1), 33 | DEFAULT(0), 34 | LOW(1), 35 | LOWEST(Integer.MAX_VALUE), 36 | ; 37 | 38 | public final int order; 39 | 40 | RoutingOrder(int order) 41 | { 42 | this.order = order; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/routes/VertxRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.routes; 20 | 21 | import java.util.function.Consumer; 22 | 23 | import io.vertx.ext.web.Router; 24 | 25 | /** 26 | * Defines a vert.x route. 27 | */ 28 | public interface VertxRoute 29 | { 30 | /** 31 | * Mount the route to router 32 | * @param router vertx router for routes definition 33 | */ 34 | void mountTo(Router router); 35 | 36 | /** 37 | * A helper method to consume from {@link Router} and define route 38 | * @param routerConsumer router consumer 39 | * @return vertx route 40 | */ 41 | static VertxRoute create(Consumer routerConsumer) 42 | { 43 | return routerConsumer::accept; 44 | } 45 | 46 | /** 47 | * An empty vertx route that does not mount anything to the router 48 | */ 49 | VertxRoute EMPTY = create(r -> {}); 50 | } 51 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/tasks/ScheduleDecision.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.tasks; 20 | 21 | /** 22 | * Determines whether executions can proceed, be skipped, or the {@link PeriodicTask} should be rescheduled 23 | */ 24 | public enum ScheduleDecision 25 | { 26 | /** 27 | * Execute the current run and continue to schedule the next run in {@link PeriodicTask#delay()} 28 | */ 29 | EXECUTE, 30 | 31 | /** 32 | * Skip the current run and continue to schedule the next run in {@link PeriodicTask#delay()} 33 | */ 34 | SKIP, 35 | 36 | /** 37 | * Similar to {@link SKIP}. Skip the current run, but schedule the next run in {@link PeriodicTask#initialDelay()} 38 | */ 39 | RESCHEDULE; 40 | } 41 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/utils/DigestAlgorithm.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.utils; 20 | 21 | import java.io.Closeable; 22 | 23 | /** 24 | * Abstraction for digest algorithms 25 | */ 26 | public interface DigestAlgorithm extends Closeable 27 | { 28 | /** 29 | * Updates the value of the digest with buf[off:off+len]. 30 | * 31 | * @param buf the input data 32 | * @param off the start offset in buf 33 | * @param len the number of bytes to hash 34 | */ 35 | void update(byte[] buf, int off, int len); 36 | 37 | /** 38 | * @return String value of the digest 39 | */ 40 | String digest(); 41 | } 42 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/utils/DigestAlgorithmProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.utils; 20 | 21 | /** 22 | * Provides a digest algorithm implementation 23 | */ 24 | public interface DigestAlgorithmProvider 25 | { 26 | /** 27 | * @return a new digest algorithm instance with default seed 0 28 | */ 29 | default DigestAlgorithm get() 30 | { 31 | return get(0); 32 | } 33 | 34 | /** 35 | * @param seed seed for digest algorithm 36 | * @return a new digest algorithm instance with the provided seed 37 | */ 38 | DigestAlgorithm get(int seed); 39 | } 40 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/utils/DigestVerifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.utils; 20 | 21 | import io.vertx.core.Future; 22 | 23 | /** 24 | * Interface to verify integrity of SSTables uploaded. 25 | *

26 | * Note: If digest calculations of multiple files are happening at the same time, we would want to limit concurrent 27 | * digest calculations. Since {@link DigestVerifier} is currently used only by upload handler, we are not 28 | * introducing another limit here. Concurrent uploads limit should limit concurrent digest calculations as well. 29 | */ 30 | public interface DigestVerifier 31 | { 32 | /** 33 | * @param filePath path to SSTable component 34 | * @return a future String with the component path if verification is a success, otherwise a failed future 35 | */ 36 | Future verify(String filePath); 37 | } 38 | -------------------------------------------------------------------------------- /server/src/main/java/org/apache/cassandra/sidecar/utils/TimeProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.utils; 20 | 21 | /** 22 | * A clock (time provider) to get the current time 23 | */ 24 | public interface TimeProvider 25 | { 26 | TimeProvider DEFAULT_TIME_PROVIDER = new TimeProvider() 27 | { 28 | public long currentTimeMillis() 29 | { 30 | return System.currentTimeMillis(); 31 | } 32 | 33 | public long nanoTime() 34 | { 35 | return System.nanoTime(); 36 | } 37 | }; 38 | 39 | /** 40 | * @return the current time in milliseconds 41 | */ 42 | long currentTimeMillis(); 43 | 44 | /** 45 | * @return the current value of the high-resolution time source in nanosecond. 46 | */ 47 | default long nanoTime() 48 | { 49 | throw new UnsupportedOperationException("Nano time is unsupported"); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /server/src/test/integration/org/apache/cassandra/distributed/impl/AbstractClusterUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.distributed.impl; 20 | 21 | /** 22 | * Utility class to interact with protected methods in AbstractCluster 23 | */ 24 | public class AbstractClusterUtils 25 | { 26 | public static InstanceConfig createInstanceConfig(AbstractCluster cluster, int nodeNumber) 27 | { 28 | return cluster.createInstanceConfig(nodeNumber); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /server/src/test/integration/org/apache/cassandra/testing/AuthMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.testing; 20 | 21 | /** 22 | * Auth settings for Cassandra cluster 23 | */ 24 | public enum AuthMode 25 | { 26 | /** 27 | * Cassandra is configured with no authentication 28 | */ 29 | NONE, 30 | 31 | /** 32 | * Cassandra is configured with the PasswordAuthenticator 33 | */ 34 | PASSWORD, 35 | 36 | /** 37 | * Cassandra is configured with the MutualTLSWithPasswordFallbackAuthenticator 38 | */ 39 | MUTUAL_TLS 40 | } 41 | -------------------------------------------------------------------------------- /server/src/test/integration/org/apache/cassandra/testing/TestVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.testing; 20 | 21 | /** 22 | * Works with {@link TestVersionSupplier} 23 | */ 24 | public class TestVersion 25 | { 26 | private final String version; 27 | 28 | public TestVersion(String version) 29 | { 30 | this.version = version; 31 | } 32 | 33 | public String version() 34 | { 35 | return version; 36 | } 37 | 38 | @Override 39 | public String toString() 40 | { 41 | return version; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /server/src/test/java/org/apache/cassandra/sidecar/HealthServiceSslTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar; 20 | 21 | import org.junit.jupiter.api.DisplayName; 22 | import org.junit.jupiter.api.extension.ExtendWith; 23 | 24 | import io.vertx.junit5.VertxExtension; 25 | 26 | /** 27 | * Health Service SSL Tests 28 | */ 29 | @DisplayName("Health Service SSL Test") 30 | @ExtendWith(VertxExtension.class) 31 | public class HealthServiceSslTest extends AbstractHealthServiceTest 32 | { 33 | @Override 34 | public boolean isSslEnabled() 35 | { 36 | return true; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /server/src/test/java/org/apache/cassandra/sidecar/HealthServiceTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar; 20 | 21 | import org.junit.jupiter.api.DisplayName; 22 | import org.junit.jupiter.api.extension.ExtendWith; 23 | 24 | import io.vertx.junit5.VertxExtension; 25 | 26 | /** 27 | * Health Service Tests 28 | */ 29 | @DisplayName("Health Service Test") 30 | @ExtendWith(VertxExtension.class) 31 | public class HealthServiceTest extends AbstractHealthServiceTest 32 | { 33 | @Override 34 | public boolean isSslEnabled() 35 | { 36 | return false; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /server/src/test/java/org/apache/cassandra/sidecar/cluster/locator/InstanceSetByDcTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.cluster.locator; 20 | 21 | import java.util.Arrays; 22 | import java.util.HashMap; 23 | import java.util.HashSet; 24 | import java.util.Map; 25 | import java.util.Set; 26 | 27 | import org.junit.jupiter.api.Test; 28 | 29 | import static org.assertj.core.api.Assertions.assertThat; 30 | 31 | class InstanceSetByDcTest 32 | { 33 | @Test 34 | void testGetInstanceSetOfDc() 35 | { 36 | InstanceSetByDc empty = new InstanceSetByDc(new HashMap<>()); 37 | assertThat(empty.get("dc1")).isNotNull().isEmpty(); 38 | 39 | Map> mapping = new HashMap<>(); 40 | mapping.put("dc1", new HashSet<>(Arrays.asList("i-1", "i-2"))); 41 | InstanceSetByDc nonEmpty = new InstanceSetByDc(mapping); 42 | assertThat(nonEmpty.get("dc1")).hasSize(2); 43 | assertThat(nonEmpty.get("dc2")).isNotNull().isEmpty(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /server/src/test/java/org/apache/cassandra/sidecar/datahub/TestIdentifiers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.cassandra.sidecar.datahub; 21 | 22 | import org.jetbrains.annotations.NotNull; 23 | 24 | /** 25 | * An implementation of {@link IdentifiersProvider} used for testing 26 | */ 27 | final class TestIdentifiers extends IdentifiersProvider 28 | { 29 | private static final String CLUSTER = "cluster"; 30 | 31 | @Override 32 | @NotNull 33 | public String cluster() 34 | { 35 | return CLUSTER; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /server/src/test/java/org/apache/cassandra/sidecar/db/RestoreJobDatabaseAccessorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.db; 20 | 21 | import org.junit.jupiter.api.Test; 22 | 23 | import com.datastax.driver.core.LocalDate; 24 | 25 | import static org.assertj.core.api.Assertions.assertThat; 26 | 27 | class RestoreJobDatabaseAccessorTest 28 | { 29 | @Test 30 | void testDaysInPast() 31 | { 32 | long now = System.currentTimeMillis(); 33 | LocalDate nowLocalDate = LocalDate.fromMillisSinceEpoch(now); 34 | for (int i = 0; i <= 10; i++) 35 | { 36 | LocalDate pastDate = RestoreJobDatabaseAccessor.dateInPast(now, i); 37 | assertThat(pastDate.getDaysSinceEpoch()) 38 | .describedAs(i + " days in the past") 39 | .isEqualTo(nowLocalDate.getDaysSinceEpoch() - i); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /server/src/test/java/org/apache/cassandra/sidecar/mocks/V30.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.mocks; 20 | 21 | import java.net.InetSocketAddress; 22 | 23 | import org.apache.cassandra.sidecar.common.server.CQLSessionProvider; 24 | import org.apache.cassandra.sidecar.common.server.ICassandraAdapter; 25 | import org.apache.cassandra.sidecar.common.server.ICassandraFactory; 26 | import org.apache.cassandra.sidecar.common.server.JmxClient; 27 | import org.apache.cassandra.sidecar.common.server.MinimumVersion; 28 | 29 | /** 30 | * Placeholder for 3.0 31 | */ 32 | @MinimumVersion("3.0.0") 33 | public class V30 implements ICassandraFactory 34 | { 35 | @Override 36 | public ICassandraAdapter create(CQLSessionProvider session, 37 | JmxClient jmxClient, 38 | InetSocketAddress localNativeTransportAddress) 39 | { 40 | return null; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /server/src/test/java/org/apache/cassandra/sidecar/mocks/V40.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.mocks; 20 | 21 | import java.net.InetSocketAddress; 22 | 23 | import org.apache.cassandra.sidecar.common.server.CQLSessionProvider; 24 | import org.apache.cassandra.sidecar.common.server.ICassandraAdapter; 25 | import org.apache.cassandra.sidecar.common.server.ICassandraFactory; 26 | import org.apache.cassandra.sidecar.common.server.JmxClient; 27 | import org.apache.cassandra.sidecar.common.server.MinimumVersion; 28 | 29 | /** 30 | * Placeholder for 4.0 31 | */ 32 | @MinimumVersion("4.0.0") 33 | public class V40 implements ICassandraFactory 34 | { 35 | @Override 36 | public ICassandraAdapter create(CQLSessionProvider session, 37 | JmxClient jmxClient, 38 | InetSocketAddress localNativeTransportAddress) 39 | { 40 | return null; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /server/src/test/java/org/apache/cassandra/sidecar/mocks/V41.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.mocks; 20 | 21 | import java.net.InetSocketAddress; 22 | 23 | import org.apache.cassandra.sidecar.common.server.CQLSessionProvider; 24 | import org.apache.cassandra.sidecar.common.server.ICassandraAdapter; 25 | import org.apache.cassandra.sidecar.common.server.ICassandraFactory; 26 | import org.apache.cassandra.sidecar.common.server.JmxClient; 27 | import org.apache.cassandra.sidecar.common.server.MinimumVersion; 28 | 29 | /** 30 | * Placeholder for 4.1 31 | */ 32 | @MinimumVersion("4.1.0") 33 | public class V41 implements ICassandraFactory 34 | { 35 | @Override 36 | public ICassandraAdapter create(CQLSessionProvider session, 37 | JmxClient jmxClient, 38 | InetSocketAddress localNativeTransportAddress) 39 | { 40 | return null; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /server/src/test/java/org/apache/cassandra/sidecar/utils/TestMetricUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.utils; 20 | 21 | import com.codahale.metrics.MetricRegistry; 22 | import com.codahale.metrics.SharedMetricRegistries; 23 | 24 | /** 25 | * Utility methods to retrieve {@link MetricRegistry} during testing 26 | */ 27 | public class TestMetricUtils 28 | { 29 | public static MetricRegistry registry() 30 | { 31 | return SharedMetricRegistries.getOrCreate("cassandra_sidecar"); 32 | } 33 | 34 | public static MetricRegistry registry(int instanceId) 35 | { 36 | String registryName = "cassandra_sidecar_" + instanceId; 37 | return SharedMetricRegistries.getOrCreate(registryName); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /server/src/test/resources/certs/ca.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cassandra-sidecar/00b431ad1d5051a1575a1d7f026e204f116487e0/server/src/test/resources/certs/ca.p12 -------------------------------------------------------------------------------- /server/src/test/resources/certs/client_keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cassandra-sidecar/00b431ad1d5051a1575a1d7f026e204f116487e0/server/src/test/resources/certs/client_keystore.jks -------------------------------------------------------------------------------- /server/src/test/resources/certs/client_keystore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cassandra-sidecar/00b431ad1d5051a1575a1d7f026e204f116487e0/server/src/test/resources/certs/client_keystore.p12 -------------------------------------------------------------------------------- /server/src/test/resources/certs/expired_server_keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cassandra-sidecar/00b431ad1d5051a1575a1d7f026e204f116487e0/server/src/test/resources/certs/expired_server_keystore.jks -------------------------------------------------------------------------------- /server/src/test/resources/certs/expired_server_keystore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cassandra-sidecar/00b431ad1d5051a1575a1d7f026e204f116487e0/server/src/test/resources/certs/expired_server_keystore.p12 -------------------------------------------------------------------------------- /server/src/test/resources/certs/server_keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cassandra-sidecar/00b431ad1d5051a1575a1d7f026e204f116487e0/server/src/test/resources/certs/server_keystore.jks -------------------------------------------------------------------------------- /server/src/test/resources/certs/server_keystore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cassandra-sidecar/00b431ad1d5051a1575a1d7f026e204f116487e0/server/src/test/resources/certs/server_keystore.p12 -------------------------------------------------------------------------------- /server/src/test/resources/certs/test.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cassandra-sidecar/00b431ad1d5051a1575a1d7f026e204f116487e0/server/src/test/resources/certs/test.p12 -------------------------------------------------------------------------------- /server/src/test/resources/certs/truststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cassandra-sidecar/00b431ad1d5051a1575a1d7f026e204f116487e0/server/src/test/resources/certs/truststore.jks -------------------------------------------------------------------------------- /server/src/test/resources/certs/truststore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cassandra-sidecar/00b431ad1d5051a1575a1d7f026e204f116487e0/server/src/test/resources/certs/truststore.p12 -------------------------------------------------------------------------------- /server/src/test/resources/config/sidecar_custom_allowable_time_skew.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Cassandra SideCar configuration file 3 | # 4 | cassandra: 5 | host: localhost 6 | port: 9042 7 | storage_dir: /cassandra/d1 8 | data_dirs: /cassandra/d1/data, /cassandra/d2/data 9 | jmx_host: 127.0.0.1 10 | jmx_port: 7199 11 | jmx_role: controlRole 12 | jmx_role_password: controlPassword 13 | jmx_ssl_enabled: true 14 | 15 | sidecar: 16 | host: 0.0.0.0 17 | port: 1234 18 | request_idle_timeout: 500s 19 | request_timeout: 20m 20 | allowable_time_skew: 1m 21 | -------------------------------------------------------------------------------- /server/src/test/resources/config/sidecar_driver_params.yaml: -------------------------------------------------------------------------------- 1 | driver_parameters: 2 | contact_points: 3 | - "127.0.0.1:9042" 4 | - "127.0.0.2:9042" 5 | username: cassandra 6 | password: cassandra 7 | ssl: 8 | enabled: true 9 | accepted_protocols: 10 | - TLSv1.2 11 | - TLSv1.3 12 | keystore: 13 | type: PKCS12 14 | path: path/to/keystore.p12 15 | password: password 16 | truststore: 17 | type: PKCS12 18 | path: path/to/keystore.p12 19 | password: password 20 | num_connections: 6 21 | local_dc: dc1 -------------------------------------------------------------------------------- /server/src/test/resources/config/sidecar_invalid_metrics.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | # 20 | # Cassandra SideCar configuration file 21 | # 22 | cassandra: 23 | host: localhost 24 | port: 9042 25 | storage_dir: /cassandra/d1 26 | data_dirs: /cassandra/d1/data, /cassandra/d2/data 27 | jmx_host: 127.0.0.1 28 | jmx_port: 7199 29 | jmx_role: controlRole 30 | jmx_role_password: controlPassword 31 | jmx_ssl_enabled: true 32 | 33 | sidecar: 34 | host: 0.0.0.0 35 | port: 1234 36 | request_idle_timeout: 500s 37 | request_timeout: 20m 38 | allowable_time_skew: 1m 39 | 40 | metrics: 41 | registry_name: cassandra_sidecar_metrics 42 | vertx: 43 | enabled: true 44 | expose_via_jmx: false 45 | jmx_domain_name: sidecar.vertx.jmx_domain 46 | exclude: 47 | - type: "contains" 48 | value: "vertx" 49 | -------------------------------------------------------------------------------- /server/src/test/resources/config/sidecar_validation_configuration.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Cassandra SideCar configuration file 3 | # 4 | cassandra: 5 | host: localhost 6 | port: 9042 7 | storage_dir: /cassandra/d1 8 | data_dirs: /cassandra/d1/data, /cassandra/d2/data 9 | jmx_host: 127.0.0.1 10 | jmx_port: 7199 11 | jmx_role: controlRole 12 | jmx_role_password: controlPassword 13 | jmx_ssl_enabled: true 14 | 15 | sidecar: 16 | host: 0.0.0.0 17 | port: 1234 18 | request_idle_timeout: 500s 19 | request_timeout: 20m 20 | throttle: 21 | stream_requests_per_sec: 80 22 | timeout: 21s 23 | allowable_time_skew: 89m 24 | sstable_import: 25 | execute_interval: 50ms 26 | 27 | cassandra_input_validation: 28 | forbidden_keyspaces: 29 | - a 30 | - b 31 | - c 32 | allowed_chars_for_directory: "[a-z]+" 33 | allowed_chars_for_quoted_name: "[A-Z]+" 34 | allowed_chars_for_component_name: "(.db|.cql|.json|.crc32|TOC.txt)" 35 | allowed_chars_for_restricted_component_name: "(.db|TOC.txt)" 36 | -------------------------------------------------------------------------------- /server/src/test/resources/config/sidecar_with_single_multiple_instances.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Cassandra SideCar configuration file 3 | # 4 | cassandra: 5 | host: localhost 6 | port: 9042 7 | storage_dir: /cassandra/d1 8 | data_dirs: /cassandra/d1/data, /cassandra/d2/data 9 | jmx_host: 127.0.0.1 10 | jmx_port: 7199 11 | jmx_role: controlRole 12 | jmx_role_password: controlPassword 13 | jmx_ssl_enabled: true 14 | 15 | cassandra_instances: 16 | - id: 1 17 | host: localhost1 18 | port: 9042 19 | storage_dir: /cassandra/d1 20 | data_dirs: /cassandra/d1/data, /cassandra/d2/data 21 | jmx_host: 127.0.0.1 22 | jmx_port: 7100 23 | jmx_role: controlRole 24 | jmx_role_password: controlPassword 25 | jmx_ssl_enabled: true 26 | - id: 2 27 | host: localhost2 28 | port: 9042 29 | storage_dir: /cassandra/d3 30 | data_dirs: /cassandra/d3/data, /cassandra/d4/data 31 | jmx_host: 127.0.0.1 32 | jmx_port: 7200 33 | jmx_role: controlRole 34 | jmx_role_password: controlPassword 35 | jmx_ssl_enabled: true 36 | 37 | sidecar: 38 | host: 0.0.0.0 39 | port: 9043 40 | throttle: 41 | stream_requests_per_sec: 5000 42 | timeout: 10s 43 | allowable_time_skew: 1h 44 | jmx: 45 | connection: 46 | max_retries: 40 47 | retry_delay: 2s 48 | # 49 | # Enable SSL configuration (Disabled by default) 50 | # 51 | # - ssl: 52 | # - enabled: true 53 | # - keystore: 54 | # - path: "path/to/keystore.p12" 55 | # - password: password 56 | # - truststore: 57 | # - path: "path/to/truststore.p12" 58 | # - password: password 59 | 60 | 61 | healthcheck: 62 | poll_freq_millis: 30000 63 | -------------------------------------------------------------------------------- /server/src/test/resources/datahub/empty_cluster.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "aspectName" : "dataPlatformInfo", 4 | "entityUrn" : "urn:li:dataPlatform:cassandra", 5 | "entityType" : "dataPlatform", 6 | "changeType" : "UPSERT", 7 | "aspect" : { 8 | "contentType" : "application/json", 9 | "value" : "{\"name\":\"cassandra\",\"datasetNameDelimiter\":\".\",\"type\":\"RELATIONAL_DB\",\"displayName\":\"Cassandra\"}" 10 | } 11 | }, 12 | { 13 | "aspectName" : "dataPlatformInstanceProperties", 14 | "entityUrn" : "urn:li:dataPlatformInstance:(urn:li:dataPlatform:cassandra,ace3ba6b-49b2-3dd5-955a-1de13730188b)", 15 | "entityType" : "dataPlatformInstance", 16 | "changeType" : "UPSERT", 17 | "aspect" : { 18 | "contentType" : "application/json", 19 | "value" : "{\"name\":\"ace3ba6b-49b2-3dd5-955a-1de13730188b\",\"customProperties\":{\"cluster\":\"cluster\",\"environment\":\"ENVIRONMENT\",\"application\":\"application\"}}" 20 | } 21 | } 22 | ] -------------------------------------------------------------------------------- /server/src/test/resources/instance1/cdc_raw/CommitLog-1-1.log: -------------------------------------------------------------------------------- 1 | x -------------------------------------------------------------------------------- /server/src/test/resources/instance1/cdc_raw/CommitLog-1-1_cdc.idx: -------------------------------------------------------------------------------- 1 | 1 2 | COMPLETED -------------------------------------------------------------------------------- /server/src/test/resources/instance1/cdc_raw/CommitLog-1-2.log: -------------------------------------------------------------------------------- 1 | xxxx -------------------------------------------------------------------------------- /server/src/test/resources/instance1/cdc_raw/CommitLog-1-2_cdc.idx: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /server/src/test/resources/instance1/cdc_raw/CommitLog-1-3.log: -------------------------------------------------------------------------------- 1 | xxx -------------------------------------------------------------------------------- /server/src/test/resources/instance1/data/TestKeyspace/TestTable-54ea95cebba24e0aa9bee428e5d7160b/snapshots/TestSnapshot/nb-1-big-Data.db: -------------------------------------------------------------------------------- 1 | data -------------------------------------------------------------------------------- /server/src/test/resources/instance2/data/TestKeyspace/TestTable-54ea95cebba24e0aa9bee428e5d7160b/snapshots/TestSnapshot/nb-1-big-Data.db: -------------------------------------------------------------------------------- 1 | data -------------------------------------------------------------------------------- /server/src/test/resources/instance3/data/TestKeyspace/TestTable-54ea95cebba24e0aa9bee428e5d7160b/snapshots/TestSnapshot/nb-1-big-Data.db: -------------------------------------------------------------------------------- 1 | data -------------------------------------------------------------------------------- /server/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | DEBUG 25 | 26 | 27 | %-5level [%thread] %date{ISO8601} %F:%L - %msg%n 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /server/src/test/resources/sidecar.version: -------------------------------------------------------------------------------- 1 | version-string-to-be-read-by-MainModuleTest -------------------------------------------------------------------------------- /server/src/test/resources/test_unzip.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cassandra-sidecar/00b431ad1d5051a1575a1d7f026e204f116487e0/server/src/test/resources/test_unzip.zip -------------------------------------------------------------------------------- /server/src/test/resources/test_unzip_malformed.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/cassandra-sidecar/00b431ad1d5051a1575a1d7f026e204f116487e0/server/src/test/resources/test_unzip_malformed.zip -------------------------------------------------------------------------------- /server/src/testFixtures/java/org/apache/cassandra/sidecar/config/yaml/TestServiceConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.config.yaml; 20 | 21 | 22 | import org.apache.cassandra.sidecar.config.ServiceConfiguration; 23 | 24 | /** 25 | * A ServiceConfiguration implementation created for test. 26 | * It binds to "0.0.0.0" and port 0 to find an available port at test runtime 27 | */ 28 | public class TestServiceConfiguration extends ServiceConfigurationImpl 29 | { 30 | public static ServiceConfiguration newInstance() 31 | { 32 | return builder().build(); 33 | } 34 | 35 | public static Builder builder() 36 | { 37 | return ServiceConfigurationImpl.builder() 38 | // bind to 0.0.0.0 to allow sidecar client to query all cassandra node, rather than only 127.0.0.1 39 | .host("0.0.0.0") 40 | .port(0); // let the test find an available port 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | rootProject.name = "cassandra-sidecar" 21 | 22 | // The client code supports Java 8+ 23 | include "client" 24 | include "client-common" 25 | include "vertx-client" 26 | include "vertx-client-shaded" 27 | 28 | // The server code supports Java 11, but it doesn't support Java 8 29 | if (JavaVersion.current().isJava11Compatible()) { 30 | include "adapters:adapters-base" 31 | include "adapters:adapters-cassandra41" 32 | include "docs" 33 | include "server" 34 | include "server-common" 35 | include "vertx-auth-mtls" 36 | include "integration-framework" 37 | include 'integration-tests' 38 | include 'test-common' 39 | } 40 | -------------------------------------------------------------------------------- /test-common/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | plugins { 21 | id('java-library') 22 | id('java-test-fixtures') 23 | } 24 | 25 | version project.version 26 | 27 | sourceCompatibility = JavaVersion.VERSION_11 28 | dependencies { 29 | testFixturesCompileOnly(group: 'io.vertx', name: 'vertx-core', version: "${project.vertxVersion}") 30 | testFixturesCompileOnly(group: 'com.google.guava', name: 'guava', version: "${project.guavaVersion}") 31 | 32 | // Bouncycastle dependencies for test certificate provisioning 33 | testFixturesImplementation(group: 'org.bouncycastle', name: 'bcprov-jdk18on', version: '1.78') 34 | testFixturesImplementation(group: 'org.bouncycastle', name: 'bcpkix-jdk18on', version: '1.78') 35 | } 36 | -------------------------------------------------------------------------------- /vertx-auth-mtls/src/main/java/io/vertx/ext/auth/mtls/impl/AllowAllCertificateValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.vertx.ext.auth.mtls.impl; 20 | 21 | import io.vertx.ext.auth.authentication.CertificateCredentials; 22 | import io.vertx.ext.auth.mtls.CertificateValidator; 23 | 24 | /** 25 | * {@link AllowAllCertificateValidator} can be used when certificate specific details are not required to be 26 | * validated. Use {@link CertificateValidatorImpl} if specific details like CN, issuer organization 27 | * are to be verified. 28 | */ 29 | public class AllowAllCertificateValidator implements CertificateValidator 30 | { 31 | /** 32 | * Marks all shared {@link CertificateCredentials} as valid. 33 | * 34 | * @param credentials client credentials shared 35 | */ 36 | @Override 37 | public void verifyCertificate(CertificateCredentials credentials) 38 | { 39 | // do nothing 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /vertx-auth-mtls/src/test/java/io/vertx/ext/auth/mtls/impl/MutualTlsUserTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.vertx.ext.auth.mtls.impl; 20 | 21 | import java.util.Arrays; 22 | 23 | import org.junit.jupiter.api.Test; 24 | 25 | import static org.assertj.core.api.Assertions.assertThat; 26 | 27 | /** 28 | * Test for {@link MutualTlsUser} 29 | */ 30 | public class MutualTlsUserTest 31 | { 32 | @Test 33 | public void testPrincipal() 34 | { 35 | MutualTlsUser mutualTlsUser = MutualTlsUser.fromIdentities(Arrays.asList("identity1", "identity2")); 36 | assertThat(mutualTlsUser.identities().size()).isEqualTo(2); 37 | assertThat(mutualTlsUser.principal().containsKey("identities")).isTrue(); 38 | assertThat(mutualTlsUser.principal().getString("identities")).isEqualTo("identity1,identity2"); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vertx-client-shaded/src/test/java/org/apache/cassandra/sidecar/client/test/LibraryTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.client.test; 20 | 21 | import org.junit.jupiter.api.DisplayName; 22 | import org.junit.jupiter.api.Test; 23 | 24 | import o.a.c.sidecar.client.shaded.io.vertx.core.net.OpenSSLEngineOptions; 25 | 26 | import static org.junit.jupiter.api.Assertions.assertTrue; 27 | 28 | /** 29 | * Tests for the vertx-client-shaded project 30 | */ 31 | class LibraryTest 32 | { 33 | @DisplayName("Ensures that the shading is correct for the vertx-client-shaded project") 34 | @Test 35 | void openSslIsAvailable() 36 | { 37 | assertTrue(OpenSSLEngineOptions.isAvailable()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vertx-client/src/main/java/org/apache/cassandra/sidecar/client/SidecarClientVertxRequestExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.cassandra.sidecar.client; 20 | 21 | import io.vertx.core.Vertx; 22 | 23 | import static java.util.Objects.requireNonNull; 24 | 25 | /** 26 | * A {@link RequestExecutor} implementation that uses vertx primitives 27 | */ 28 | public class SidecarClientVertxRequestExecutor extends VertxRequestExecutor 29 | { 30 | private final Vertx vertx; 31 | 32 | public SidecarClientVertxRequestExecutor(VertxHttpClient httpClient) 33 | { 34 | super(httpClient); 35 | this.vertx = requireNonNull(httpClient.vertx(), "The vertx instance is required"); 36 | } 37 | 38 | /** 39 | * @throws Exception Closing the client vertx should not close general Vertx, that's why we are overriding 40 | * the close method from the VertxRequestExecutor class. 41 | */ 42 | @Override 43 | public void close() throws Exception 44 | { 45 | httpClient.close(); 46 | } 47 | } 48 | --------------------------------------------------------------------------------