Simple queue

This commit is contained in:
eraden 2023-05-26 09:11:28 +02:00
parent ccf033eeed
commit 4a557a7de3
3 changed files with 5 additions and 12 deletions

View File

@ -5,7 +5,7 @@ pub enum Msg {
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct Message {
pub index: usize,
pub offset: usize,
pub payload: Msg,
}

View File

@ -1,5 +1,6 @@
use flumedb::*;
use gumdrop::Options;
use event_bus_adapter::*;
#[derive(Debug, thiserror::Error)]
enum Error {}
@ -15,16 +16,8 @@ struct Opts {
#[async_std::main]
async fn main() -> Result<(), Error> {
let path = {
let args = std::env::args();
let mut iter = args.into_iter();
iter
.next();
iter.next()
.expect("Log file path not found. Please privide path to log file")
};
eprintln!("File: {path}");
let opts: Opts = Options::parse_args_default_or_exit();
let path = opts.log_path;
let mut log = OffsetLog::<u32>::from_file(
std::fs::OpenOptions::new()
.append(true)

View File

@ -17,7 +17,7 @@ impl MessageSend for MessageSender {
async fn send(&mut self, msg: Msg) {
match (Message {
payload: msg,
index: 0,
offset: 0,
})
.to_bytes()
{