Cloud read

This commit is contained in:
Alexander Nozik 2022-03-08 23:25:23 +03:00
parent e8d8e1ea8a
commit 4c67d8b0a0
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
8 changed files with 24 additions and 5 deletions

View File

@ -12,7 +12,7 @@ allprojects {
version = "0.1.2"
}
val dataforgeVersion by extra("0.5.2")
val dataforgeVersion by extra("0.5.3-dev-4")
val tablesVersion: String by extra("0.1.2")
val kmathVersion by extra("0.3.0-dev-17")
val plotlyVersion: String by extra("0.5.0")

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -10,6 +10,7 @@ val dataforgeVersion: String by rootProject.extra
dependencies {
api(project(":numass-data-model"))
api("space.kscience:dataforge-io:$dataforgeVersion")
api(npmlibs.ktor.io)
}
wire{

View File

@ -19,7 +19,6 @@ import java.nio.file.Path
import kotlin.io.path.*
import kotlin.streams.toList
@OptIn(ExperimentalPathApi::class)
public class NumassDirectorySet internal constructor(
public val context: Context,
public val path: Path,

View File

@ -21,7 +21,7 @@ public class NumassProtoPlugin : AbstractPlugin() {
}
public companion object : PluginFactory<NumassProtoPlugin> {
override fun invoke(meta: Meta, context: Context): NumassProtoPlugin = NumassProtoPlugin()
override fun build(context: Context, meta: Meta): NumassProtoPlugin = NumassProtoPlugin()
override val tag: PluginTag = PluginTag("numass-proto", group = "ru.inr.mass")
override val type: KClass<out NumassProtoPlugin> = NumassProtoPlugin::class
}

View File

@ -21,6 +21,9 @@ dependencies {
implementation("space.kscience:plotlykt-jupyter:$plotlyVersion")
implementation("space.kscience:kmath-jupyter:$kmathVersion")
implementation("space.kscience:tables-kt:$tablesVersion")
implementation(platform("com.google.cloud:libraries-bom:23.0.0"))
implementation("com.google.cloud:google-cloud-nio:0.123.10")
implementation("com.google.auth:google-auth-library-oauth2-http:1.3.0")
}
kscience{

View File

@ -0,0 +1,17 @@
package ru.inr.mass.scripts
import com.google.cloud.storage.contrib.nio.CloudStorageFileSystem
import ru.inr.mass.data.proto.NumassDirectorySet
import ru.inr.mass.workspace.Numass
import space.kscience.dataforge.data.DataTree
// https://storage.cloud.google.com/numass-data/2020_12/Adiabaticity/16/set_3/p10(10s)(HV1%3D13750)
suspend fun main() {
CloudStorageFileSystem.forBucket("numass-data").use { fs ->
val repo: DataTree<NumassDirectorySet> = Numass.readRepository(fs.getPath("2020_12/Adiabaticity"))
repo.items().forEach{ (key,item)->
println(key)
}
}
}

View File

@ -24,7 +24,6 @@ import kotlin.streams.toList
object Numass {
fun readDirectory(path: String): NumassDirectorySet = NUMASS.context.readNumassDirectory(path)
@OptIn(ExperimentalPathApi::class)
fun readRepository(path: Path): DataTree<NumassDirectorySet> = runBlocking {
ActiveDataTree {
@Suppress("BlockingMethodInNonBlockingContext")