mirror of
https://github.com/fluencelabs/multi-module-example
synced 2025-04-25 06:22:12 +00:00
fix pissble overflow
This commit is contained in:
parent
3ccc68aa34
commit
2f187ca4c1
@ -1,7 +1,7 @@
|
|||||||
use fluence::sdk::*;
|
use fluence::sdk::*;
|
||||||
|
|
||||||
const REDIS_OPTION_KEYWORD: &str = "redis";
|
const REDIS_OPTION_KEYWORD: &str = "redis ";
|
||||||
const SQLITE_OPTION_KEYWORD: &str = "sqlite";
|
const SQLITE_OPTION_KEYWORD: &str = "sqlite ";
|
||||||
|
|
||||||
fn init() {
|
fn init() {
|
||||||
logger::WasmLogger::init_with_level(log::Level::Info).unwrap();
|
logger::WasmLogger::init_with_level(log::Level::Info).unwrap();
|
||||||
@ -11,10 +11,10 @@ fn init() {
|
|||||||
fn run(arg: String) -> Vec<u8> {
|
fn run(arg: String) -> Vec<u8> {
|
||||||
if arg.starts_with(REDIS_OPTION_KEYWORD) {
|
if arg.starts_with(REDIS_OPTION_KEYWORD) {
|
||||||
log::info!("calling redis");
|
log::info!("calling redis");
|
||||||
redis::call(arg[REDIS_OPTION_KEYWORD.len() + 1..].as_bytes())
|
redis::call(arg[REDIS_OPTION_KEYWORD.len()..].as_bytes())
|
||||||
} else if arg.starts_with(SQLITE_OPTION_KEYWORD) {
|
} else if arg.starts_with(SQLITE_OPTION_KEYWORD) {
|
||||||
log::info!("calling sqlite");
|
log::info!("calling sqlite");
|
||||||
redis::call(arg[SQLITE_OPTION_KEYWORD.len() + 1..].as_bytes())
|
redis::call(arg[SQLITE_OPTION_KEYWORD.len()..].as_bytes())
|
||||||
} else {
|
} else {
|
||||||
Vec::from("unknown command")
|
Vec::from("unknown command")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user