Some cleanup on the binding streams to topics.
parent
d4b7a5c493
commit
a026f99b27
2
build.sc
2
build.sc
|
@ -11,7 +11,7 @@ object shingle extends ScalaModule
|
|||
def internalJavaVersion = T {
|
||||
try {
|
||||
val jvm = System.getProperties().getProperty("java.version")
|
||||
println(f"Running Vizier with `${jvm}`")
|
||||
println(f"Running Shingle with `${jvm}`")
|
||||
jvm.split("\\.")(0).toInt
|
||||
} catch {
|
||||
case _:NumberFormatException | _:ArrayIndexOutOfBoundsException => 8
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -c
|
||||
# set -c
|
||||
|
||||
HOST=heracles.xthemage.net
|
||||
DIR=Documents/shingle/
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package net.okennedy.shingle.stream
|
||||
|
||||
import upickle.default._
|
||||
import net.okennedy.shingle.component.Mqtt
|
||||
|
||||
|
||||
trait State[T]
|
||||
{
|
||||
def now: T
|
||||
|
@ -21,4 +25,12 @@ class Checkpoint[T](init: Option[T] = None) extends State[T] with Sink[T] with D
|
|||
__value = Some(incoming)
|
||||
dispatch(incoming)
|
||||
}
|
||||
|
||||
override def bind(topic: String)(implicit writer: Writer[T], owner: Owner): Checkpoint[T] =
|
||||
{
|
||||
val path = Mqtt(topic).isState
|
||||
super.bind(topic)
|
||||
__value.foreach { path << _ }
|
||||
return this
|
||||
}
|
||||
}
|
|
@ -4,6 +4,8 @@ import scala.collection.mutable
|
|||
import upickle.default._
|
||||
import ujson.Bool
|
||||
import java.util.Arrays
|
||||
import net.okennedy.shingle.component.Mqtt
|
||||
import upickle.default._
|
||||
|
||||
trait Stream[T]
|
||||
{
|
||||
|
@ -80,6 +82,12 @@ trait Stream[T]
|
|||
ret << this
|
||||
return ret
|
||||
}
|
||||
|
||||
def bind(topic: String)(implicit writer: Writer[T], owner: Owner): Stream[T] =
|
||||
{
|
||||
Mqtt(topic) << this
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
trait Dispatchable[T] extends Stream[T]
|
||||
|
|
Loading…
Reference in New Issue