Skip to main content

ds-service: Yet Another Data Structure Server

Futuristic banner image.

ds-service is a small, in-memory data structure server that is accessible via gRPC.

ds-service runs a single server process that holds shared state in memory and lets many distributed clients and workers coordinate using it. Use it when several processes -- on one machine or across a cluster -- need to hand work to each other, share intermediate results, take turns on a resource, or agree on a number, and the state only has to live as long as the run does.

Presently, it provides six data structures:

  • A key-value store -- a shared string -> bytes store for passing data between processes.
  • A task queue -- a priority-based work queue that distributes tasks to workers and tracks their state.
  • A journal store -- append-only, ordered logs of binary entries.
  • A time series store -- append-only series of timestamped floating-point values.
  • Named mutexes -- worker-owned locks for coordinating exclusive resource access across workers.
  • Counters -- named monotonic counters that hand out successive integers.

Each of these is a separate key space with its own set of RPCs.

Installation

The server is a single statically linked binary. Grab the latest release, make it executable, and put it somewhere on your PATH:

curl -sSL -o ds-service \
    https://github.com/parantapa/ds-service/releases/latest/download/ds-service
chmod +x ds-service

It is linked against musl with no dynamic dependencies, so it runs on any x86-64 Linux host.

The Python client comes from PyPI:

pip install ds-service-client

To build the server from source instead, see how to build the server.

Usage

Start a server:

ds-service --address 127.0.0.1:5051

Then, from any process that can reach it:

from ds_service_client import DsServiceClient

with DsServiceClient("127.0.0.1:5051") as client:
    client.map_set("greeting", b"hello")
    assert client.map_get("greeting") == b"hello"

    client.task_add("job-1", queue="work", priority=1.0, function=b"greet", input=b"world")

    task = client.task_get(worker_id="worker-a", queue="work")
    client.task_done(task.task_id, worker_id="worker-a", output=b"hello world")

    assert client.task_get_output("job-1") == b"hello world"

Documentation

Document What it covers
Tutorial: run your first tasks Start a server, store a value, and take a task from Ready to Complete. Start here.
How to build the server Requirements, the Conan + CMake build, installing, running, and the static musl build.
How to write a worker The claim-work-report loop, mutexes around shared resources, progress reporting, and the asyncio variant.
How to run the tests The pytest integration suite and pointing it at the binary.
Data structure reference Every RPC, its arguments and error statuses, and the exact semantics of each data structure.
Python client reference DsServiceClient and DsServiceClientAsync: constructors, method names, the gRPC-status-to-exception mapping, and examples.
Server helper reference DsServiceServer, which runs a private ds-service process for the life of the object.
About the architecture The three pieces, why state is not persisted, one lock per structure, and why there are two Python clients.
About the task queue Task ownership, what cancelling does and does not do, and why there is no fault tolerance.
About the static musl build Why the static image exists and why its Conan profile differs.
Developer notes Working on ds-service itself: the source map, the generated code workflow, the test harness, conventions, versioning, and known limitations.

License

MIT. See LICENSE.

Download files

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

Source Distribution

ds_service_client-5.1.0.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

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

ds_service_client-5.1.0-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file ds_service_client-5.1.0.tar.gz.

File metadata

  • Download URL: ds_service_client-5.1.0.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.15

File hashes

Hashes for ds_service_client-5.1.0.tar.gz
Algorithm Hash digest
SHA256 16cb3431bff315e183e3dc3132d3707244d731a8f9dc435119aa4a880917cc16
MD5 935ac3b35d2aa969dc1e2c325bf8a1ab
BLAKE2b-256 af64481c605009a66257b62310838aec64f84130e94c4c882bdab6af920d6abb

See more details on using hashes here.

File details

Details for the file ds_service_client-5.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ds_service_client-5.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 05a13bc56cb3a3ad1e171b757be7ad106d68c431e9f5a393536dc590e959e106
MD5 4da8031d37a212d4c99f677cfdad664c
BLAKE2b-256 120bc6af93661c4242eed863ef0e56355b6a47ad651fefc90004801e103eeb1f

See more details on using hashes here.

Release history Release notifications | RSS feed

5.2.0

2 files

This release

5.1.0 This release

2 files

5.0.0

2 files

4.1.0

2 files

4.0.0

2 files

3.0.0

2 files

2.2.0

2 files

2.1.0

2 files

2.0.0

2 files

1.0.4

2 files

1.0.2

2 files

1.0.1

2 files

0.4.1

2 files

0.2.1

2 files

0.2.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page