An opinionated Rust library for interacting with AWS DynamoDB single-table designs.

Overview

Modyne

An opinionated library for interacting with AWS DynamoDB single-table designs.

docs.rs crates.io MIT/Apache-2.0 dual licensed modyne: rustc 1.70+

Motive

Modyne follows the precepts laid out for effective single-table design when working with DynamoDB, as laid out in The DynamoDB Book by Alex DeBrie and the DynamoDB Guide companion website. Such designs take advantage of the fact that certain access patterns fit very well with the relatively simple architecture of AWS DynamoDB, wherein a partition contains all the items for a given partition key within a BTree structure, sorted by a sort key.

Because of this architecture, DynamoDB rewards accessing ranges of items within a single partition through the Query operation. Additional access patterns may be enabled through global secondary indexes, and sparse indexes can be used to enable efficient Scan operations.

Leveraging single-table design, multiple different entity types can be mixed into a single DynamoDB table, and multiple entity types may cohabitate within an individual partition. Often the raw attributes of an item are not used as the keys. Instead, synthetic keys are generated from those raw attributes to support the efficient use of partitions and indexes in Query and Scan operations.

Concept

In modyne, the consumer of the crate will define their various entities in code, providing implementations for Serde serialization and deserialization, as well as providing an implementation for the Entity trait. This trait is the core of modyne. It defines the name of the entity, what attributes matter to the entity, and how the primary and any secondary index keys are generated for the entity.

The next big concepts in this crate are the QueryInput and the ProjectionSet. The query input makes it simple to define the key expression, filter expressions, and the set of attributes required by the set of projections to be read from the query. A dual to QueryInput exists for Scan operations: ScanInput.

Beyond these concepts, modyne provides higher-level fluent interfaces for interacting with these DynamoDB entities that help guide usage toward the pit of success and away from unintentional errors. The crate also provides fluent interfaces for performing bulk and transactional read and write operations as are sometimes required when keeping denormalized data in sync with a single-table design.

For a more complete tour of the functionality in this crate, see the documentation on docs.rs.

Usage notes

While modyne is available and ready for general use, you should be aware of a few usage notes before you commit to this crate.

Undocumented field usage

This library relies on the undocumented ability to directly access the item field on response objects returned by the DynamoDB API. It does this because the deserializer in serde_dynamo requires ownership of the items map. Without directly accessing the field, every attempt to deserialize would require cloning the entire items map every time, which would be undesirable and cause significant performance overhead. In the event that this field becomes unavailable, we may need to fall back to this less-performant mechanism.

Binding to latest AWS SDK

As of now, this library will only bind itself to the latest version of the AWS DynamoDB SDK. This may be updated in the future to use feature flags to allow targeting multiple different SDK versions, but as this crate gets going we will only target a single version of the AWS SDK, most often the latest version.

An update to the AWS SDK that does not break modyne's usage of the AWS SDK will only result in a minor version bump. If the AWS SDK exposes an observable breaking change to modyne, then a major version bump will be used. Prior to 1.0, those bumps will be to the patch and minor version components, respectively.


†: The MSRV for this crate can be lowered to 1.66.1 by enabling the once_cell feature.

You might also like...
Utilities for interacting with the Behringer X-Touch Mini MIDI controller

xtouchmini Collection of utilities for interacting with the Behringer X-Touch Mini MIDI controller, including reading button/knob/fader inputs and sen

Rust client for AWS Infinidash service.
Rust client for AWS Infinidash service.

AWS Infinidash - Fully featured Rust client Fully featured AWS Infinidash client for Rust applications. You can use the AWS Infinidash client to make

Rusoto is an AWS SDK for Rust
Rusoto is an AWS SDK for Rust

Rusoto is an AWS SDK for Rust You may be looking for: An overview of Rusoto AWS services supported by Rusoto API documentation Getting help with Rusot

Cookiecutter templates for Serverless applications using AWS SAM and the Rust programming language.

Cookiecutter SAM template for Lambda functions in Rust This is a Cookiecutter template to create a serverless application based on the Serverless Appl

📦 🚀 a smooth-talking smuggler of Rust HTTP functions into AWS lambda
📦 🚀 a smooth-talking smuggler of Rust HTTP functions into AWS lambda

lando 🚧 maintenance mode ahead 🚧 As of this announcement AWS not officialy supports Rust through this project. As mentioned below this projects goal

Ref Arch: Serverless GraphQL in Rust on AWS
Ref Arch: Serverless GraphQL in Rust on AWS

A Whole Hog Reference Architecture for an Apollo Federation-Ready, Serverless, Rust-Based GraphQL Microservice on AWS using Cloud Development Kit (CDK)

A Rust runtime for AWS Lambda

Rust Runtime for AWS Lambda This package makes it easy to run AWS Lambda Functions written in Rust. This workspace includes multiple crates: lambda-ru

Remote Secret Editor for AWS Secret Manager

Barberousse - Remote Secrets Editor About Usage Options Printing Editing Copying RoadMap 1.0 1.1 Future About A project aimed to avoid downloading sec

Easy switch between AWS Profiles and Regions
Easy switch between AWS Profiles and Regions

AWSP - CLI To Manage your AWS Profiles! AWSP provides an interactive terminal to interact with your AWS Profiles. The aim of this project is to make i

Owner
Marcus Griep
Marcus Griep
Aws-sdk-rust - AWS SDK for the Rust Programming Language

The AWS SDK for Rust This repo contains the new AWS SDK for Rust (the SDK) and its public roadmap. Please Note: The SDK is currently released as a dev

Amazon Web Services - Labs 2k Jan 3, 2023
Rs.aws-login - A command line utility to simplify logging into AWS services.

aws-login A command line utility to simplify logging into AWS accounts and services. $ aws-login use ? Please select a profile to use: › ❯ dev-read

Kevin Herrera 11 Oct 30, 2022
Serverless setup for activity pub (using lambda+dynamodb) in Rust

Serverless ActivityPub About This is an experiment to have free/cheaper activitypub instances running on AWS (making use of free tiers as much as poss

Conrad Ludgate 3 Dec 30, 2022
A lambda extension to hot reload parameters from SSM Parameter Store, Secrets Manager, DynamoDB, AppConfig

A lambda extension to hot reload parameters from SSM Parameter Store, Secrets Manager, DynamoDB, AppConfig

Jake Scott 7 Jun 12, 2022
A simple string interner / symbol table for Rust projects.

Symbol Interner A small Rust crate that provides a naïve string interner. Consult the documentation to learn about the types that are exposed. Install

Ryan Chandler 1 Nov 18, 2021
Rust libraries for working with GPT (GUID Partition Table) disk data

gpt-disk-rs no_std libraries related to GPT (GUID Partition Table) disk data. There are three Rust packages in this repository: uguid The uguid packag

Google 25 Dec 24, 2022
Rust library for interacting with the VTube Studio API

vtubestudio-rs A library for interacting with the VTube Studio API. Basic usage This example creates a Client using the provided builder, which: conne

null 6 Dec 4, 2022
Membrane is an opinionated crate that generates a Dart package from a Rust library. Extremely fast performance with strict typing and zero copy returns over the FFI boundary via bincode.

Membrane is an opinionated crate that generates a Dart package from a Rust library. Extremely fast performance with strict typing and zero copy returns over the FFI boundary via bincode.

Jerel Unruh 70 Dec 13, 2022
An opinionated, practical color management library for games and graphics.

colstodian An opinionated color management library built on top of kolor. Introduction colstodian is a practical color management library for games an

Gray Olson 27 Dec 7, 2022
A group of Rust projects for interacting with and producing software bill of materials (SBOMs).

sbom-rs A group of Rust projects for interacting with and producing software bill of materials (SBOMs). Examples cargo-sbom Create a SPDX SBOM for a C

Paul Sastrasinh 2 Jul 10, 2023