-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1536 Added working Valkey sample with sorts but no filters.
- Loading branch information
chris
committed
Nov 29, 2024
1 parent
7f7a84a
commit 6ec282e
Showing
19 changed files
with
776 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
vuu.webroot="vuu-ui/deployed_apps/app-vuu-example" | ||
vuu.certPath="example/main/src/main/resources/certs/cert.pem" | ||
vuu.keyPath="example/main/src/main/resources/certs/key.pem" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIC3jCCAcYCCQDluS1n11toPDANBgkqhkiG9w0BAQsFADAxMQswCQYDVQQGEwJH | ||
QjEOMAwGA1UECgwFVmVudXUxEjAQBgNVBAMMCWxvY2FsaG9zdDAeFw0yMTAzMTgw | ||
OTUzMzVaFw0zMTAzMTYwOTUzMzVaMDExCzAJBgNVBAYTAkdCMQ4wDAYDVQQKDAVW | ||
ZW51dTESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A | ||
MIIBCgKCAQEAoXS+P4cOprmMIByOOD4+O69Qfnjmrh2Raq5DBHmEDObqF6mA2E+o | ||
SSRvPTdTsufK0tIKQM7iH8ot5P0+ydaVmaHHML7Bys3WYQNfCBm+MZRl79O7yiHX | ||
tZYtIiJoagiQ4IX19Q00tkaNPqsj5ANBfKVtzokRzXzw+BjZtZpBXWUeETJE4wGB | ||
5fSQCHMdA8pnblucqsMsmDhGYloH5sBPLIyu9wV/h6AunxhZ37cKlV3U6R8np1ov | ||
T2fW3fHj6LtrUceMiZKWWgM9NrcJyeSZrqtwWe4lS3VeGZbGG1EZ+oc0m4cbv9FI | ||
3pz47cK+NTRQq43JQERmA3Yb9G2xRNFTxQIDAQABMA0GCSqGSIb3DQEBCwUAA4IB | ||
AQB5mMt5eJuwnttcIfv7CKpb9icdYQUsQwN76n33EBetwoBj4r0F2gvxVCUo+9p9 | ||
QTWET7K/nnCxB5ToP031baKZBOU8vIwhAU4WT1Y04ydYLu7vWBCVS7Cp1cygeJ5Z | ||
3WufvWo8EEqRhAKYFKIj0bj9XP6yOOBSNlmQk5VRRMKLp9aqmT1rV6+IgS6RJQim | ||
heZVnEUuKkHo6HZygv3Pl6DMXzD+pawcfYh7HYf+70qzmKvfBZkDE8x74KvdQ21V | ||
7bYRiL+yglzpkYPcAdpUAoHEUwh4DuCcaDUdGgGCBzjh7QJNvel5HccpXSGbrezY | ||
wYfUHIkVCMlDIRYJJArHJChO | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQChdL4/hw6muYwg | ||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jWNA42ank9k9UtnpoieQkKtQ5PJO | ||
Kov9dPquOSECgYEAiZQ4QmjnAfScidUZehZXkZaBkyjqizv3pY3+O/ZH01m6cexi | ||
qB91iqnew+l51ZoR0fFW9ULIo9BjUUFHkiRp8yRR5bEID6N2U5XGUImO58GLpMJb | ||
azi6FJhvfASiBhGTFsO1lF99ggNmH3osGzAXoPI6O0JHQptQWfbpb9DGKY0CgYBU | ||
sA39qNaPRkr3HWKiWbwOcOB+gWgksHrYiqGV6ZJiCmInDaS25tlhqUmrbkMFN1UC | ||
Fhzk79ISTfyfK0Swfszn1baTl8yFSDBmI+BSSzOOU7qSzPRPPO3tyr4mJEjTBF9A | ||
LWENapV/5nririlmF+qO0rllqa097EN6B5Gu527X4QKBgGuqnOeiy8UVpTRcN6OL | ||
h5RRS10utpQcpU1nJHx1Us23As0LJXV+CZuFGNWVnR0GLFABKNBZMV7ZqPHxwmr0 | ||
WBhvxP1xOwCUsla1Cg/dEG+J1q7dPyVfXFK0813Rb5S9omnrQolTczbEh2LnF3RE | ||
JJmkkwWfm/jOTEl8F3iJQLQN | ||
-----END PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
example/valkey-redis/src/main/scala/org/finos/vuu/example/valkey/ValkeyVuuMain.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package org.finos.vuu.example.valkey | ||
|
||
import com.typesafe.config.ConfigFactory | ||
import com.typesafe.scalalogging.StrictLogging | ||
import org.finos.toolbox.jmx.{JmxInfra, MetricsProvider, MetricsProviderImpl} | ||
import org.finos.toolbox.lifecycle.LifecycleContainer | ||
import org.finos.toolbox.time.{Clock, DefaultClock} | ||
import org.finos.vuu.core._ | ||
import org.finos.vuu.core.module.TableDefContainer | ||
import org.finos.vuu.core.module.metrics.MetricsModule | ||
import org.finos.vuu.core.module.typeahead.TypeAheadModule | ||
import org.finos.vuu.example.valkey.factory.ValkeyConnectionPool | ||
import org.finos.vuu.example.valkey.module.ValkeyModule | ||
import org.finos.vuu.net.auth.AlwaysHappyAuthenticator | ||
import org.finos.vuu.net.http.VuuHttp2ServerOptions | ||
import org.finos.vuu.net.{AlwaysHappyLoginValidator, Authenticator, LoggedInTokenValidator} | ||
import org.finos.vuu.plugin.virtualized.VirtualizedTablePlugin | ||
import org.finos.vuu.state.MemoryBackedVuiStateStore | ||
|
||
/* | ||
//to allow self signed certs | ||
chrome://flags/#allow-insecure-localhost | ||
*/ | ||
|
||
object ValkeyVuuMain extends App with StrictLogging { | ||
|
||
JmxInfra.enableJmx() | ||
|
||
implicit val metrics: MetricsProvider = new MetricsProviderImpl | ||
implicit val clock: Clock = new DefaultClock | ||
implicit val lifecycle: LifecycleContainer = new LifecycleContainer | ||
implicit val tableDefContainer: TableDefContainer = new TableDefContainer(Map()) | ||
|
||
logger.info("[VUU] Starting...") | ||
val runAsIgniteServer = false | ||
|
||
val store = new MemoryBackedVuiStateStore() | ||
|
||
//store.add(VuiState(VuiHeader("chris", "latest", "chris.latest", clock.now()), VuiJsonState("{ uiState : ['chris','foo'] }"))) | ||
|
||
lifecycle.autoShutdownHook() | ||
|
||
val authenticator: Authenticator = new AlwaysHappyAuthenticator | ||
val loginTokenValidator: LoggedInTokenValidator = new LoggedInTokenValidator | ||
|
||
val defaultConfig = ConfigFactory.load() | ||
|
||
//look in application.conf for default values | ||
val webRoot = defaultConfig.getString("vuu.webroot") | ||
val certPath = defaultConfig.getString("vuu.certPath") | ||
val keyPath = defaultConfig.getString("vuu.keyPath") | ||
|
||
logger.debug(s"[Ignite] Starting Valkey Pool") | ||
|
||
val valkeyPool = new ValkeyConnectionPool("127.0.0.1", 6379) | ||
|
||
val config = VuuServerConfig( | ||
VuuHttp2ServerOptions() | ||
//only specify webroot if we want to load the source locally, we'll load it from the jar | ||
//otherwise | ||
.withWebRoot(webRoot) | ||
.withSsl(certPath, keyPath) | ||
//don't leave me on in prod pls.... | ||
.withDirectoryListings(true) | ||
.withBindAddress("0.0.0.0") | ||
.withPort(8443), | ||
VuuWebSocketOptions() | ||
.withUri("websocket") | ||
.withWsPort(8090) | ||
.withWss(certPath, keyPath) | ||
.withBindAddress("0.0.0.0"), | ||
VuuSecurityOptions() | ||
.withAuthenticator(authenticator) | ||
.withLoginValidator(new AlwaysHappyLoginValidator), | ||
VuuThreadingOptions() | ||
.withViewPortThreads(4) | ||
.withTreeThreads(4) | ||
).withModule(TypeAheadModule()) | ||
.withModule(MetricsModule()) | ||
.withModule(ValkeyModule(valkeyPool)) | ||
.withPlugin(VirtualizedTablePlugin) | ||
|
||
val vuuServer = new VuuServer(config) | ||
|
||
lifecycle.start() | ||
|
||
logger.info("[VUU] Ready.") | ||
|
||
vuuServer.join() | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
...lkey-redis/src/main/scala/org/finos/vuu/example/valkey/factory/ValkeyConnectionPool.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.finos.vuu.example.valkey.factory | ||
|
||
import io.valkey.{Jedis, JedisPool} | ||
|
||
class ValkeyConnectionPool(val ipaddress: String, val port: Int) { | ||
|
||
val config = new io.valkey.JedisPoolConfig() | ||
// It is recommended that you set maxTotal = maxIdle = 2*minIdle for best performance | ||
config.setMaxTotal(32) | ||
config.setMaxIdle(32) | ||
config.setMinIdle(16) | ||
|
||
final val jedisPool: JedisPool = new io.valkey.JedisPool(config, ipaddress, port, false) | ||
|
||
def getConnection(): Jedis = { | ||
jedisPool.getResource() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.