Skip to content

Commit 49867a3

Browse files
Replace some "feature = "X"" entries and replace them by "with_X". (#2519)
Also, remove the executable status of `build.rs` files.
1 parent 71de70b commit 49867a3

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

linera-storage-service/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
fn main() -> Result<(), Box<dyn std::error::Error>> {
55
cfg_aliases::cfg_aliases! {
6+
with_rocksdb: { all(feature = "rocksdb") },
67
with_testing: { any(test, feature = "test") },
78
with_metrics: { all(not(target_arch = "wasm32"), feature = "metrics") },
89
};

linera-storage-service/src/server.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use linera_views::{
1212
common::{CommonStoreConfig, ReadableKeyValueStore, WritableKeyValueStore},
1313
memory::MemoryStore,
1414
};
15-
#[cfg(feature = "rocksdb")]
15+
#[cfg(with_rocksdb)]
1616
use linera_views::{
1717
common::AdminKeyValueStore,
1818
rocks_db::{PathWithGuard, RocksDbStore, RocksDbStoreConfig},
@@ -41,7 +41,7 @@ pub mod key_value_store {
4141
enum ServiceStoreServerInternal {
4242
Memory(MemoryStore),
4343
/// The RocksDb key value store
44-
#[cfg(feature = "rocksdb")]
44+
#[cfg(with_rocksdb)]
4545
RocksDb(RocksDbStore),
4646
}
4747

@@ -64,7 +64,7 @@ impl ServiceStoreServer {
6464
.read_value_bytes(key)
6565
.await
6666
.map_err(|e| Status::unknown(format!("Memory error {:?} at read_value_bytes", e))),
67-
#[cfg(feature = "rocksdb")]
67+
#[cfg(with_rocksdb)]
6868
ServiceStoreServerInternal::RocksDb(store) => store
6969
.read_value_bytes(key)
7070
.await
@@ -78,7 +78,7 @@ impl ServiceStoreServer {
7878
.contains_key(key)
7979
.await
8080
.map_err(|e| Status::unknown(format!("Memory error {:?} at contains_key", e))),
81-
#[cfg(feature = "rocksdb")]
81+
#[cfg(with_rocksdb)]
8282
ServiceStoreServerInternal::RocksDb(store) => store
8383
.contains_key(key)
8484
.await
@@ -92,7 +92,7 @@ impl ServiceStoreServer {
9292
.contains_keys(keys)
9393
.await
9494
.map_err(|e| Status::unknown(format!("Memory error {:?} at contains_keys", e))),
95-
#[cfg(feature = "rocksdb")]
95+
#[cfg(with_rocksdb)]
9696
ServiceStoreServerInternal::RocksDb(store) => store
9797
.contains_keys(keys)
9898
.await
@@ -110,7 +110,7 @@ impl ServiceStoreServer {
110110
Status::unknown(format!("Memory error {:?} at read_multi_values_bytes", e))
111111
})
112112
}
113-
#[cfg(feature = "rocksdb")]
113+
#[cfg(with_rocksdb)]
114114
ServiceStoreServerInternal::RocksDb(store) => {
115115
store.read_multi_values_bytes(keys).await.map_err(|e| {
116116
Status::unknown(format!("RocksDB error {:?} at read_multi_values_bytes", e))
@@ -126,7 +126,7 @@ impl ServiceStoreServer {
126126
Status::unknown(format!("Memory error {:?} at find_keys_by_prefix", e))
127127
})
128128
}
129-
#[cfg(feature = "rocksdb")]
129+
#[cfg(with_rocksdb)]
130130
ServiceStoreServerInternal::RocksDb(store) => {
131131
store.find_keys_by_prefix(key_prefix).await.map_err(|e| {
132132
Status::unknown(format!("RocksDB error {:?} at find_keys_by_prefix", e))
@@ -146,7 +146,7 @@ impl ServiceStoreServer {
146146
.map_err(|e| {
147147
Status::unknown(format!("Memory error {:?} at find_key_values_by_prefix", e))
148148
}),
149-
#[cfg(feature = "rocksdb")]
149+
#[cfg(with_rocksdb)]
150150
ServiceStoreServerInternal::RocksDb(store) => store
151151
.find_key_values_by_prefix(key_prefix)
152152
.await
@@ -165,7 +165,7 @@ impl ServiceStoreServer {
165165
.write_batch(batch)
166166
.await
167167
.map_err(|e| Status::unknown(format!("Memory error {:?} at write_batch", e))),
168-
#[cfg(feature = "rocksdb")]
168+
#[cfg(with_rocksdb)]
169169
ServiceStoreServerInternal::RocksDb(store) => store
170170
.write_batch(batch)
171171
.await
@@ -239,7 +239,7 @@ enum ServiceStoreServerOptions {
239239
endpoint: String,
240240
},
241241

242-
#[cfg(feature = "rocksdb")]
242+
#[cfg(with_rocksdb)]
243243
#[command(name = "rocksdb")]
244244
RocksDb {
245245
#[arg(long = "path")]
@@ -579,7 +579,7 @@ async fn main() {
579579
let store = ServiceStoreServerInternal::Memory(store);
580580
(store, endpoint)
581581
}
582-
#[cfg(feature = "rocksdb")]
582+
#[cfg(with_rocksdb)]
583583
ServiceStoreServerOptions::RocksDb { path, endpoint } => {
584584
let path_buf = path.into();
585585
let path_with_guard = PathWithGuard::new(path_buf);

linera-views/src/backends/scylla_db.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -913,10 +913,10 @@ impl ScyllaDbStore {
913913

914914
fn from_inner(simple_store: ScyllaDbStoreInternal, cache_size: usize) -> ScyllaDbStore {
915915
let store = JournalingKeyValueStore::new(simple_store);
916-
#[cfg(feature = "metrics")]
916+
#[cfg(with_metrics)]
917917
let store = MeteredStore::new(&SCYLLA_DB_METRICS, store);
918918
let store = LruCachingStore::new(store, cache_size);
919-
#[cfg(feature = "metrics")]
919+
#[cfg(with_metrics)]
920920
let store = MeteredStore::new(&LRU_CACHING_METRICS, store);
921921
Self { store }
922922
}

linera-views/tests/admin_tests.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright (c) Zefchain Labs, Inc.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
#[cfg(feature = "dynamodb")]
4+
#[cfg(with_dynamodb)]
55
use linera_views::dynamo_db::DynamoDbStore;
6-
#[cfg(feature = "rocksdb")]
6+
#[cfg(with_rocksdb)]
77
use linera_views::rocks_db::RocksDbStore;
8-
#[cfg(feature = "scylladb")]
8+
#[cfg(with_scylladb)]
99
use linera_views::scylla_db::ScyllaDbStore;
1010
use linera_views::{memory::MemoryStore, test_utils::admin_test};
1111

@@ -14,19 +14,19 @@ async fn admin_test_memory() {
1414
admin_test::<MemoryStore>().await;
1515
}
1616

17-
#[cfg(feature = "rocksdb")]
17+
#[cfg(with_rocksdb)]
1818
#[tokio::test]
1919
async fn admin_test_rocks_db() {
2020
admin_test::<RocksDbStore>().await;
2121
}
2222

23-
#[cfg(feature = "dynamodb")]
23+
#[cfg(with_dynamodb)]
2424
#[tokio::test]
2525
async fn admin_test_dynamo_db() {
2626
admin_test::<DynamoDbStore>().await;
2727
}
2828

29-
#[cfg(feature = "scylladb")]
29+
#[cfg(with_scylladb)]
3030
#[tokio::test]
3131
async fn admin_test_scylla_db() {
3232
admin_test::<ScyllaDbStore>().await;

0 commit comments

Comments
 (0)