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 lenght 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.11.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.11-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: comram-0.0.11.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.11.tar.gz
Algorithm Hash digest
SHA256 5d7d0417e93950206307b005412abcbf8ad8c19d98fc2d650e6da3aa0f822b2f
MD5 28e211589ad0bae9a4ac77d77c2d2b55
BLAKE2b-256 041f07650338eb823abb3318feab7141c6b19bca148cf83c3309afc293a4c87d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: comram-0.0.11-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.11-py3-none-any.whl
Algorithm Hash digest
SHA256 715175ac55a24c9698c64bb048a16bc8beb13469d5a6007ff4e2ea46056f001d
MD5 00fd70a30f56cc0d34142c6cc8dbe8c3
BLAKE2b-256 7b1f6b10e7a6fa68bc39a2fdb9d13925ab3f615697c611bffee22ad79b4d5784

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