Ripping out rocksdb, the build is not Windows friendly.
parent
cedd54ca49
commit
a773b16a0d
File diff suppressed because it is too large
Load Diff
|
@ -11,10 +11,10 @@ tracing = "0.1"
|
|||
tracing-subscriber = { version="0.3", features = ["env-filter"] }
|
||||
tower = { version = "0.4", features = ["util", "timeout", "load-shed", "limit"] }
|
||||
tower-http = { version = "0.2.0", features = ["add-extension", "auth", "compression-full", "trace"] }
|
||||
rocksdb = { version = "*", features = ["multi-threaded-cf"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
clap = {version = "*"}
|
||||
once_cell = {version = "*" }
|
||||
redb = "1.3.0"
|
||||
|
||||
[profile.release]
|
||||
debug = true
|
||||
debug = true
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
use axum::{extract::Query, http::StatusCode, response::IntoResponse};
|
||||
use clap::ArgMatches;
|
||||
use once_cell::sync::OnceCell;
|
||||
use rocksdb::{WriteBatch, DB};
|
||||
use serde::Deserialize;
|
||||
use redb::{Database, Error, ReadableTable, TableDefinition};
|
||||
use std::{borrow::Cow, str};
|
||||
use tower::BoxError;
|
||||
use tracing::debug;
|
||||
|
||||
pub static DEFAULT_MAX_QUEUE_CELL: OnceCell<i32> = OnceCell::new();
|
||||
pub static DATABASE: OnceCell<DB> = OnceCell::new();
|
||||
pub static TABLE: TableDefinition<&str, &str> = TableDefinition::new("queue_data");
|
||||
|
||||
|
||||
// httpmq read metadata api
|
||||
// retrieve from leveldb
|
||||
// name.maxqueue - maxqueue
|
||||
// name.putpos - putpos
|
||||
// name.getpos - getpos
|
||||
fn httpmq_read_metadata(db: &rocksdb::DB, name: &String) -> Option<Vec<i32>> {
|
||||
fn httpmq_read_metadata(db: redb::Database, name: &String) -> Option<Vec<i32>> {
|
||||
let mut result: Vec<_> = db
|
||||
.multi_get(vec![
|
||||
name.to_string() + ".maxqueue",
|
||||
|
@ -36,7 +37,7 @@ fn httpmq_read_metadata(db: &rocksdb::DB, name: &String) -> Option<Vec<i32>> {
|
|||
Some(result)
|
||||
}
|
||||
|
||||
fn httpmq_now_getpos(db: &rocksdb::DB, name: &String) -> Option<i32> {
|
||||
fn httpmq_now_getpos(db: Database, name: &String) -> Option<i32> {
|
||||
let metadata = httpmq_read_metadata(db, name);
|
||||
let maxqueue = metadata.as_ref()?[0];
|
||||
let putpos = metadata.as_ref()?[1];
|
||||
|
@ -61,7 +62,7 @@ fn httpmq_now_getpos(db: &rocksdb::DB, name: &String) -> Option<i32> {
|
|||
Some(getpos)
|
||||
}
|
||||
|
||||
fn httpmq_now_putpos(db: &rocksdb::DB, name: &String) -> Option<i32> {
|
||||
fn httpmq_now_putpos(db: Database, name: &String) -> Option<i32> {
|
||||
let metadata = httpmq_read_metadata(db, name);
|
||||
let maxqueue = metadata.as_ref()?[0];
|
||||
let mut putpos = metadata.as_ref()?[1];
|
||||
|
|
Loading…
Reference in New Issue