Skip to content

Commit

Permalink
s/postfix/suffix/g -- 🙏 @marvin_j97
Browse files Browse the repository at this point in the history
  • Loading branch information
cablehead committed Dec 5, 2024
1 parent 1fa2678 commit ca9b5bf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/discord-bot/handler-heartbeat.nuon
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
pulse: 1000,
start: {after: "discord.ws.start"}
return_options: {
postfix: ".state"
suffix: ".state"
ttl: "ephemeral"
}
}
8 changes: 4 additions & 4 deletions src/handlers/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub struct Meta {

#[derive(Clone, Debug, Serialize, Deserialize, Default)]
pub struct ReturnOptions {
pub postfix: Option<String>,
pub suffix: Option<String>,
pub ttl: Option<TTL>,
}

Expand Down Expand Up @@ -217,14 +217,14 @@ impl Handler {
let synthetic_call =
if !self.is_value_an_append_frame(&value) && !matches!(value, Value::Nothing { .. }) {
let return_options = self.meta.return_options.as_ref();
let postfix = return_options
.and_then(|ro| ro.postfix.as_deref())
let suffix = return_options
.and_then(|ro| ro.suffix.as_deref())
.unwrap_or(".out");

let hash = store.cas_insert(&value_to_json(&value).to_string()).await?;

Some(
Frame::with_topic(format!("{}{}", self.topic, postfix))
Frame::with_topic(format!("{}{}", self.topic, suffix))
.maybe_ttl(return_options.and_then(|ro| ro.ttl.clone()))
.hash(hash)
.build(),
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ async fn test_return_options() {
)
.meta(serde_json::json!({
"return_options": {
"postfix": ".warble",
"suffix": ".warble",
"ttl": "head:1"
}
}))
Expand All @@ -481,7 +481,7 @@ async fn test_return_options() {
let frame1 = store.append(Frame::with_topic("ping").build()).await;
assert_eq!(recver.recv().await.unwrap().topic, "ping");

// Check response has custom postfix and right meta
// Check response has custom suffix and right meta
let response1 = recver.recv().await.unwrap();
assert_eq!(response1.topic, "echo.warble");
assert_eq!(response1.ttl, Some(TTL::Head(1)));
Expand Down
4 changes: 2 additions & 2 deletions src/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ async fn append(
store: Store,
source_id: Scru128Id,
topic: &str,
postfix: &str,
suffix: &str,
content: Option<String>,
) -> Result<Frame, Box<dyn std::error::Error + Send + Sync>> {
let hash = if let Some(content) = content {
Expand All @@ -161,7 +161,7 @@ async fn append(

let frame = store
.append(
Frame::with_topic(format!("{}.{}", topic, postfix))
Frame::with_topic(format!("{}.{}", topic, suffix))
.maybe_hash(hash)
.meta(meta)
.build(),
Expand Down

0 comments on commit ca9b5bf

Please sign in to comment.