Skip to main content

A lightweight, distributed, relational network architecture for MPC.

Project description

Mesh Python Client

Build Status Financial Contributors on Open Collective codecov license

中文版 README

Introduction

Mesh is a standard implementation for Private Transmission Protocol specification.

Mesh Python develop kits base on Python3.6. Recommend use poetry to manage dependencies.

Features

As an open source Internet of Data infrastructure develop kits, Mesh has the following core functions:

  • Minimal kernel with SPI plugin architecture, everything is replacement.
  • Support full stack of service mesh architecture.
  • Support full stack of service oriented architecture.
  • Support transport with TCP, HTTP, or other RPC protocols.
  • Support rich routing features.
  • Support reliable upstream management and load balancing capabilities.
  • Support network and protocol layer observability.
  • Support mTLS and protocols on TLS.
  • Support rich extension mechanism to provide highly customizable expansion capabilities.
  • Support process smooth upgrade.

Get Started

poetry add imesh

or

pip install imesh

RPC

Declared rpc interface Facade.

from abc import ABC, abstractmethod

from mesh import spi, mpi


@spi("mesh")
class Tokenizer(ABC):

    @abstractmethod
    @mpi("mesh.trust.apply")
    def apply(self, kind: str, duration: int) -> str:
        """
        Apply a node token.
        :param kind:
        :param duration:
        :return:
        """
        pass

    @abstractmethod
    @mpi("mesh.trust.verify")
    def verify(self, token: str) -> bool:
        """
        Verify some token verifiable.
        :param token:
        :return:
        """
        pass

Declared rpc service Implement.

from mesh import mps, Tokenizer


@mps
class MeshTokenizer(Tokenizer):

    def apply(self, kind: str, duration: int) -> str:
        return "foo"

    def verify(self, token: str) -> bool:
        return True

Remote reference procedure call.

from mesh import mpi, Tokenizer


class Component:

    @mpi
    def tokenizer(self) -> Tokenizer:
        pass

    def invoke(self) -> bool:
        token = self.tokenizer().apply('PERMIT', 1000 * 60 * 5)
        return self.tokenizer().verify(token)

Transport

Transport is a full duplex communication stream implement.

import mesh
from mesh import Mesh, log, ServiceLoader, Transport, Routable
from mesh.prsim import Metadata


def main():
    mesh.start()

    transport = Routable.of(ServiceLoader.load(Transport).get("mesh"))
    session = transport.with_address("10.99.1.33:570").local().open('session_id_008', {
        Metadata.MESH_VERSION.key(): '',
        Metadata.MESH_TECH_PROVIDER_CODE.key(): 'LX',
        Metadata.MESH_TRACE_ID.key(): Mesh.context().get_trace_id(),
        Metadata.MESH_TOKEN.key(): 'x',
        Metadata.MESH_SESSION_ID.key(): 'session_id_008',
        Metadata.MESH_TARGET_INST_ID.key(): 'JG0100000100000000',
    })
    for index in range(100):
        inbound = f"节点4发送给节点5报文{index}"
        log.info(f"节点4发送:{inbound}")
        session.push(inbound.encode('utf-8'), {}, "topic")
        outbound = session.pop(10000, "topic")
        if outbound:
            log.info(f"节点4接收:{outbound.decode('utf-8')}")

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

imesh-0.0.29.11.tar.gz (107.1 kB view details)

Uploaded Source

Built Distribution

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

imesh-0.0.29.11-py3-none-any.whl (186.0 kB view details)

Uploaded Python 3

File details

Details for the file imesh-0.0.29.11.tar.gz.

File metadata

  • Download URL: imesh-0.0.29.11.tar.gz
  • Upload date:
  • Size: 107.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.3 Darwin/25.1.0

File hashes

Hashes for imesh-0.0.29.11.tar.gz
Algorithm Hash digest
SHA256 4a6f9400b356481296a904da787810f0f5f18a7ce433aca6f3e2077d4d34164d
MD5 eaec1a75a8a5d08eaf3798ae34bf414a
BLAKE2b-256 6c0e25723e838c3aacced5d380e66c2a09ccad8a7069814d4abbfb9e66b8377e

See more details on using hashes here.

File details

Details for the file imesh-0.0.29.11-py3-none-any.whl.

File metadata

  • Download URL: imesh-0.0.29.11-py3-none-any.whl
  • Upload date:
  • Size: 186.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.3 Darwin/25.1.0

File hashes

Hashes for imesh-0.0.29.11-py3-none-any.whl
Algorithm Hash digest
SHA256 3de435a1c53a70288ddca6ac3471035cb43627f74490d8e113b551493b9eedaa
MD5 0a9efbcfcce471f3d73d3a812fc3359e
BLAKE2b-256 d236359f8506ec9c2da4db97a1bf004acf819fb25d0466ebcac4a8d2f264506e

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