Skip to content

Commit d30139f

Browse files
committed
Add Send+Sync trait bounds for PaginatedKVStore.
1 parent a30379b commit d30139f

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

ldk-server/src/io/persist/paginated_kv_store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use std::io;
2626
/// [`KVStore`]: ldk_node::lightning::util::persist::KVStore
2727
/// [`KVSTORE_NAMESPACE_KEY_ALPHABET`]: ldk_node::lightning::util::persist::KVSTORE_NAMESPACE_KEY_ALPHABET
2828
/// [`KVSTORE_NAMESPACE_KEY_MAX_LEN`]: ldk_node::lightning::util::persist::KVSTORE_NAMESPACE_KEY_MAX_LEN
29-
pub trait PaginatedKVStore {
29+
pub trait PaginatedKVStore: Send + Sync {
3030
/// Returns the data stored for the given `primary_namespace`, `secondary_namespace`, and `key`.
3131
///
3232
/// Returns an [`ErrorKind::NotFound`] if the given `key` could not be found in the given

ldk-server/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn main() {
9292
},
9393
};
9494

95-
let paginated_store =
95+
let paginated_store: Arc<dyn PaginatedKVStore> =
9696
Arc::new(match SqliteStore::new(PathBuf::from(config_file.storage_dir_path), None, None) {
9797
Ok(store) => store,
9898
Err(e) => {
@@ -240,7 +240,7 @@ fn main() {
240240
match res {
241241
Ok((stream, _)) => {
242242
let io_stream = TokioIo::new(stream);
243-
let node_service = NodeService::new(Arc::clone(&node), Arc::clone(&paginated_store) as Arc<dyn PaginatedKVStore + Send + Sync>);
243+
let node_service = NodeService::new(Arc::clone(&node), Arc::clone(&paginated_store));
244244
runtime.spawn(async move {
245245
if let Err(err) = http1::Builder::new().serve_connection(io_stream, node_service).await {
246246
eprintln!("Failed to serve connection: {}", err);

ldk-server/src/service.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,18 @@ use std::sync::Arc;
3939
#[derive(Clone)]
4040
pub struct NodeService {
4141
node: Arc<Node>,
42-
paginated_kv_store: Arc<dyn PaginatedKVStore + Send + Sync>,
42+
paginated_kv_store: Arc<dyn PaginatedKVStore>,
4343
}
4444

4545
impl NodeService {
46-
pub(crate) fn new(
47-
node: Arc<Node>, paginated_kv_store: Arc<dyn PaginatedKVStore + Send + Sync>,
48-
) -> Self {
46+
pub(crate) fn new(node: Arc<Node>, paginated_kv_store: Arc<dyn PaginatedKVStore>) -> Self {
4947
Self { node, paginated_kv_store }
5048
}
5149
}
5250

5351
pub(crate) struct Context {
5452
pub(crate) node: Arc<Node>,
55-
pub(crate) paginated_kv_store: Arc<dyn PaginatedKVStore + Send + Sync>,
53+
pub(crate) paginated_kv_store: Arc<dyn PaginatedKVStore>,
5654
}
5755

5856
impl Service<Request<Incoming>> for NodeService {

0 commit comments

Comments
 (0)