Skip to main content

Stream infrastructure for MoaT applications

Project description

Stream Infrastructure

% start synopsis % start main

This module provides base classes for handling data streams in a structured manner.

% end synopsis

Overview

This package implements infrastructure for building layered communication stacks:

  • BaseMsg - Message-based communication (Python objects)
  • BaseBlk - Block-based communication (delimited bytestrings)
  • BaseBuf - Buffer-based communication (undelimited bytestreams)

Layered Communication Stacks

Build communication stacks by layering protocols:

from moat.lib.stream import StackedBlk

class Compression(StackedBlk):
    async def snd(self, blk):
        compressed = compress(blk)
        await self.s.send(compressed)

    async def rcv(self):
        blk = await self.s.recv()
        return decompress(blk)

# Stack layers
link = SerialLink(cfg)  # BaseBuf
link = Packetizer(link, cfg)  # StackedBlk
link = Compressor(link, cfg)  # StackedBlk
link = Codec(link, cfg)  # StackedMsg
async with link:
    await link.send({"data": "hello"})

% end main

License

This project is part of the MoaT ecosystem and is licensed under the same terms.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moat_lib_stream-0.3.2.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moat_lib_stream-0.3.2-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file moat_lib_stream-0.3.2.tar.gz.

File metadata

  • Download URL: moat_lib_stream-0.3.2.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for moat_lib_stream-0.3.2.tar.gz
Algorithm Hash digest
SHA256 880740247ef99e20e61388d86ac0343c251572b8e15ee52a39abfb6c71e559b7
MD5 c3b2726d4da51d84f1599768c1357051
BLAKE2b-256 f5dc8531f9ef29a715b429e0d780d1d69fcef8a79280a6827cde3bb6b1e457c8

See more details on using hashes here.

File details

Details for the file moat_lib_stream-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for moat_lib_stream-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 251d15a5b5d21b9282ca0b29df5c67eebc0ce25f96619e6c57d984b62880ae83
MD5 3aecefa5b9789ae348d9006fa8db6a46
BLAKE2b-256 9ea6dc153b9242d8d7e358f28da62528ef0f197ddfdf5a3636fe1a2c640fe03c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page