some docs
This commit is contained in:
parent
ceb6ea53db
commit
0ed084aeee
@ -3,7 +3,8 @@ package net.sergeych.parsec3
|
|||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registry to restore exceptions from parsec block data. Serializing exceptions is dangerous: being a OS-bound
|
* Registry to restore exceptions from parsec block data and encode them to.
|
||||||
|
* Serializing exceptions is dangerous: being a OS-bound
|
||||||
* objects, exceptions can carry too much sensitive or useless information (e.g. call stack), and serializng
|
* objects, exceptions can carry too much sensitive or useless information (e.g. call stack), and serializng
|
||||||
* actual exceptions could be a pain, so parsec3 serializes exception information as 2 parameters: a code string
|
* actual exceptions could be a pain, so parsec3 serializes exception information as 2 parameters: a code string
|
||||||
* which is very much like old good (and awful in a way) `C ERRNO`, and an optional message.
|
* which is very much like old good (and awful in a way) `C ERRNO`, and an optional message.
|
||||||
@ -14,6 +15,10 @@ import kotlin.reflect.KClass
|
|||||||
*
|
*
|
||||||
* The good idea is to share one object inheriting from refistry to hold all exceptions info in one place
|
* The good idea is to share one object inheriting from refistry to hold all exceptions info in one place
|
||||||
* and share it betweem client and server code.
|
* and share it betweem client and server code.
|
||||||
|
*
|
||||||
|
* Note that exception registry is used to properly serialize registered exceptions, so as soon as you have
|
||||||
|
* registered some code and exception, you can throw it inside command implementation and it will be
|
||||||
|
* properly resotred on the remote side.
|
||||||
*/
|
*/
|
||||||
open class ExceptionsRegistry {
|
open class ExceptionsRegistry {
|
||||||
|
|
||||||
|
@ -10,6 +10,10 @@ import java.time.Duration
|
|||||||
import java.util.concurrent.atomic.AtomicInteger
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
import java.util.concurrent.atomic.AtomicLong
|
import java.util.concurrent.atomic.AtomicLong
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a ktor server initialization module capable to perform p3 transport layer (not secure).
|
||||||
|
* It could be used as is or as transport for p3.1
|
||||||
|
*/
|
||||||
fun <S, H : CommandHost<S>>Application.parsec3TransportServer(
|
fun <S, H : CommandHost<S>>Application.parsec3TransportServer(
|
||||||
api: H,
|
api: H,
|
||||||
exceptionsRegistry: ExceptionsRegistry = ExceptionsRegistry(),
|
exceptionsRegistry: ExceptionsRegistry = ExceptionsRegistry(),
|
||||||
|
Loading…
Reference in New Issue
Block a user