Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ma2bd committed Jun 15, 2024
1 parent cb95ff5 commit 95d199e
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 24 deletions.
2 changes: 2 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
stack-size-threshold = 200000
future-size-threshold = 20000
1 change: 1 addition & 0 deletions linera-core/src/unit_tests/wasm_client_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// because they are slow and their behavior appears to be correctly check by the
// test with memory.

#![allow(clippy::large_futures)]
#![cfg(any(feature = "wasmer", feature = "wasmtime"))]

use std::collections::BTreeMap;
Expand Down
2 changes: 2 additions & 0 deletions linera-service/src/unit_tests/faucet.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

#![allow(clippy::large_futures)]

use std::sync::Arc;

use async_trait::async_trait;
Expand Down
60 changes: 36 additions & 24 deletions linera-views/src/scylla_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,12 @@ impl AdminKeyValueStore for ScyllaDbStoreInternal {

async fn connect(config: &Self::Config, namespace: &str) -> Result<Self, ScyllaDbContextError> {
Self::check_namespace(namespace)?;
let session = SessionBuilder::new()
.known_node(config.uri.as_str())
.build()
.await?;
let session = Box::pin(
SessionBuilder::new()
.known_node(config.uri.as_str())
.build(),
)
.await?;
let store = ScyllaDbClient::new(session, namespace.to_string());
let store = Arc::new(store);
let semaphore = config
Expand All @@ -452,10 +454,12 @@ impl AdminKeyValueStore for ScyllaDbStoreInternal {
}

async fn list_all(config: &Self::Config) -> Result<Vec<String>, ScyllaDbContextError> {
let session = SessionBuilder::new()
.known_node(config.uri.as_str())
.build()
.await?;
let session = Box::pin(
SessionBuilder::new()
.known_node(config.uri.as_str())
.build(),
)
.await?;
let miss_msg = "'kv' not found in keyspaces";
let mut paging_state = None;
let mut namespaces = Vec::new();
Expand Down Expand Up @@ -500,21 +504,25 @@ impl AdminKeyValueStore for ScyllaDbStoreInternal {
}

async fn delete_all(store_config: &Self::Config) -> Result<(), ScyllaDbContextError> {
let session = SessionBuilder::new()
.known_node(store_config.uri.as_str())
.build()
.await?;
let session = Box::pin(
SessionBuilder::new()
.known_node(store_config.uri.as_str())
.build(),
)
.await?;
let query = "DROP KEYSPACE IF EXISTS kv;".to_string();
session.query(query, &[]).await?;
Ok(())
}

async fn exists(config: &Self::Config, namespace: &str) -> Result<bool, ScyllaDbContextError> {
Self::check_namespace(namespace)?;
let session = SessionBuilder::new()
.known_node(config.uri.as_str())
.build()
.await?;
let session = Box::pin(
SessionBuilder::new()
.known_node(config.uri.as_str())
.build(),
)
.await?;
// We check the way the test can fail. It can fail in different ways.
let query = format!("SELECT dummy FROM kv.{} LIMIT 1 ALLOW FILTERING", namespace);

Expand Down Expand Up @@ -551,10 +559,12 @@ impl AdminKeyValueStore for ScyllaDbStoreInternal {

async fn create(config: &Self::Config, namespace: &str) -> Result<(), ScyllaDbContextError> {
Self::check_namespace(namespace)?;
let session = SessionBuilder::new()
.known_node(config.uri.as_str())
.build()
.await?;
let session = Box::pin(
SessionBuilder::new()
.known_node(config.uri.as_str())
.build(),
)
.await?;
// Create a keyspace if it doesn't exist
let query = "CREATE KEYSPACE IF NOT EXISTS kv WITH REPLICATION = { \
'class' : 'SimpleStrategy', \
Expand All @@ -575,10 +585,12 @@ impl AdminKeyValueStore for ScyllaDbStoreInternal {

async fn delete(config: &Self::Config, namespace: &str) -> Result<(), ScyllaDbContextError> {
Self::check_namespace(namespace)?;
let session = SessionBuilder::new()
.known_node(config.uri.as_str())
.build()
.await?;
let session = Box::pin(
SessionBuilder::new()
.known_node(config.uri.as_str())
.build(),
)
.await?;
let query = format!("DROP TABLE IF EXISTS kv.{};", namespace);
session.query(query, &[]).await?;
Ok(())
Expand Down
2 changes: 2 additions & 0 deletions linera-views/tests/views_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

#![allow(clippy::large_futures)]

#[cfg(any(with_dynamodb, with_rocksdb, with_scylladb))]
use std::collections::BTreeSet;
use std::{
Expand Down

0 comments on commit 95d199e

Please sign in to comment.