From c8f4ba2b01cbd4c3093668a4c3651c9de0f1821e Mon Sep 17 00:00:00 2001 From: Robinson Date: Mon, 23 Aug 2021 00:52:16 -0600 Subject: [PATCH] Now using the storage project --- LICENSE | 358 ++++++++++++- LICENSE.OLDAPv2.8 | 47 -- build.gradle.kts | 489 +++++++++--------- gradle.properties | 15 + .../network/connection/CryptoManagement.kt | 2 +- src/dorkbox/network/connection/EndPoint.kt | 2 +- .../SettingsStore.kt | 16 +- src9/dorkbox/network/storage/EmptyClass.java | 24 - .../network/storage/types/EmptyClass.java | 24 - src9/module-info.java | 3 - test/dorkboxTest/network/StorageTest.kt | 2 +- 11 files changed, 609 insertions(+), 373 deletions(-) delete mode 100644 LICENSE.OLDAPv2.8 create mode 100644 gradle.properties rename src/dorkbox/network/{storage => serialization}/SettingsStore.kt (98%) delete mode 100644 src9/dorkbox/network/storage/EmptyClass.java delete mode 100644 src9/dorkbox/network/storage/types/EmptyClass.java diff --git a/LICENSE b/LICENSE index ad68cc22..598caecc 100644 --- a/LICENSE +++ b/LICENSE @@ -79,13 +79,6 @@ https://github.com/EsotericSoftware/minlog Nathan Sweet - - Kryo Serializers - Extra kryo serializers - [The Apache Software License, Version 2.0] - https://github.com/magro/kryo-serializers - Copyright 2021 - Martin Grotzke - Rafael Winterhalter - - Conversant Disruptor - Disruptor is the highest performing intra-thread transfer mechanism available in Java. [The Apache Software License, Version 2.0] https://github.com/conversant/disruptor @@ -116,6 +109,96 @@ Copyright 2021 QOS.ch + - ByteUtilties - Byte manipulation and Unsigned Number Utilities + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/ByteUtilities + Copyright 2021 + Dorkbox LLC + + Extra license information + - Byte Utils (UByte, UInteger, ULong, Unsigned, UNumber, UShort) - + [The Apache Software License, Version 2.0] + https://github.com/jOOQ/jOOQ/tree/master/jOOQ/src/main/java/org/jooq/types + Copyright 2017 + Data Geekery GmbH (http://www.datageekery.com) + Lukas Eder + Ed Schaller + Jens Nerche + Ivan Sokolov + + - Kryo Serialization - + [BSD 3-Clause License] + https://github.com/EsotericSoftware/kryo + Copyright 2020 + Nathan Sweet + + - Kotlin Hex - + [MIT License] + https://github.com/komputing/KHex + Copyright 2017 + ligi + + - Base58 - + [The Apache Software License, Version 2.0] + https://bitcoinj.github.io + https://github.com/komputing/KBase58 + Copyright 2018 + Google Inc + Andreas Schildbach + ligi + + - Kotlin - + [The Apache Software License, Version 2.0] + https://github.com/JetBrains/kotlin + Copyright 2020 + JetBrains s.r.o. and Kotlin Programming Language contributors + Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply + See: https://github.com/JetBrains/kotlin/blob/master/license/README.md + + - Netty - An event-driven asynchronous network application framework + [The Apache Software License, Version 2.0] + https://netty.io + Copyright 2021 + The Netty Project + Contributors. See source NOTICE + + - Kryo - Fast and efficient binary object graph serialization framework for Java + [BSD 3-Clause License] + https://github.com/EsotericSoftware/kryo + Copyright 2021 + Nathan Sweet + + Extra license information + - ReflectASM - + [BSD 3-Clause License] + https://github.com/EsotericSoftware/reflectasm + Nathan Sweet + + - Objenesis - + [The Apache Software License, Version 2.0] + http://objenesis.org + Objenesis Team and all contributors + + - MinLog-SLF4J - + [BSD 3-Clause License] + https://github.com/EsotericSoftware/minlog + Nathan Sweet + + - Updates - Software Update Management + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Updates + Copyright 2021 + Dorkbox LLC + + Extra license information + - Kotlin - + [The Apache Software License, Version 2.0] + https://github.com/JetBrains/kotlin + Copyright 2020 + JetBrains s.r.o. and Kotlin Programming Language contributors + Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply + See: https://github.com/JetBrains/kotlin/blob/master/license/README.md + - MinLog - Drop-in replacement for MinLog to log through SLF4j. [BSD 3-Clause License] https://git.dorkbox.com/dorkbox/MinLog-SLF4J @@ -410,6 +493,267 @@ Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply See: https://github.com/JetBrains/kotlin/blob/master/license/README.md + - Storage - Storage system for Java + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Storage + Copyright 2021 + Dorkbox LLC + + Extra license information + - Kotlin - + [The Apache Software License, Version 2.0] + https://github.com/JetBrains/kotlin + Copyright 2020 + JetBrains s.r.o. and Kotlin Programming Language contributors + Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply + See: https://github.com/JetBrains/kotlin/blob/master/license/README.md + + - kotlin-logging - Lightweight logging framework for Kotlin + [The Apache Software License, Version 2.0] + https://github.com/MicroUtils/kotlin-logging + Copyright 2021 + Ohad Shai + + - SLF4J - Simple facade or abstraction for various logging frameworks + [MIT License] + http://www.slf4j.org + Copyright 2021 + QOS.ch + + - Kryo - Fast and efficient binary object graph serialization framework for Java + [BSD 3-Clause License] + https://github.com/EsotericSoftware/kryo + Copyright 2021 + Nathan Sweet + + Extra license information + - ReflectASM - + [BSD 3-Clause License] + https://github.com/EsotericSoftware/reflectasm + Nathan Sweet + + - Objenesis - + [The Apache Software License, Version 2.0] + http://objenesis.org + Objenesis Team and all contributors + + - MinLog-SLF4J - + [BSD 3-Clause License] + https://github.com/EsotericSoftware/minlog + Nathan Sweet + + - ByteUtilties - Byte manipulation and Unsigned Number Utilities + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/ByteUtilities + Copyright 2021 + Dorkbox LLC + + Extra license information + - Byte Utils (UByte, UInteger, ULong, Unsigned, UNumber, UShort) - + [The Apache Software License, Version 2.0] + https://github.com/jOOQ/jOOQ/tree/master/jOOQ/src/main/java/org/jooq/types + Copyright 2017 + Data Geekery GmbH (http://www.datageekery.com) + Lukas Eder + Ed Schaller + Jens Nerche + Ivan Sokolov + + - Kryo Serialization - + [BSD 3-Clause License] + https://github.com/EsotericSoftware/kryo + Copyright 2020 + Nathan Sweet + + - Kotlin Hex - + [MIT License] + https://github.com/komputing/KHex + Copyright 2017 + ligi + + - Base58 - + [The Apache Software License, Version 2.0] + https://bitcoinj.github.io + https://github.com/komputing/KBase58 + Copyright 2018 + Google Inc + Andreas Schildbach + ligi + + - Kotlin - + [The Apache Software License, Version 2.0] + https://github.com/JetBrains/kotlin + Copyright 2020 + JetBrains s.r.o. and Kotlin Programming Language contributors + Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply + See: https://github.com/JetBrains/kotlin/blob/master/license/README.md + + - Netty - An event-driven asynchronous network application framework + [The Apache Software License, Version 2.0] + https://netty.io + Copyright 2021 + The Netty Project + Contributors. See source NOTICE + + - Kryo - Fast and efficient binary object graph serialization framework for Java + [BSD 3-Clause License] + https://github.com/EsotericSoftware/kryo + Copyright 2021 + Nathan Sweet + + Extra license information + - ReflectASM - + [BSD 3-Clause License] + https://github.com/EsotericSoftware/reflectasm + Nathan Sweet + + - Objenesis - + [The Apache Software License, Version 2.0] + http://objenesis.org + Objenesis Team and all contributors + + - MinLog-SLF4J - + [BSD 3-Clause License] + https://github.com/EsotericSoftware/minlog + Nathan Sweet + + - Updates - Software Update Management + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Updates + Copyright 2021 + Dorkbox LLC + + Extra license information + - Kotlin - + [The Apache Software License, Version 2.0] + https://github.com/JetBrains/kotlin + Copyright 2020 + JetBrains s.r.o. and Kotlin Programming Language contributors + Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply + See: https://github.com/JetBrains/kotlin/blob/master/license/README.md + + - Serializers - Kryo based serializers + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Serializers + Copyright 2021 + Dorkbox LLC + + Extra license information + - Kryo Serializers - + [The Apache Software License, Version 2.0] + https://github.com/magro/kryo-serializers + Copyright 2021 + Martin Grotzke + Rafael Winterhalter + + - Kotlin - + [The Apache Software License, Version 2.0] + https://github.com/JetBrains/kotlin + Copyright 2020 + JetBrains s.r.o. and Kotlin Programming Language contributors + Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply + See: https://github.com/JetBrains/kotlin/blob/master/license/README.md + + - Bouncy Castle Crypto - Lightweight cryptography API and JCE Extension + [The Apache Software License, Version 2.0] + http://www.bouncycastle.org + Copyright 2021 + The Legion of the Bouncy Castle Inc + + - Kryo - Fast and efficient binary object graph serialization framework for Java + [BSD 3-Clause License] + https://github.com/EsotericSoftware/kryo + Copyright 2021 + Nathan Sweet + + Extra license information + - ReflectASM - + [BSD 3-Clause License] + https://github.com/EsotericSoftware/reflectasm + Nathan Sweet + + - Objenesis - + [The Apache Software License, Version 2.0] + http://objenesis.org + Objenesis Team and all contributors + + - MinLog-SLF4J - + [BSD 3-Clause License] + https://github.com/EsotericSoftware/minlog + Nathan Sweet + + - Updates - Software Update Management + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Updates + Copyright 2021 + Dorkbox LLC + + Extra license information + - Kotlin - + [The Apache Software License, Version 2.0] + https://github.com/JetBrains/kotlin + Copyright 2020 + JetBrains s.r.o. and Kotlin Programming Language contributors + Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply + See: https://github.com/JetBrains/kotlin/blob/master/license/README.md + + - ObjectPool - Fast, lightweight, and compatible blocking/non-blocking/soft-reference object pool for Java 8+ + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/ObjectPool + Copyright 2021 + Dorkbox LLC + + Extra license information + - Kotlin - + [The Apache Software License, Version 2.0] + https://github.com/JetBrains/kotlin + Copyright 2020 + JetBrains s.r.o. and Kotlin Programming Language contributors + Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply + See: https://github.com/JetBrains/kotlin/blob/master/license/README.md + + - kotlinx.coroutines - Library support for Kotlin coroutines with multiplatform support + [The Apache Software License, Version 2.0] + https://github.com/Kotlin/kotlinx.coroutines + Copyright 2021 + JetBrains s.r.o. + + - Conversant Disruptor - Disruptor is the highest performing intra-thread transfer mechanism available in Java. + [The Apache Software License, Version 2.0] + https://github.com/conversant/disruptor + Copyright 2021 + Conversant, Inc + + - Updates - Software Update Management + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Updates + Copyright 2021 + Dorkbox LLC + + Extra license information + - Kotlin - + [The Apache Software License, Version 2.0] + https://github.com/JetBrains/kotlin + Copyright 2020 + JetBrains s.r.o. and Kotlin Programming Language contributors + Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply + See: https://github.com/JetBrains/kotlin/blob/master/license/README.md + + - Updates - Software Update Management + [The Apache Software License, Version 2.0] + https://git.dorkbox.com/dorkbox/Updates + Copyright 2021 + Dorkbox LLC + + Extra license information + - Kotlin - + [The Apache Software License, Version 2.0] + https://github.com/JetBrains/kotlin + Copyright 2020 + JetBrains s.r.o. and Kotlin Programming Language contributors + Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply + See: https://github.com/JetBrains/kotlin/blob/master/license/README.md + - Updates - Software Update Management [The Apache Software License, Version 2.0] https://git.dorkbox.com/dorkbox/Updates diff --git a/LICENSE.OLDAPv2.8 b/LICENSE.OLDAPv2.8 deleted file mode 100644 index 05ad7571..00000000 --- a/LICENSE.OLDAPv2.8 +++ /dev/null @@ -1,47 +0,0 @@ -The OpenLDAP Public License - Version 2.8, 17 August 2003 - -Redistribution and use of this software and associated documentation -("Software"), with or without modification, are permitted provided -that the following conditions are met: - -1. Redistributions in source form must retain copyright statements - and notices, - -2. Redistributions in binary form must reproduce applicable copyright - statements and notices, this list of conditions, and the following - disclaimer in the documentation and/or other materials provided - with the distribution, and - -3. Redistributions must contain a verbatim copy of this document. - -The OpenLDAP Foundation may revise this license from time to time. -Each revision is distinguished by a version number. You may use -this Software under terms of this license revision or under the -terms of any subsequent revision of the license. - -THIS SOFTWARE IS PROVIDED BY THE OPENLDAP FOUNDATION AND ITS -CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL THE OPENLDAP FOUNDATION, ITS CONTRIBUTORS, OR THE AUTHOR(S) -OR OWNER(S) OF THE SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -The names of the authors and copyright holders must not be used in -advertising or otherwise to promote the sale, use or other dealing -in this Software without specific, written prior permission. Title -to copyright in this Software shall at all times remain with copyright -holders. - -OpenLDAP is a registered trademark of the OpenLDAP Foundation. - -Copyright 1999-2003 The OpenLDAP Foundation, Redwood City, -California, USA. All Rights Reserved. Permission to copy and -distribute verbatim copies of this document is granted. diff --git a/build.gradle.kts b/build.gradle.kts index 1644241b..93961623 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,253 +1,236 @@ -/* - * Copyright 2020 dorkbox, llc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import java.time.Instant - -/////////////////////////////// -////// PUBLISH TO SONATYPE / MAVEN CENTRAL -////// TESTING : (to local maven repo) <'publish and release' - 'publishToMavenLocal'> -////// RELEASE : (to sonatype/maven central), <'publish and release' - 'publishToSonatypeAndRelease'> -/////////////////////////////// - -gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS // always show the stacktrace! -gradle.startParameter.warningMode = WarningMode.All - -//buildscript { -// dependencies { -// classpath(project.files("D:\\Code\\dorkbox\\public_projects_build_system\\GradleUtils\\build\\libs\\GradleUtils-2.7.jar")) -// } -//} - -plugins { - id("com.dorkbox.GradleUtils") version "2.9" - id("com.dorkbox.Licensing") version "2.9.2" - id("com.dorkbox.VersionUpdate") version "2.4" - id("com.dorkbox.GradlePublish") version "1.11" - - kotlin("jvm") version "1.5.21" -} - -//apply(plugin = "com.dorkbox.GradleUtils") -//val GradleUtils = (project as org.gradle.api.plugins.ExtensionAware).extensions.getByName("GradleUtils") as dorkbox.gradle.StaticMethodsAndTools - - -object Extras { - // set for the project - const val description = "Encrypted, high-performance, and event-driven/reactive network stack for Java 8+" - const val group = "com.dorkbox" - const val version = "5.5" - - // set as project.ext - const val name = "Network" - const val id = "Network" - const val vendor = "Dorkbox LLC" - const val vendorUrl = "https://dorkbox.com" - const val url = "https://git.dorkbox.com/dorkbox/Network" - - val buildDate = Instant.now().toString() -} - -/////////////////////////////// -///// assign 'Extras' -/////////////////////////////// -dorkbox.gradle.GradleUtils.load("$projectDir/../../gradle.properties", Extras) -dorkbox.gradle.GradleUtils.defaults() -// because of the api changes for stacktrace stuff, it's best for us to ONLY support 11+ -GradleUtils.compileConfiguration(JavaVersion.VERSION_1_8) { - // see: https://kotlinlang.org/docs/reference/using-gradle.html - // enable the use of inline classes. see https://kotlinlang.org/docs/reference/inline-classes.html - freeCompilerArgs = listOf("-Xinline-classes") -} -GradleUtils.jpms(JavaVersion.VERSION_1_9) - - -// ratelimiter, "other" package -// rest of unit tests -// getConnectionUpgradeType -// ability to send with a function callback (using RMI waiter type stuff for callbacks) -// use conscrypt?! - -// java 14 is faster with aeron! -// NOTE: now using aeron instead of netty -// todo: remove BC! use conscrypt instead, or native java? (if possible. we are java 11 now, instead of 1.6) - - -// also, NOT using bouncastle, but instead the google one -// better SSL library -// implementation("org.conscrypt:conscrypt-openjdk-uber:2.2.1") -// init { -// try { -// Security.insertProviderAt(Conscrypt.newProvider(), 1); -// } -// catch (e: Throwable) { -// e.printStackTrace(); -// } -// } - - -licensing { - license(License.APACHE_2) { - description(Extras.description) - url(Extras.url) - author(Extras.vendor) - - extra("KryoNet RMI", License.BSD_3) { - copyright(2008) - author("Nathan Sweet") - url("https://github.com/EsotericSoftware/kryonet") - } - extra("Kryo Serialization", License.BSD_3) { - copyright(2020) - author("Nathan Sweet") - url("https://github.com/EsotericSoftware/kryo") - } - extra("LAN HostDiscovery from Apache Commons JCS", License.APACHE_2) { - copyright(2014) - author("The Apache Software Foundation") - url("https://issues.apache.org/jira/browse/JCS-40") - } - extra("MathUtils, IntArray, IntMap", License.APACHE_2) { - copyright(2013) - author("Mario Zechner ") - author("Nathan Sweet ") - url("http://github.com/libgdx/libgdx") - } - extra("Netty (Various network + platform utilities)", License.APACHE_2) { - copyright(2014) - description("An event-driven asynchronous network application framework") - author("The Netty Project") - author("Contributors. See source NOTICE") - url("https://netty.io") - } - } -} - -tasks.jar.get().apply { - manifest { - // https://docs.oracle.com/javase/tutorial/deployment/jar/packageman.html - attributes["Name"] = Extras.name - - attributes["Specification-Title"] = Extras.name - attributes["Specification-Version"] = Extras.version - attributes["Specification-Vendor"] = Extras.vendor - - attributes["Implementation-Title"] = "${Extras.group}.${Extras.id}" - attributes["Implementation-Version"] = Extras.buildDate - attributes["Implementation-Vendor"] = Extras.vendor - } -} - -dependencies { - implementation("org.jetbrains.kotlinx:atomicfu:0.16.2") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1") - - // https://github.com/dorkbox - implementation("com.dorkbox:MinLog:2.4") - implementation("com.dorkbox:NetworkUtils:2.8") - implementation("com.dorkbox:ObjectPool:3.4") - implementation("com.dorkbox:Serializers:2.0") -// implementation("com.dorkbox:Storage:1.0") - implementation("com.dorkbox:Updates:1.1") - implementation("com.dorkbox:Utilities:1.12") - - - // https://github.com/real-logic/aeron - val aeronVer = "1.35.0" - // REMOVE UdpChannel when ISSUE https://github.com/real-logic/aeron/issues/1057 is resolved! (hopefully in 1.30.0) - implementation("io.aeron:aeron-client:$aeronVer") - implementation("io.aeron:aeron-driver:$aeronVer") - - // https://github.com/EsotericSoftware/kryo - implementation("com.esotericsoftware:kryo:5.2.0") { - exclude("com.esotericsoftware", "minlog") // we use our own minlog, that logs to SLF4j instead - } - - // https://github.com/magro/kryo-serializers - implementation("de.javakaffee:kryo-serializers:0.45"){ - exclude("com.esotericsoftware", "kryo") // we use na updated kryo+ our own min-log, that logs to SLF4j - } - - // https://github.com/jpountz/lz4-java -// implementation("net.jpountz.lz4:lz4:1.3.0") - - // this is NOT the same thing as LMAX disruptor. - // This is just a really fast queue (where LMAX is a fast queue + other things w/ a difficult DSL) - // https://github.com/conversant/disruptor_benchmark - // https://www.youtube.com/watch?v=jVMOgQgYzWU - implementation("com.conversantmedia:disruptor:1.2.19") - - // https://github.com/jhalterman/typetools - implementation("net.jodah:typetools:0.6.3") - -// // really fast storage -// // https://github.com/lmdbjava/lmdbjava -// val lmdbJava = "org.lmdbjava:lmdbjava:0.8.1" -// compileOnly(lmdbJava) -// -// // https://github.com/OpenHFT/Chronicle-Map -// val chronicleMap = "net.openhft:chronicle-map:3.20.84" -// compileOnly(chronicleMap) { -// exclude("com.intellij", "annotations") // not even available at runtime -// // optional from chronicle-map. These cause JPMS to fail! -// exclude("com.thoughtworks.xstream", "xstream") -// exclude("org.ops4j.pax.url", "pax-url-aether") -// exclude("org.codehaus.jettison", "jettison") -// } -// - - // Jodah Expiring Map (A high performance thread-safe map that expires entries) - // https://github.com/jhalterman/expiringmap - implementation("net.jodah:expiringmap:0.5.10") - - - - // https://github.com/MicroUtils/kotlin-logging - implementation("io.github.microutils:kotlin-logging:2.0.10") - implementation("org.slf4j:slf4j-api:1.8.0-beta4") - - - - -// testImplementation(lmdbJava) -// testImplementation(chronicleMap) - - testImplementation("junit:junit:4.13.1") - testImplementation("ch.qos.logback:logback-classic:1.3.0-alpha4") -} - -publishToSonatype { - groupId = Extras.group - artifactId = Extras.id - version = Extras.version - - name = Extras.name - description = Extras.description - url = Extras.url - - vendor = Extras.vendor - vendorUrl = Extras.vendorUrl - - issueManagement { - url = "${Extras.url}/issues" - nickname = "Gitea Issues" - } - - developer { - id = "dorkbox" - name = Extras.vendor - email = "email@dorkbox.com" - } -} +/* + * Copyright 2020 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.time.Instant + +/////////////////////////////// +////// PUBLISH TO SONATYPE / MAVEN CENTRAL +////// TESTING : (to local maven repo) <'publish and release' - 'publishToMavenLocal'> +////// RELEASE : (to sonatype/maven central), <'publish and release' - 'publishToSonatypeAndRelease'> +/////////////////////////////// + +gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS // always show the stacktrace! + +plugins { + id("com.dorkbox.GradleUtils") version "2.9" + id("com.dorkbox.Licensing") version "2.9.2" + id("com.dorkbox.VersionUpdate") version "2.4" + id("com.dorkbox.GradlePublish") version "1.11" + + kotlin("jvm") version "1.5.21" +} + +object Extras { + // set for the project + const val description = "Encrypted, high-performance, and event-driven/reactive network stack for Java 8+" + const val group = "com.dorkbox" + const val version = "5.5" + + // set as project.ext + const val name = "Network" + const val id = "Network" + const val vendor = "Dorkbox LLC" + const val vendorUrl = "https://dorkbox.com" + const val url = "https://git.dorkbox.com/dorkbox/Network" + + val buildDate = Instant.now().toString() +} + +/////////////////////////////// +///// assign 'Extras' +/////////////////////////////// +GradleUtils.load("$projectDir/../../gradle.properties", Extras) +GradleUtils.defaults() +// because of the api changes for stacktrace stuff, it's best for us to ONLY support 11+ +GradleUtils.compileConfiguration(JavaVersion.VERSION_1_8) { + // see: https://kotlinlang.org/docs/reference/using-gradle.html + // enable the use of inline classes. see https://kotlinlang.org/docs/reference/inline-classes.html + freeCompilerArgs = listOf("-Xinline-classes") +} +GradleUtils.jpms(JavaVersion.VERSION_1_9) + + +// ratelimiter, "other" package +// rest of unit tests +// getConnectionUpgradeType +// ability to send with a function callback (using RMI waiter type stuff for callbacks) +// use conscrypt?! + +// java 14 is faster with aeron! +// NOTE: now using aeron instead of netty +// todo: remove BC! use conscrypt instead, or native java? (if possible. we are java 11 now, instead of 1.6) + + +// also, NOT using bouncastle, but instead the google one +// better SSL library +// implementation("org.conscrypt:conscrypt-openjdk-uber:2.2.1") +// init { +// try { +// Security.insertProviderAt(Conscrypt.newProvider(), 1); +// } +// catch (e: Throwable) { +// e.printStackTrace(); +// } +// } + + +licensing { + license(License.APACHE_2) { + description(Extras.description) + url(Extras.url) + author(Extras.vendor) + + extra("KryoNet RMI", License.BSD_3) { + copyright(2008) + author("Nathan Sweet") + url("https://github.com/EsotericSoftware/kryonet") + } + extra("Kryo Serialization", License.BSD_3) { + copyright(2020) + author("Nathan Sweet") + url("https://github.com/EsotericSoftware/kryo") + } + extra("LAN HostDiscovery from Apache Commons JCS", License.APACHE_2) { + copyright(2014) + author("The Apache Software Foundation") + url("https://issues.apache.org/jira/browse/JCS-40") + } + extra("MathUtils, IntArray, IntMap", License.APACHE_2) { + copyright(2013) + author("Mario Zechner ") + author("Nathan Sweet ") + url("http://github.com/libgdx/libgdx") + } + extra("Netty (Various network + platform utilities)", License.APACHE_2) { + copyright(2014) + description("An event-driven asynchronous network application framework") + author("The Netty Project") + author("Contributors. See source NOTICE") + url("https://netty.io") + } + } +} + +tasks.jar.get().apply { + manifest { + // https://docs.oracle.com/javase/tutorial/deployment/jar/packageman.html + attributes["Name"] = Extras.name + + attributes["Specification-Title"] = Extras.name + attributes["Specification-Version"] = Extras.version + attributes["Specification-Vendor"] = Extras.vendor + + attributes["Implementation-Title"] = "${Extras.group}.${Extras.id}" + attributes["Implementation-Version"] = Extras.buildDate + attributes["Implementation-Vendor"] = Extras.vendor + } +} + +dependencies { + implementation("org.jetbrains.kotlinx:atomicfu:0.16.2") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1") + + // https://github.com/dorkbox + implementation("com.dorkbox:ByteUtilities:1.3") + implementation("com.dorkbox:MinLog:2.4") + implementation("com.dorkbox:NetworkUtils:2.8") + implementation("com.dorkbox:ObjectPool:3.4") + implementation("com.dorkbox:Serializers:2.5") + implementation("com.dorkbox:Storage:1.0") + implementation("com.dorkbox:Updates:1.1") + implementation("com.dorkbox:Utilities:1.12") + + + // https://github.com/real-logic/aeron + val aeronVer = "1.35.0" + // REMOVE UdpChannel when ISSUE https://github.com/real-logic/aeron/issues/1057 is resolved! (hopefully in 1.30.0) + implementation("io.aeron:aeron-client:$aeronVer") + implementation("io.aeron:aeron-driver:$aeronVer") + + // https://github.com/EsotericSoftware/kryo + implementation("com.esotericsoftware:kryo:5.2.0") { + exclude("com.esotericsoftware", "minlog") // we use our own minlog, that logs to SLF4j instead + } + + // https://github.com/jpountz/lz4-java +// implementation("net.jpountz.lz4:lz4:1.3.0") + + // this is NOT the same thing as LMAX disruptor. + // This is just a really fast queue (where LMAX is a fast queue + other things w/ a difficult DSL) + // https://github.com/conversant/disruptor_benchmark + // https://www.youtube.com/watch?v=jVMOgQgYzWU + implementation("com.conversantmedia:disruptor:1.2.19") + + // https://github.com/jhalterman/typetools + implementation("net.jodah:typetools:0.6.3") + +// // really fast storage +// // https://github.com/lmdbjava/lmdbjava +// val lmdbJava = "org.lmdbjava:lmdbjava:0.8.1" +// compileOnly(lmdbJava) +// +// // https://github.com/OpenHFT/Chronicle-Map +// val chronicleMap = "net.openhft:chronicle-map:3.20.84" +// compileOnly(chronicleMap) { +// exclude("com.intellij", "annotations") // not even available at runtime +// // optional from chronicle-map. These cause JPMS to fail! +// exclude("com.thoughtworks.xstream", "xstream") +// exclude("org.ops4j.pax.url", "pax-url-aether") +// exclude("org.codehaus.jettison", "jettison") +// } +// + + // Jodah Expiring Map (A high performance thread-safe map that expires entries) + // https://github.com/jhalterman/expiringmap + implementation("net.jodah:expiringmap:0.5.10") + + + + // https://github.com/MicroUtils/kotlin-logging + implementation("io.github.microutils:kotlin-logging:2.0.10") + implementation("org.slf4j:slf4j-api:1.8.0-beta4") + + +// testImplementation(lmdbJava) +// testImplementation(chronicleMap) + + testImplementation("junit:junit:4.13.1") + testImplementation("ch.qos.logback:logback-classic:1.3.0-alpha4") +} + +publishToSonatype { + groupId = Extras.group + artifactId = Extras.id + version = Extras.version + + name = Extras.name + description = Extras.description + url = Extras.url + + vendor = Extras.vendor + vendorUrl = Extras.vendorUrl + + issueManagement { + url = "${Extras.url}/issues" + nickname = "Gitea Issues" + } + + developer { + id = "dorkbox" + name = Extras.vendor + email = "email@dorkbox.com" + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..3a3f587c --- /dev/null +++ b/gradle.properties @@ -0,0 +1,15 @@ +# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +org.gradle.jvmargs=-Dfile.encoding=UTF-8 + +#org.gradle.warning.mode=(all,fail,none,summary) +org.gradle.warning.mode=all + +#org.gradle.daemon=false +# default is 3 hours, this is 1 minute +org.gradle.daemon.idletimeout=60000 + +#org.gradle.console=(auto,plain,rich,verbose) +org.gradle.console=auto + +#org.gradle.logging.level=(quiet,warn,lifecycle,info,debug) +org.gradle.logging.level=lifecycle diff --git a/src/dorkbox/network/connection/CryptoManagement.kt b/src/dorkbox/network/connection/CryptoManagement.kt index 23dd4cbf..8006b3a0 100644 --- a/src/dorkbox/network/connection/CryptoManagement.kt +++ b/src/dorkbox/network/connection/CryptoManagement.kt @@ -21,7 +21,7 @@ import dorkbox.netUtil.IP import dorkbox.network.handshake.ClientConnectionInfo import dorkbox.network.serialization.AeronInput import dorkbox.network.serialization.AeronOutput -import dorkbox.network.storage.SettingsStore +import dorkbox.network.serialization.SettingsStore import dorkbox.util.entropy.Entropy import dorkbox.util.exceptions.SecurityException import mu.KLogger diff --git a/src/dorkbox/network/connection/EndPoint.kt b/src/dorkbox/network/connection/EndPoint.kt index 1ed40701..421c48ad 100644 --- a/src/dorkbox/network/connection/EndPoint.kt +++ b/src/dorkbox/network/connection/EndPoint.kt @@ -35,7 +35,7 @@ import dorkbox.network.rmi.messages.MethodResponse import dorkbox.network.rmi.messages.RmiMessage import dorkbox.network.serialization.KryoExtra import dorkbox.network.serialization.Serialization -import dorkbox.network.storage.SettingsStore +import dorkbox.network.serialization.SettingsStore import dorkbox.util.exceptions.SecurityException import io.aeron.Publication import io.aeron.driver.MediaDriver diff --git a/src/dorkbox/network/storage/SettingsStore.kt b/src/dorkbox/network/serialization/SettingsStore.kt similarity index 98% rename from src/dorkbox/network/storage/SettingsStore.kt rename to src/dorkbox/network/serialization/SettingsStore.kt index d487883f..dd6d02a3 100644 --- a/src/dorkbox/network/storage/SettingsStore.kt +++ b/src/dorkbox/network/serialization/SettingsStore.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020 dorkbox, llc + * Copyright 2021 dorkbox, llc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package dorkbox.network.storage +package dorkbox.network.serialization import dorkbox.bytes.decodeBase58 import dorkbox.bytes.encodeToBase58String @@ -53,7 +53,7 @@ class SettingsStore(storageBuilder: Storage.Builder, val logger: KLogger) : Auto init { store = storageBuilder.logger(logger).apply { - if (!isStringBased) { + if (isStringBased) { // have to load/save keys+values as strings onLoad { key, value, load -> // key/value will be strings for a string based storage system @@ -64,7 +64,7 @@ class SettingsStore(storageBuilder: Storage.Builder, val logger: KLogger) : Auto val xKey: Any? = when (key) { saltKey, privateKey -> key else -> { - IP.toAddress(key) + IP.toAddress(key) } } @@ -113,14 +113,6 @@ class SettingsStore(storageBuilder: Storage.Builder, val logger: KLogger) : Auto }.build() - - - - - - - - // have to init salt val currentValue: ByteArray? = store[saltKey] if (currentValue == null) { diff --git a/src9/dorkbox/network/storage/EmptyClass.java b/src9/dorkbox/network/storage/EmptyClass.java deleted file mode 100644 index ef832188..00000000 --- a/src9/dorkbox/network/storage/EmptyClass.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2021 dorkbox, llc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package dorkbox.network.storage; - -/** - * Required for intellij to not complain regarding `module-info` for a multi-release jar. - * This file is completely ignored by the gradle build process - */ -public -class EmptyClass {} diff --git a/src9/dorkbox/network/storage/types/EmptyClass.java b/src9/dorkbox/network/storage/types/EmptyClass.java deleted file mode 100644 index 43bf7b34..00000000 --- a/src9/dorkbox/network/storage/types/EmptyClass.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2021 dorkbox, llc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package dorkbox.network.storage.types; - -/** - * Required for intellij to not complain regarding `module-info` for a multi-release jar. - * This file is completely ignored by the gradle build process - */ -public -class EmptyClass {} diff --git a/src9/module-info.java b/src9/module-info.java index 712742b0..6259e56e 100644 --- a/src9/module-info.java +++ b/src9/module-info.java @@ -10,8 +10,6 @@ module dorkbox.network { exports dorkbox.network.ping; exports dorkbox.network.rmi; exports dorkbox.network.serialization; - exports dorkbox.network.storage; - exports dorkbox.network.storage.types; requires dorkbox.bytes; requires dorkbox.updates; @@ -24,7 +22,6 @@ module dorkbox.network { requires expiringmap; requires net.jodah.typetools; -// requires de.javakaffee.kryoserializers; requires com.esotericsoftware.kryo; requires com.esotericsoftware.reflectasm; requires org.objenesis; diff --git a/test/dorkboxTest/network/StorageTest.kt b/test/dorkboxTest/network/StorageTest.kt index 096e52b2..15d4bd7e 100644 --- a/test/dorkboxTest/network/StorageTest.kt +++ b/test/dorkboxTest/network/StorageTest.kt @@ -18,7 +18,7 @@ package dorkboxTest.network import dorkbox.network.Client import dorkbox.network.Server import dorkbox.network.connection.Connection -import dorkbox.network.storage.SettingsStore +import dorkbox.network.serialization.SettingsStore import dorkbox.storage.Storage import mu.KotlinLogging import org.junit.Assert