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.1.2.tar.gz (18.8 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.1.2-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: moat_lib_stream-0.1.2.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for moat_lib_stream-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2eae85cc906f6e0e1fcd4f460334bf870be04a589e086bc1586da84f44d4e48a
MD5 94cbb0903a10f310ed26b3462161e7f1
BLAKE2b-256 152679ff38054656a423cbeff071d20549ffb85d240820c52b9e297f48105bca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for moat_lib_stream-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d427822d171bb0335a85330875568e02f2e89e4814f914c9f2c5d11be116207b
MD5 f69dd1d54afc04a682ab90720ed1693a
BLAKE2b-256 390532b7cf9625d4c9a57a5aec911d98e21b05a32b9fa4081c332d7d529cf750

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