Skip to main content

shared ram based data distribution lib

Project description

README

Project Scope:

ramshare:

Create data structures in shared memory based on a data structure file. Read and write to data structure tag. Data structure tags can be accessed system-wide.

procon:

producer:

Creates a socket server and either connect or create shared data structure. Consumers can connect to producer, and all data from data structure will be transferred to connected consumers periodic.

consumer:

Connects to producer, either creates or connects to shared data structure. Shared data structure will be overwritten periodic, so shared data structure is read only on consumer site.

dmsg

Direct event based messages between producer and consumers. Messages will be serialized with pickle before send, and de-serialized with pickle before message is returned.

Data structure .xml file:

<config>
    <connection_status LENGTH="2" TYPE="int" INIT_VALUE="0" DESCRIPTION="connection of status" > </connection_status>
    <tag_1 LENGTH="10" TYPE="int" > </tag_1>
    <timestamp LENGTH="20" TYPE="float" > </timestamp>
    <status LENGTH="100" TYPE="string" ></status>
</config>

Required tags:

For produced / consumed data structures, "connection_status" is required.

Required members:

tag_1 = reference name, used to read or write from data structure.

LENGTH = tag length in bytes, minimum value is 2

Optional members

TYPE = tag type, INIT_VALUE = initial tag value

DESCRIPTION = description of tag

Usage:

Write to tag:

from comram import ramshare

test = ramshare.RamShare("share_name", data_type="/path_to_structure/test_structure.xml")
test.write_to_tag("tag_1", 99)

Read from tag:

from comram import ramshare

test = ramshare.RamShare("share_name", data_type="/path_to_structure/test_structure.xml")
tag_1 = test.read_tag("tag_1")

Produce data structure:

from comram import procon

producer = procon.Produce("share_name", data_type="/path_to_structure/test_structure.xml", ip="127.0.0.1", port=9980, 
                          send_interval=0.01)
producer.start_produce()

Consume data structure:

from comram import procon

consumer = procon.Consume("share_name", "consumer_name", data_type="/path_to_structure/test_structure.xml",
                          ip="127.0.0.1", port=9980)
consumer.start_consume()

dmsg usage:

produce:
from comram import dmsg

test_producer = dmsg.Produce("127.0.0.1", 9500, debug=True)
test_producer.send_message("test message")
test_producer.close()

consume:

from comram import dmsg

test_consume = dmsg.Consume("test_consumer", "127.0.0.1", 9500)
test_msg = test_consume.get_msg()
test_consume.close()

Known issues

tag length under under 2 byte not possible

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

comram-0.0.12.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

comram-0.0.12-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file comram-0.0.12.tar.gz.

File metadata

  • Download URL: comram-0.0.12.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.9

File hashes

Hashes for comram-0.0.12.tar.gz
Algorithm Hash digest
SHA256 e3ef61da209aeed562bf50c25467c6e35034007a2d1d766c3b2c80ace2e80cda
MD5 edbd91f40616697466ec733aa7262330
BLAKE2b-256 fd63f961f011c18f9c2a3a73eb374bf786f2370af365bdaab3512479ab6922f2

See more details on using hashes here.

File details

Details for the file comram-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: comram-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.9

File hashes

Hashes for comram-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 f454620a1747ab0179ecd5e021ebd2868bcd1e95bfa6bd63cc283b10118121f6
MD5 f918dccf4d953048260c2a7b853056b2
BLAKE2b-256 edaee6352d08fd6146d2d65ee893c5e74e39b95a184c357f0b91bd0260307d7c

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