Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pub(crate) const PEER_INFO_PERSISTENCE_KEY: &str = "peers";
pub(crate) const PAYMENT_INFO_PERSISTENCE_NAMESPACE: &str = "payments";

/// RapidGossipSync's `latest_sync_timestamp` will be persisted under this key.
pub(crate) const RGS_LATEST_SYNC_TIMESTAMP_NAMESPACE: &str = "";
pub(crate) const RGS_LATEST_SYNC_TIMESTAMP_KEY: &str = "rgs_latest_sync_timestamp";
pub(crate) const LATEST_RGS_SYNC_TIMESTAMP_NAMESPACE: &str = "";
pub(crate) const LATEST_RGS_SYNC_TIMESTAMP_KEY: &str = "latest_rgs_sync_timestamp";

/// Provides an interface that allows to store and retrieve persisted values that are associated
/// with given keys.
Expand Down
20 changes: 10 additions & 10 deletions src/io/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ where
Ok(res)
}

pub(crate) fn read_rgs_latest_sync_timestamp<K: Deref>(kv_store: K) -> Result<u32, std::io::Error>
pub(crate) fn read_latest_rgs_sync_timestamp<K: Deref>(kv_store: K) -> Result<u32, std::io::Error>
where
K::Target: KVStore,
{
let mut reader =
kv_store.read(RGS_LATEST_SYNC_TIMESTAMP_NAMESPACE, RGS_LATEST_SYNC_TIMESTAMP_KEY)?;
kv_store.read(LATEST_RGS_SYNC_TIMESTAMP_NAMESPACE, LATEST_RGS_SYNC_TIMESTAMP_KEY)?;
u32::read(&mut reader).map_err(|_| {
std::io::Error::new(
std::io::ErrorKind::InvalidData,
Expand All @@ -188,21 +188,21 @@ where
})
}

pub(crate) fn write_rgs_latest_sync_timestamp<K: Deref, L: Deref>(
pub(crate) fn write_latest_rgs_sync_timestamp<K: Deref, L: Deref>(
updated_timestamp: u32, kv_store: K, logger: L,
) -> Result<(), Error>
where
K::Target: KVStore,
L::Target: Logger,
{
let mut writer = kv_store
.write(RGS_LATEST_SYNC_TIMESTAMP_NAMESPACE, RGS_LATEST_SYNC_TIMESTAMP_KEY)
.write(LATEST_RGS_SYNC_TIMESTAMP_NAMESPACE, LATEST_RGS_SYNC_TIMESTAMP_KEY)
.map_err(|e| {
log_error!(
logger,
"Getting writer for key {}/{} failed due to: {}",
RGS_LATEST_SYNC_TIMESTAMP_NAMESPACE,
RGS_LATEST_SYNC_TIMESTAMP_KEY,
LATEST_RGS_SYNC_TIMESTAMP_NAMESPACE,
LATEST_RGS_SYNC_TIMESTAMP_KEY,
e
);
Error::PersistenceFailed
Expand All @@ -211,8 +211,8 @@ where
log_error!(
logger,
"Writing data to key {}/{} failed due to: {}",
RGS_LATEST_SYNC_TIMESTAMP_NAMESPACE,
RGS_LATEST_SYNC_TIMESTAMP_KEY,
LATEST_RGS_SYNC_TIMESTAMP_NAMESPACE,
LATEST_RGS_SYNC_TIMESTAMP_KEY,
e
);
Error::PersistenceFailed
Expand All @@ -221,8 +221,8 @@ where
log_error!(
logger,
"Committing data to key {}/{} failed due to: {}",
RGS_LATEST_SYNC_TIMESTAMP_NAMESPACE,
RGS_LATEST_SYNC_TIMESTAMP_KEY,
LATEST_RGS_SYNC_TIMESTAMP_NAMESPACE,
LATEST_RGS_SYNC_TIMESTAMP_KEY,
e
);
Error::PersistenceFailed
Expand Down
Loading