Skip to content

pulvreakt/pulvreakt

Repository files navigation

CI/CD Maven Central codecov GitHub issues GitHub pull requests semantic-release: conventional-commits GitHub

PulvReAKt

A simple and lightweight Kotlin multiplatform framework for system pulverization.

📘 Documentation available here

Getting Started

implementation("it.unibo.pulvreakt:core:<version>")
implementation("it.unibo.pulvreakt:runtime:<version>")

// Specific protocols based on the communicator you want to use
implementation("it.unibo.pulvreakt:rabbitmq-communicator:<version>")
implementation("it.unibo.pulvreakt:mqtt-communicator:<version>")

Usage

val embeddedDevice by Capability
val highCpu by Capability

val smartphone = Host("smartphone", embeddedDevice)
val server = Host("server", highCpu)
val infrastructure = nonEmptySetOf(smartphone, server)

val configResult = pulverization {
  val device by logicDevice {
    withBehaviour<DeviceBehaviour>() requires setOf(embeddedDevice, highCpu)
    withSensors<DeviceSensors>() requires embeddedDevice
    withCommunication<DeviceCommunication>() requires setOf(embeddedDevice, highCpu)
  }
  deployment(infrastructure, MqttProtocol()) {
    device(device) {
      DeviceBehaviour() startsOn server
      DeviceSensors() startsOn smartphone
      DeviceCommunication() startsOn smartphone
    }
  }
}

// On the server `main`

val runtimeResult = either {
  val config = configResult.bind()
  val runtime = PulvreaktRuntime(config, "device", 1, server).bind()
  runtime.start().bind()
}

when (runtimeResult) {
  is Either.Left -> println("Error: ${runtimeResult.value}")
  is Either.Right -> println("Success!")
}

Current implemented platforms

core runtime rabbitmq-communicator
JVM ✔️ ✔️ ✔️
JS ✔️ ✔️
Native* ✔️ ✔️

* The current native supported platforms are: linux X64, mingw X64, macos X64, macos ARM, iOS, watchOS, tvOS.

⚠️ Due to a limitation in kotlinx-coroutine the linux ARM64, linux Hfp 32 and mingw X86 platforms are currently not supported.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages