Transfer Mediums

class softs.ShmMedium[source]
__init__(address, slot_size, num_slots, create=False, **kwargs)[source]
write(slot_id, data)[source]

Write data at byte offset. Returns False if resource is gone.

Parameters:
Return type:

bool

read(slot_id)[source]
Parameters:

slot_id (int)

Return type:

bytes

classmethod attach(address)[source]
Parameters:

address (str)

Return type:

ShmMedium

close()[source]
Return type:

None

Remove underlying resource (shm segment, file, etc.).

Return type:

None

class softs.FilesystemMedium[source]

buf_name is the file path.

__init__(address, slot_size, num_slots, create=False, **kwargs)[source]
write(slot_index, data)[source]

Write data at byte offset. Returns False if resource is gone.

Parameters:
Return type:

bool

read(slot_index)[source]
Parameters:

slot_index (int)

Return type:

bytes

close()[source]
Return type:

None

classmethod attach(address)[source]
Parameters:

address (str)

Return type:

FilesystemMedium

Remove underlying resource (shm segment, file, etc.).

Return type:

None

class softs.TCPMedium[source]

Transfer medium backed by a TCP server.

The owner (client) binds a server socket; its address is "host:port". Writers (suppliers) attach(address) and stream (offset, data) frames to the owner, which stores them in its buffer. The owner reads slots from that buffer.

__init__(address, slot_size, num_slots, create=False, host='127.0.0.1', **kwargs)[source]
Parameters:

host (str)

write(slot_offset, data)[source]

Write data at byte offset. Returns False if resource is gone.

Parameters:
Return type:

bool

read(slot_id)[source]
Parameters:

slot_id (int)

Return type:

bytes

classmethod attach(address)[source]
Parameters:

address (str)

Return type:

TCPMedium

close()[source]
Return type:

None