Compare commits

...

4 Commits

Author SHA1 Message Date
Sean McArde ba76de34f5 Added readme. Good for me. 2023-11-22 14:15:21 -08:00
Sean McArde a2dff94e4c Removed unused dependency. 2023-11-22 14:15:11 -08:00
Sean McArde d0a533e606 removed dead line 2023-11-22 14:14:44 -08:00
Sean McArde e304a9d414 Changed to POST, the semantics match better. 2023-11-22 14:06:33 -08:00
4 changed files with 19 additions and 97 deletions

94
Cargo.lock generated
View File

@ -26,54 +26,6 @@ dependencies = [
"memchr",
]
[[package]]
name = "anstream"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
[[package]]
name = "anstyle-parse"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628"
dependencies = [
"anstyle",
"windows-sys",
]
[[package]]
name = "async-stream"
version = "0.3.5"
@ -188,39 +140,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "4.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64"
dependencies = [
"clap_builder",
]
[[package]]
name = "clap_builder"
version = "4.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
"strsim",
]
[[package]]
name = "clap_lex"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
[[package]]
name = "colorchoice"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "cookie"
version = "0.18.0"
@ -525,7 +444,6 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
name = "httpq"
version = "0.1.0"
dependencies = [
"clap",
"dashmap",
"http 1.0.0",
"once_cell",
@ -1193,12 +1111,6 @@ dependencies = [
"loom",
]
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
version = "2.0.39"
@ -1454,12 +1366,6 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "utf8parse"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "valuable"
version = "0.1.0"

View File

@ -6,7 +6,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = "4.4.8"
dashmap = "5.5.3"
http = "1.0.0"
once_cell = "1.18.0"

18
readme.md Normal file
View File

@ -0,0 +1,18 @@
# httpq
Dumb simple http message queue for passing values between scripts. It's very useful but will currently let you shoot your foot off. There's no queue size limits, no retry after, probably a bug in the locking, but it does mostly work.
Queues are named by the path: `/<queue name>`. Content is the text body of a POST. A GET against the same path will return the messages in order. GET requests against `/` return queue stats:
```
Total queues: 2
Counts: {"bar": 0, "foo": 12}
```
It listens on port 8000 by default. This can be changed with an environment variable:
```
$ ROCKET_PORT=8888 ./httpq
PS> $env:ROCKET_PORT=8888; .\httpq.exe
cmd> set ROCKET_PORT=8888
cmd> .\httpq.exe
```

View File

@ -59,7 +59,7 @@ fn get_by_name(name: &str, dumb_queue: &State<DumbQueue>) -> Result<String, Stat
}
}
#[put("/<name>", data = "<input>")]
#[post("/<name>", data = "<input>")]
fn put_by_name(name: &str, input: &str, dumb_queue: &State<DumbQueue>) {
let queue_map = &dumb_queue.queue_map;
@ -99,7 +99,6 @@ fn put_by_name(name: &str, input: &str, dumb_queue: &State<DumbQueue>) {
#[launch]
fn rocket() -> _ {
// let dumb_queue : DumbQueue = DumbQueue::new();
rocket::build()
.manage( DumbQueue::new())
.mount("/", routes![index, put_by_name, get_by_name])