Splitting meta and mata-io. Project rename

This commit is contained in:
Alexander Nozik 2018-09-25 12:06:35 +03:00
parent a5a4b67c97
commit ad059dea33
23 changed files with 118 additions and 57 deletions

View File

@ -1,6 +1,7 @@
buildscript { buildscript {
ext.kotlin_version = '1.3.0-rc-57' ext.kotlin_version = '1.3.0-rc-57'
ext.serialization_version = '0.8.0-rc13' ext.serialization_version = '0.8.0-rc13'
ext.kotlinx_io_version = '0.1.0-alpha-15-rc13'
repositories { repositories {
jcenter() jcenter()
maven { maven {
@ -34,7 +35,3 @@ allprojects {
//maven { url 'https://jitpack.io' } //maven { url 'https://jitpack.io' }
} }
} }
subprojects {
apply plugin: 'kotlinx-serialization'
}

View File

@ -0,0 +1,13 @@
plugins{
id 'kotlin-platform-common'
}
dependencies {
compile project(":dataforge-meta")
compile "org.jetbrains.kotlinx:kotlinx-io:$kotlinx_io_version"
compile "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test-annotations-common"
testCompile "org.jetbrains.kotlin:kotlin-test-common"
}

View File

@ -0,0 +1,9 @@
package hep.dataforge.envelopes
import hep.dataforge.meta.Meta
import kotlinx.io.core.IoBuffer
interface Envelope{
val meta: Meta
val data: IoBuffer
}

View File

@ -4,7 +4,7 @@ plugins{
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version"
compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version"
testCompile "org.jetbrains.kotlin:kotlin-test-annotations-common" testCompile "org.jetbrains.kotlin:kotlin-test-annotations-common"
testCompile "org.jetbrains.kotlin:kotlin-test-common" testCompile "org.jetbrains.kotlin:kotlin-test-common"
} }

View File

@ -0,0 +1,19 @@
plugins{
id 'kotlin-platform-common'
}
dependencies {
compile project(":dataforge-meta")
compile "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version"
compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version"
compile "org.jetbrains.kotlinx:kotlinx-io:$kotlinx_io_version"
testCompile "org.jetbrains.kotlin:kotlin-test-annotations-common"
testCompile "org.jetbrains.kotlin:kotlin-test-common"
}
allprojects {
apply plugin: 'kotlinx-serialization'
}

View File

@ -0,0 +1,26 @@
package hep.dataforge.meta.io
import hep.dataforge.meta.Meta
import kotlinx.io.core.Input
import kotlinx.io.core.Output
/**
* A format for meta serialization
*/
interface MetaFormat {
val name : String
val key : Short
suspend fun write(meta: Meta, out: Output)
suspend fun read(input: Input): Meta
}
/**
* Resolve format by its name. Null if not provided
*/
expect fun resolveFormat(name: String): MetaFormat?
/**
* Resolve format by its binary key. Null if not provided
*/
expect fun resolveFormat(key: Short): MetaFormat?

View File

@ -1,46 +1,47 @@
package hep.dataforge.meta package hep.dataforge.meta.io
import kotlinx.serialization.json.* import hep.dataforge.meta.*
import kotlinx.serialization.Serializable
/*Universal serialization*/ /*Universal serialization*/
//sealed class MetaItemProxy { sealed class MetaItemProxy {
//
// @Serializable @Serializable
// class NumberValueProxy(val number: Number) : MetaItemProxy() class NumberValueProxy(val number: Number) : MetaItemProxy()
//
// @Serializable @Serializable
// class StringValueProxy(val string: String) : MetaItemProxy() class StringValueProxy(val string: String) : MetaItemProxy()
//
// @Serializable @Serializable
// class BooleanValueProxy(val boolean: Boolean) : MetaItemProxy() class BooleanValueProxy(val boolean: Boolean) : MetaItemProxy()
//
// @Serializable @Serializable
// object NullValueProxy : MetaItemProxy() object NullValueProxy : MetaItemProxy()
//
// @Serializable @Serializable
// class MetaProxy(@Serializable val map: Map<String, MetaItemProxy>) : MetaItemProxy() class MetaProxy(@Serializable val map: Map<String, MetaItemProxy>) : MetaItemProxy()
//
// @Serializable @Serializable
// class MetaListProxy(@Serializable val nodes: List<MetaProxy>) : MetaItemProxy() class MetaListProxy(@Serializable val nodes: List<MetaProxy>) : MetaItemProxy()
//} }
//
//
//fun Meta.toMap(): Map<String, MetaItemProxy> { fun Meta.toMap(): Map<String, MetaItemProxy> {
// return this.items.mapValues { (_, value) -> return this.items.mapValues { (_, value) ->
// when (value) { when (value) {
// is MetaItem.ValueItem -> when (value.value.type) { is MetaItem.ValueItem<*> -> when (value.value.type) {
// ValueType.NUMBER -> MetaItemProxy.NumberValueProxy(value.value.number) ValueType.NUMBER -> MetaItemProxy.NumberValueProxy(value.value.number)
// ValueType.STRING -> MetaItemProxy.StringValueProxy(value.value.string) ValueType.STRING -> MetaItemProxy.StringValueProxy(value.value.string)
// ValueType.BOOLEAN -> MetaItemProxy.BooleanValueProxy(value.value.boolean) ValueType.BOOLEAN -> MetaItemProxy.BooleanValueProxy(value.value.boolean)
// ValueType.NULL -> MetaItemProxy.NullValueProxy ValueType.NULL -> MetaItemProxy.NullValueProxy
// } }
// is MetaItem.SingleNodeItem -> MetaItemProxy.MetaProxy(value.node.toMap()) is MetaItem.SingleNodeItem<*> -> MetaItemProxy.MetaProxy(value.node.toMap())
// is MetaItem.MultiNodeItem -> MetaItemProxy.MetaListProxy(value.nodes.map { MetaItemProxy.MetaProxy(it.toMap()) }) is MetaItem.MultiNodeItem<*> -> MetaItemProxy.MetaListProxy(value.nodes.map { MetaItemProxy.MetaProxy(it.toMap()) })
// } }
// } }
//} }
/*Direct JSON serialization*/ /*Direct JSON serialization*/

View File

@ -3,9 +3,8 @@ plugins{
} }
dependencies { dependencies {
expectedBy project(":dataforge-meta-common") expectedBy project(":dataforge-meta")
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serialization_version"
testCompile "org.jetbrains.kotlin:kotlin-test-js" testCompile "org.jetbrains.kotlin:kotlin-test-js"
} }

View File

@ -3,11 +3,9 @@ plugins{
} }
dependencies { dependencies {
expectedBy project(":dataforge-meta-common") expectedBy project(":dataforge-meta")
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version"
testCompile "org.jetbrains.kotlin:kotlin-test" testCompile "org.jetbrains.kotlin:kotlin-test"
testCompile "org.jetbrains.kotlin:kotlin-test-junit" testCompile "org.jetbrains.kotlin:kotlin-test-junit"
} }

View File

@ -96,11 +96,6 @@ abstract class MetaNode<M : MetaNode<M>> : Meta {
override fun hashCode(): Int { override fun hashCode(): Int {
return items.hashCode() return items.hashCode()
} }
override fun toString(): String {
return toJSON().toString()
}
} }
/** /**

View File

@ -14,8 +14,12 @@ pluginManagement {
} }
} }
rootProject.name = 'dataforge-meta' rootProject.name = 'dataforge-core'
include ":dataforge-meta-common" include ":dataforge-meta"
include ":dataforge-meta-jvm" include ":dataforge-meta:dataforge-meta-jvm"
include ":dataforge-meta-js" include ":dataforge-meta:dataforge-meta-js"
include ":dataforge-meta:dataforge-meta-io"
include ":dataforge-envelope"