Skip to main content

Package for embedded storage systems

Project description

coopstorage

A Python library for embedded storage tracking — models physical storage locations, containers, and the channel-processor rules that govern how items flow in and out of each slot.


Overview

coopstorage provides:

  • Locations — physical storage slots with configurable capacity, dimensions, and channel-processor type
  • Containers — items stored at locations, each with a UoM, optional contents, and resource qualifiers
  • Channel processors — pluggable rules that control which slots are addable/removable (FIFO, LIFO, OMNI, NoFlow, push variants, etc.)
  • Transfer requests — declarative add/move/remove operations resolved against qualifier criteria
  • Location qualifiers — filter locations by capacity, dimensions, UoM, resource type, occupied state, channel accessibility, and more
  • Live visualizer — browser-based isometric/top-down view with real-time SSE updates, slot overlays, UOM icons, and a legend

Channel Processor Types

Type Add Remove Flow
AllAvailableChannelProcessor any empty slot any occupied slot none
AllAvailableFlowChannelProcessor any empty slot any occupied slot forward
AllAvailableFlowBackwardChannelProcessor any empty slot any occupied slot backward
FIFOFlowChannelProcessor back of queue front (oldest) forward
FIFOFlowBackwardChannelProcessor front (push) front (oldest) backward
FIFONoFlowChannelProcessor deepest open slot deepest occupied (oldest) none
FIFONoFlowPushChannelProcessor slot 0 (push) deepest occupied (oldest) none
LIFOFlowChannelProcessor back of queue front (newest) forward
LIFOFlowBackwardChannelProcessor front (push) front (newest) backward
LIFONoFlowChannelProcessor deepest open slot shallowest occupied (newest) none
LIFONoFlowPushChannelProcessor slot 0 (push) shallowest occupied (newest) none
OMNIChannelProcessor adjacent to pack (either end) either end none
OMNIFlowChannelProcessor adjacent to pack (either end) either end forward
OMNIFlowBackwardChannelProcessor adjacent to pack (either end) either end backward

Quick Start

from coopstorage.storage.loc_load.storage import Storage
from coopstorage.storage.loc_load.location import Location
import coopstorage.storage.loc_load.dcs as dcs
import coopstorage.storage.loc_load.channel_processors as cps
from coopstorage.storage.loc_load.qualifiers import LocationQualifier
from coopstorage.storage.loc_load.transferRequest import TransferRequestCriteria

# Build storage with two locations
loc_a = Location(
    id='A',
    location_meta=dcs.LocationMeta(
        dims=(10, 10, 5),
        channel_processor=cps.FIFOFlowChannelProcessor(),
        capacity=5,
    ),
    coords=(0, 0, 0),
)
loc_b = Location(
    id='B',
    location_meta=dcs.LocationMeta(
        dims=(10, 10, 5),
        channel_processor=cps.LIFOFlowBackwardChannelProcessor(),
        capacity=5,
    ),
    coords=(15, 0, 0),
)

storage = Storage(locs=[loc_a, loc_b])

# Add a container to the first available location
storage.handle_transfer_requests([
    TransferRequestCriteria(
        new_container=dcs.Container(id='C001'),
        dest_loc_query_args=LocationQualifier(at_least_capacity=1, has_addable_position=True),
    )
])

Location Qualifiers

LocationQualifier filters candidate locations during transfer resolution:

from coopstorage.storage.loc_load.qualifiers import LocationQualifier, ContainerQualifier
from cooptools.qualifiers import PatternMatchQualifier, WhiteBlackListQualifier

# Destination: must have capacity, an accessible drop slot, and accept the container's UoM
LocationQualifier(
    at_least_capacity=1,
    has_addable_position=True,
)

# Source: must contain a container matching a pattern
LocationQualifier(
    has_all_containers=[ContainerQualifier(pattern=PatternMatchQualifier(regex='^C00'))]
)

Key parameters:

Parameter Description
at_least_capacity Minimum number of free slots
has_addable_position Channel processor has an accessible drop position
is_occupied True/False filter on whether any container is present
has_any_containers At least one container satisfies any of the given qualifiers
has_all_containers For each qualifier, at least one container satisfies it
has_content Total qty of a resource/UoM across all containers meets a minimum
uom_qualifier / ignore_uom_qualifier Container UoM must be allowed by location's whitelist
resource_type_qualifier / ignore_resource_type_qualifier Container resource types must be allowed
min_slot_dims All slot dimensions must be >= this
reserved Filter on reservation state

Visualizer

Start a live browser visualizer alongside a benchmark or simulation:

# Showcase: one of each channel processor type, lock-step add/remove
python run_viz_benchmark.py --mode showcase

# Continuous randomized simulation
python run_viz_benchmark.py --mode sim --config small

# Fixed benchmark workload
python run_viz_benchmark.py --mode benchmark --config medium

# Options
python run_viz_benchmark.py --delay 0.05 --log-level DEBUG --port 1219

The visualizer is served at http://localhost:1219/static/index.html.

Slot overlays:

Color Meaning
Green fill Occupied
Grey fill Available
Blue outline Droppable (addable position)
Purple outline Retrievable (removable position)

Each container label shows a unique icon per UoM type with a live legend.


Running Tests

python -m pytest tests/ -v

License

MIT

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

coopstorage-1.1.tar.gz (61.8 kB view details)

Uploaded Source

Built Distribution

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

coopstorage-1.1-py3-none-any.whl (54.8 kB view details)

Uploaded Python 3

File details

Details for the file coopstorage-1.1.tar.gz.

File metadata

  • Download URL: coopstorage-1.1.tar.gz
  • Upload date:
  • Size: 61.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for coopstorage-1.1.tar.gz
Algorithm Hash digest
SHA256 9baf8818fb86df788a7a245bc7c85165030f157b5f314fb587f8e9e0bbb49b17
MD5 3aa3529cc454e5fe775ccd96120e43dd
BLAKE2b-256 209bb78f9097743654b0b11c3314bdef39d1b692d7aca7cafcf2ad981730cbfb

See more details on using hashes here.

File details

Details for the file coopstorage-1.1-py3-none-any.whl.

File metadata

  • Download URL: coopstorage-1.1-py3-none-any.whl
  • Upload date:
  • Size: 54.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for coopstorage-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 723e039f4d4dc97a79dc7c2e6590058bcca27483d9cab52badbdc69e9a6b7ec5
MD5 4f0dc91f2369778e5a33ae2904ed4e2e
BLAKE2b-256 e5ed854b3a20d9e8f571ca3610531e1d76e1722a688eb04ccd2255b326e582c6

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