refactored packages, added more docs

This commit is contained in:
sergeych committed 2024-02-19 03:33:45 +03:00
1 parent babc3933eb
commit 3c33eb3bd9
8 files changed
+23 -10

No files matched your search

+15 -2
View File
@@ -1,6 +1,13 @@
# Module mp_bintools
This library contains a `Bipack` binary format serializer, see [net.sergeych.bipack.BipackEncoder] and [net.sergeych.bipack.BipackDecoder]. Also, there are many general-purpose utilities that simplify binary data processing, see package [net.sergeych.bintools] below.
## Collection of binary tools
Most interesting:
- Full set of CRC: [net.sergeych.bintools.CRC]
- Binary bit-effective __BiPack format__ serializer: [net.sergeych.bipack.BipackEncoder] and [net.sergeych.bipack.BipackDecoder]. Also typed key-value storage for it, see [net.sergeych.bipack.KVStorage] and its delegates and [net.sergeych.bipack.defaultNamedStorage].
- Multiplatform synchronization tools, that works the same and properly on JS, native and JVM, see [net.sergeych.synctools]
- many general-purpose utilities that simplify binary data processing, see package [net.sergeych.bintools] below.
# Package net.sergeych.bipack
@@ -16,4 +23,10 @@ There are also special annotation to fine tune the format: [Extendable], [Framed
General-purpose binary tools: encoding to bytes, hex, binary dumps. variable length integer, ect. Most of it is used internally by bipack serializers, see [net.sergeych.bipack] for details.
In particular, see [Varint] and [Smartint] variable-length compact integer codecs and also [DataSource] and [DataSink] multiplatform synchronous read/write interfaces.
In particular, see [Varint] and [Smartint] variable-length compact integer codecs and also [DataSource] and [DataSink] multiplatform synchronous read/write interfaces.
# Package net.sergeych.synctools
To write a code that compiles and runs, and most likely works on the
JS, native, and JVM, we need some portable/compatible synchronization
primitives. This package is a collection of such.
@@ -2,9 +2,9 @@ package net.sergeych.bintools
import net.sergeych.bipack.BipackDecoder
import net.sergeych.bipack.BipackEncoder
import net.sergeych.synctools.ProtectedOp
import net.sergeych.synctools.WaitHandle
import net.sergeych.tools.ProtectedOp
import net.sergeych.tools.withLock
import net.sergeych.synctools.withLock
class DataKVStorage(private val provider: DataProvider) : KVStorage {
@@ -1,4 +1,4 @@
package net.sergeych.tools
package net.sergeych.synctools
/**
* Thread-safe multiplatform counter
@@ -1,4 +1,4 @@
package net.sergeych.tools
package net.sergeych.synctools
/**
* Multiplatform (JS and battery included) atomically mutable value.
@@ -1,4 +1,4 @@
package net.sergeych.tools
package net.sergeych.synctools
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
@@ -1,4 +1,4 @@
package net.sergeych.tools
package net.sergeych.synctools
/**
* JS is single-threaded, so we don't need any additional protection:
@@ -1,4 +1,4 @@
package net.sergeych.tools
package net.sergeych.synctools
import java.util.concurrent.locks.ReentrantLock
@@ -1,4 +1,4 @@
package net.sergeych.tools
package net.sergeych.synctools
import kotlinx.atomicfu.locks.ReentrantLock