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