#[derive(Debug)]
pub struct Message {
pub id: String,
pub payload: Vec<u8>,
}
impl Message {
pub fn new(id: String, payload: Vec<u8>) -> Self {
Message { id, payload }
}
}
pub const FARCASTER_EPOCH: u64 = 1609459200;
pub fn get_stream_key(hub_host: &str, event_type: &str, shard_key: Option<&str>) -> String {
let clean_host = hub_host.split(':').next().unwrap_or(hub_host);
match shard_key {
Some(_) => format!("hub:{}:stream:{}", clean_host, event_type),
None => format!("hub:{}:stream:{}", clean_host, event_type),
}
}