Skip to content

Commit 353bbb9

Browse files
authored
Merge pull request MaterializeInc#11674 from aljoscha/persist-usability-fixes
persist: fix assortment of usability issues
2 parents 1fa6576 + cd0ff40 commit 353bbb9

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

src/persist-client/src/lib.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,25 @@ pub(crate) mod r#impl {
8484
/// processes. This location can contain any number of persist shards.
8585
#[derive(Debug, Clone, Deserialize, Serialize)]
8686
pub struct Location {
87-
blob_uri: String,
88-
consensus_uri: String,
87+
/// Uri string that identifies the blob store.
88+
pub blob_uri: String,
89+
90+
/// Uri string that identifies the consensus system.
91+
pub consensus_uri: String,
8992
}
9093

9194
impl Location {
9295
/// Opens the associated implementations of [BlobMulti] and [Consensus].
9396
pub async fn open(
9497
&self,
9598
timeout: Duration,
96-
) -> Result<(Arc<dyn BlobMulti>, Arc<dyn Consensus>), ExternalError> {
99+
) -> Result<
100+
(
101+
Arc<dyn BlobMulti + Send + Sync>,
102+
Arc<dyn Consensus + Send + Sync>,
103+
),
104+
ExternalError,
105+
> {
97106
let deadline = Instant::now() + timeout;
98107
debug!(
99108
"Location::open timeout={:?} blob={} consensus={}",

src/persist/src/cfg.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,17 @@ pub enum BlobMultiConfig {
3232

3333
impl BlobMultiConfig {
3434
/// Opens the associated implementation of [BlobMulti].
35-
pub async fn open(self, deadline: Instant) -> Result<Arc<dyn BlobMulti>, ExternalError> {
35+
pub async fn open(
36+
self,
37+
deadline: Instant,
38+
) -> Result<Arc<dyn BlobMulti + Send + Sync>, ExternalError> {
3639
match self {
3740
BlobMultiConfig::File(config) => FileBlobMulti::open(deadline, config)
3841
.await
39-
.map(|x| Arc::new(x) as Arc<dyn BlobMulti>),
42+
.map(|x| Arc::new(x) as Arc<dyn BlobMulti + Send + Sync>),
4043
BlobMultiConfig::S3(config) => S3BlobMulti::open(deadline, config)
4144
.await
42-
.map(|x| Arc::new(x) as Arc<dyn BlobMulti>),
45+
.map(|x| Arc::new(x) as Arc<dyn BlobMulti + Send + Sync>),
4346
}
4447
}
4548

@@ -100,11 +103,13 @@ pub enum ConsensusConfig {
100103

101104
impl ConsensusConfig {
102105
/// Opens the associated implementation of [Consensus].
103-
pub async fn open(self, _deadline: Instant) -> Result<Arc<dyn Consensus>, ExternalError> {
106+
pub async fn open(
107+
self,
108+
_deadline: Instant,
109+
) -> Result<Arc<dyn Consensus + Send + Sync>, ExternalError> {
104110
match self {
105-
ConsensusConfig::Sqlite(config) => {
106-
SqliteConsensus::open(config).map(|x| Arc::new(x) as Arc<dyn Consensus>)
107-
}
111+
ConsensusConfig::Sqlite(config) => SqliteConsensus::open(config)
112+
.map(|x| Arc::new(x) as Arc<dyn Consensus + Send + Sync>),
108113
}
109114
}
110115

0 commit comments

Comments
 (0)