libkazv
|
libkazv is a matrix client sdk built upon lager and the value-oriented design it enables.
libkazv support the following functionalities:
These functionalities are currently not supported:
These functionalities may be implemented, but in a low priority:
libkazv is not planning to support these functionalities:
If you are using Gentoo, you can use tusooa-overlay to install libkazv. The dependency olm
can be installed from src_prepare-overlay.
libkazv depends on lager, immer, zug, boost, nlohmann_json, olm, libcrypto++.
kazvjob also depends on cpr.
Tests also depend on Catch2.
Examples also depend on libhttpserver.
You can build libkazv through the standard CMake process:
libkazv offers the following CMake options:
libkazv_BUILD_TESTS
: boolean value to specify whether to build testslibkazv_BUILD_EXAMPLES
: boolean value to specify whether to build exampleslibkazv_OUTPUT_LEVEL
: integral value from 0 to 100 to determine what kinds of logs are shown. Setting to 100 makes libkazv output the most debug information.libkazv_INSTALL_HEADERS
: boolean value to determine whether to install libkazv's headers. This is by default set to OFF when libkazv is built as a subproject.libkazv can be incorporated into your project using CMake FetchContent()
. It can also be used via find_package(libkazv)
. It has a few libraries you can link to:
libkazv::kazvall
is the one that contains API call definitions and client logic. It does not, however, define how the jobs are fetched.libkazv::kazvjob
is a tiny library that provides async and network fetching functionalities. There is one class CprJobHandler
that implements JobInterface
in kazv
. You can link your program to kazvjob
or make up another job handler using what you choose as async and network libraries. To switch from one job handler to another, you only need to change one or two lines in your program.
Note that you will need to add COMPONENTS job
to the arguments of find_package()
to use this.
Tutorial 0: Getting started with libkazv
The API documentation is available at https://kazv.chat/libkazv/api/. You can also use doxygen
at the root directory of the repository to build docs locally. It will be generated in doc/
.
You SHOULD use only the following APIs in your program:
Kazv::makeSdk
, Kazv::makeDefaultEncryptedSdk
, Kazv::makeDefaultSdkWithCryptoRandom
.Kazv::SdkModel
.Kazv::CprJobHandler
, Kazv::AsioPromiseHandler
.Kazv::Sdk
, Kazv::Client
, Kazv::Room
, but not their constructors.Kazv::LagerStoreEventEmitter
.Kazv::Event
).Anything in the kazvapi
module (i.e. the namespace Kazv::Api
) is not meant to be used directly.
You should not rely on the return type of a function if it is declared as auto
(without trailing return type notation). If it returns auto
, you should also use auto
to store that the return value.
If the documented return type is a using
declaration in that class, you should either use auto
or the exact alias (not the aliased type) for that. For example, in Client
, a lot of functions return Client::PromiseT
, so you should use auto
or Client::PromiseT
to refer to the return type.
The following versioning strategies are used:
libkazv_VERSION_STRING
in CMakeLists.txt , in the format of X.Y.Z
. X
, Y
, Z
are called Major, Minor, and Patch Versions respectively.libkazv_SOVERSION
in CMakeLists.txt .When there is a new release, the versions are determined by the following rules:
auto
when specified) that compiles under a certain GCC version will still compile under that GCC version, keep Major Version as the same, increase Minor Version by 1, let Patch Version be 0, and increase so version by 1.A tldr but inaccurate version of the rules: If the new release is binary-compatible with the last one, bump Patch Version; if the new release is not binary-compatible but source-compatible with the last one, bump Minor Version and so version, reset Patch Version; otherwise, bump Major Version and so version, reset Minor and Patch Versions.
libkazv uses gtad to generate the API definitions it needed. The source of the Matrix API is https://github.com/matrix-org/matrix-spec/tree/main/data. The gtad configuration files and json/query serializing used in libkazv are adapted from the ones in libQuotient. libQuotient is released under GNU LGPL v2.1. The changes in said files in libkazv compared to libQuotient's are:
avoidCopy
and moveOnly
markersimmer
and std
instead of Qtnlohmann::json
instead of Qt's JSON libraryCopyright (C) 2020-2024 the Kazv Project https://kazv.chat
libkazv is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
libkazv is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with libkazv. If not, see https://www.gnu.org/licenses/.