Files
jeb-utils/README.md
T
jakob.scheid 72de06e531 geändert: README.md
geändert:       pyproject.toml
	geändert:       src/jeb_utils/jeb_utils.py
2026-02-19 17:21:17 +01:00

90 lines
3.7 KiB
Markdown

# jeb Utils
Common utils for JEB client and server.
## Installation
You can install the library using `pip`:
```bash
pip install jeb-utils --index-url https://jcloud-services.ddns.net/simple/ --extra-index-url https://pypi.org/simple/
```
## Functions and classes
### `auth_utils`: Utilities for the jeb authentication
- `load_cert_file`: Loads a certificate from a file
- `Identity`: An identity, based on a certificate
- `Verifier`: A verifier for the CA of an identity.
### `crypto_utils`: Utilities for cryptography
- `generate_keypair`: Generates a private and a public key
- `serialize_public_key`: Serializes a public key to bytes.
- `deserialize_public_key`: Deserializes a public key from bytes.
- `derive_aes_key`: Derives an AES key from a private key and the peer public key.
### `exceptions`: Common exceptions of the jeb library and server
- `UnknownProtocolError`: The protocol is unknown.
- `ProtocolSyntaxError`: The syntax is not valid for the protocol.
- `CRCInvalidError`: The CRC is invalid.
- `UnknownCreationError`: Unknown error creating an object.
- `UnknownSubscribingError`: Unknown error subscribing topics.
- `UnknownUnsubscribingError`: Unknown error unsubscribing topics.
- `TopicNotFoundError`: The topic was not found.
- `TopicExistsError`: The topic already exists.
- `TopicPartitionExistsError`: The partition of the topic already exists.
- `TopicPartitionNotFoundError`: The partition of the topic was not found.
- `TopicNotSubscribedError`: The topic is not subscribed.
- `InvalidTopicNameError`: The topic name is invalid.
- `FetchStartOutOfRangeError`: The fetch start is out of range.
- `FormatError`: The format is invalid.
- `CertificateNotTrustedError`: The certificate is not trusted.
### `jeb_utils`: Functions for jeb actions
- `format_topic_partitions`: Formats the topic partitions.
- `mktopic`: Creates a topic.
- `rmtopic`: Removes a topic.
- `mktopicpart`: Creates a partition of a topic.
- `rmtopicpart`: Removes a partition of a topic.
- `get_topics`: Returns all topics.
- `get_segment_base_timestamp`: Returns the base timestamp of a segment.
- `get_log_end_offsets`: Gets the end offsets.
- `init`: Initializes the module.
- `validate_topic_partition`: Validates a topic partition number format.
- `validate_topic_name`: Validates a topic name.
- `check_topic_exists`: Checks whether a topic exists.
- `pack_record_headers`: Packs the record header dictionary into bytes.
- `unpack_record_headers`: Unpacks the record headers from bytes.
- `create_record`: Creates a record.
- `fetch_records`: Fetches records from the topic.
- `Topic`: A topic.
- `Segment`: A segment of a topic.
- `FileCorruptWarning`: A warning for corrupt log files.
- `AttributesByte`: An attributes byte of a record.
### `jebp_utils`: Utilities for the jeb protocol
- `MessageFormatError`: If the message format is invalid.
- `sendmsg`: Sends a message.
- `readmsg`: Receives a message.
- `pack_fields`: Packs the fields into a compact bytestring.
- `unpack_fields`: Unpacks the field from a bytestring.
### `utils`: General utilities
- `is_number`: Checks whether the string is a number.
- `int_to_bytes`: Converts the integer into bytes (dynamic length).
- `bits_to_byte`: Converts the bits into a single byte.
- `byte_to_bits`: Converts the byte to a tuple of bits.
- `get_next_lower_integer_multiple`: Returns the next lower integer multiple.
- `find_nearest_lower_number`: Finds the nearest lower number to the target from the list.
- `create_file_if_not_exists`: Creates a file if it does not exist.
## Changelog
### Version 0.1.1
- Support for custom data paths (`jeb_utils.init`)
### Version 0.1.0
- First release
- `auth_utils`
- `crypto_utils`
- `exceptions`
- `jeb_utils`
- `jebp_utils`
- `utils`