Lulalib
Lulalib is a simple, yet extendable caching and task scheduling micro framework.
Documentation
In this section, abstract and non-abstract key components are presented.
Abstract key components
lulalib.abc features abstract bases (Interfaces) for every significant component of the application
IStorage[KT, VT]is an abstract base for the storage component..get(k: KT) -> VT | Noneor.get(k: KT, *, strict = True) -> VT- Retrieve the value from the storage.
- When
strictis used and there is not value matched the key,KeyErroris raised;
.set(k: KT, v: KT) -> None- Set the value to the key;
.contains(k: KT) -> bool- Check if there is any value matching the key;
.delete(k: KT) -> None- Delete the value matching the key.
- Implementation notes
- The original implementation is using
lmdbengine (lulalib.storage.LMDBStorage); - Scheduler component is using
SchedulerLMDBStorageTTL storage with custom type adapters applied.
- The original implementation is using
ITypeAdapter[T]enables serlialization and deserialzation of custom types on the go with no effort..serialize(v: T) -> bytes- Get the binary format repsenetation of the custom type value
.deserialize(v: bytes) -> T- Construct the custom type from the binary data
- Implementation notes
dict(viamessagepack),bytes,UUIDandTaskResultare supported out of the box.
Traits
lulalib.traits features traits/mixins for the compoentents, preserving their functioning and original purpose.
SupportsKVTypeAdapters[KT, VT]is designed to be used by a storage. This traits enables usage of two type adapters both for key and value respectively..serialize_key(data: KT) -> bytes.deserialize_key(data: bytes) -> KT.serialize_value(data: VT) -> bytes.deserialize_value(data: bytes) -> VT
Models
All models are presented in lulalib.models
TaskResult[T]represents a task result in the database.-
Representation
- Header in binary struct format:
>QQQIdb - Header in C laguage:
typedef struct TaskResult { unsigned long long idl; unsigned long long idh; unsigned long long type_id; unsigned int sz; double exp_at; char state; }
- Header in binary struct format:
-
Constructors
TaskResult.from_buffer(observer: TaskResultObserver, buf: Buffer) -> TaskResult- Construct a new object from readable buffer
-
Properties
.hdr -> bytes- Get object's binary header
.state -> int- Procedure state
.result -> T- Get object's result value if available
-
Methods
.__bytes__() -> bytes- Get object's binary representation like
obj_b = bytes(obj)
- Get object's binary representation like
.__await__() -> Tawaiton object to get the task result as soon as available likeresult = await obj
.notify() -> None- Should always be invoked by an observer.
-
Observers
All observers are presented in lulalib.observers
TaskResultObserveris observingTaskResult(following: object).- Responsibility
- Managing (CRUD operations) related to the object, features internal object pool;
- Events emission during object management.
.set_state(result: TaskResult) -> None- Update the object state and emit the event
.set_result(result: TaskResult) -> None- Update the object result (value returned from the procedure exection)
.set_callback(fut: asyncio.Future[Any], result: TaskResult[Any]) -> None- Modify object's state and result value upon procedure finalization.
.get_task_result(task_id: uuid.UUID, exp_at: float, _typ_ad: int) -> TaskResult[Any]- Either retrieve object from the pool or create a new instance
.task_result_from_buffer(buf: Buffer,raise_on_done=True) -> TaskResult[Any]- Either retrieve object from the pool or construct a new instance from buffer
- Responsibility
Metadata
Release files for lulalib 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lulalib-0.1.0.tar.gz | 24.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lulalib-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.5 kB
Release files / lulalib-0.1.0.tar.gz
| Download URL | lulalib-0.1.0.tar.gz |
|---|---|
| Size | 24.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
460a9cd3e0187b175f6415346c9790b0dc15e7db22fcbd73e77f2a2f6d288033
|
|
BLAKE2b-256 checksum How to use checksums |
eaff64b590626a8c549487c0ac392217adc268c19ed03fc768201380926b1c31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.13.2 Darwin/24.2.0
|
Release files / lulalib-0.1.0-py3-none-any.whl
| Download URL | lulalib-0.1.0-py3-none-any.whl |
|---|---|
| Size | 33.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
09c506b015dbba12c7515727703202996bf913bc92e02598ff46cdbac31272a9
|
|
BLAKE2b-256 checksum How to use checksums |
9e9f1ebbcd0d1622b543c05e92baed6879125c481f68bb815fbc5c5d87f5a38a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.13.2 Darwin/24.2.0
|
Security for lulalib 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.