Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 575aadb9 authored by Yannick Li's avatar Yannick Li
Browse files

Add JsName annotation

parent 403da151
No related branches found
No related tags found
1 merge request!6Resolve "Update to c-crdtlib v1.0.0"
......@@ -94,6 +94,7 @@ class Collection {
/**
* Closes this collection.
*/
@Name("close")
fun close() {
val cobjects = this.openedObjects.values
for (cobject in cobjects) {
......
......@@ -81,6 +81,7 @@ class Session {
* @param readOnly is read-only mode activated.
* @return the corresponding collection.
*/
@Name("openCollection")
fun openCollection(collectionUId: CollectionUId, readOnly: Boolean): Collection {
if (ActiveTransaction != null) throw RuntimeException("A collection cannot be open within a transaction.")
if (this.isClosed) throw RuntimeException("This session has been closed.")
......@@ -104,6 +105,7 @@ class Session {
* @param type the desired consistency level.
* @param body the transaction body function.
*/
@Name("transaction")
fun transaction(type: ConsistencyLevel, body: TransactionBody): Transaction {
if (ActiveTransaction != null) throw RuntimeException("A transaction is already opened.")
......@@ -116,6 +118,7 @@ class Session {
/**
* Closes this session.
*/
@Name("close")
fun close() {
if(this.isClosed) return
......@@ -139,6 +142,7 @@ class Session {
* @param credentials the credentials provided by the client.
* @return the client session to communicate with Concordant.
*/
@Name("connect")
fun connect(dbName: String, credentials: String): Session {
if (ActiveSession != null) throw RuntimeException("Another session is already active.")
......
......@@ -21,6 +21,7 @@ package client
import client.utils.ActiveTransaction
import client.utils.TransactionBody
import client.utils.Name
/**
* This class represents a transaction.
......@@ -55,11 +56,13 @@ class Transaction {
/**
* Commits this transaction.
*/
@Name("commit")
fun commit() { }
/**
* Aborts this transaction.
*/
@Name("abort")
fun abort() {
throw RuntimeException("Transaction abort is not supported yet.")
}
......
/*
* Copyright © 2020, Concordant and contributors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package client.utils
expect annotation class Name(val name: String)
/*
* Copyright © 2020, Concordant and contributors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package client.utils
actual annotation class Name(actual val name: String)
/*
* Copyright © 2020, Concordant and contributors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package client.utils
actual typealias Name = kotlin.js.JsName
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment