Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuancelin committed Sep 5, 2023
1 parent 2d5f5ec commit bd793bd
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 2,007 deletions.
14 changes: 0 additions & 14 deletions otoroshi/app/models/wasm.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ case class WasmPlugin(
override def theDescription: String = description
override def theTags: Seq[String] = tags
override def theMetadata: Map[String, String] = metadata
//def pool()(implicit env: Env): WasmVmPool = WasmVmPool.forPlugin(this.id)(env.wasmIntegrationCtx)
}

object WasmPlugin {
Expand Down Expand Up @@ -125,19 +124,6 @@ class WasmPluginsCacheManager extends Job {
override def predicate(ctx: JobContext, env: Env): Option[Boolean] = None

override def jobRun(ctx: JobContext)(implicit env: Env, ec: ExecutionContext): Future[Unit] = {
// env.proxyState.allWasmPlugins().foreach { plugin =>
// val now = System.currentTimeMillis()
// WasmUtils.scriptCache(env).get(plugin.config.source.cacheKey) match {
// case None => plugin.config.source.getWasm()
// case Some(CacheableWasmScript.CachedWasmScript(_, createAt)) if (createAt + env.wasmCacheTtl) < now =>
// plugin.config.source.getWasm()
// case Some(CacheableWasmScript.CachedWasmScript(_, createAt))
// if (createAt + env.wasmCacheTtl) > now && (createAt + env.wasmCacheTtl + 1000) < now =>
// plugin.config.source.getWasm()
// case _ => ()
// }
// }
// funit
env.wasmIntegration.runVmLoaderJob()
}
}
22 changes: 1 addition & 21 deletions otoroshi/app/wasm/host.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,7 @@ object Utils {
Json.parse(rawBytePtrToString(plugin, params(0).v.i64, params(1).v.i32))
}
}
/*
case class EnvUserData(
env: Env,
executionContext: ExecutionContext,
mat: Materializer,
config: WasmConfig
) extends WasmOtoroshiHostUserData
case class StateUserData(
env: Env,
executionContext: ExecutionContext,
mat: Materializer,
cache: UnboundedTrieMap[String, UnboundedTrieMap[String, ByteString]]
) extends WasmOtoroshiHostUserData
case class EmptyUserData() extends WasmOtoroshiHostUserData
*/

object LogLevel extends Enumeration {
type LogLevel = Value

Expand All @@ -71,11 +56,6 @@ object Status extends Enumeration {
StatusUnimplemented = Value
}

// case class HostFunctionWithAuthorization(
// function: WasmOtoroshiHostFunction[_ <: WasmOtoroshiHostUserData],
// authorized: WasmAuthorizations => Boolean
// )

trait AwaitCapable {
def await[T](future: Future[T], atMost: FiniteDuration = 5.seconds)(implicit env: Env): T = {
Await.result(future, atMost) // TODO: atMost from env
Expand Down
313 changes: 0 additions & 313 deletions otoroshi/app/wasm/opa.scala

This file was deleted.

Loading

0 comments on commit bd793bd

Please sign in to comment.