11 breaking releases

0.49.0 Nov 12, 2024
0.47.0 Jul 23, 2024
0.42.0 Mar 18, 2024

#1380 in HTTP server

Download history 15/week @ 2024-09-13 2/week @ 2024-09-20 129/week @ 2024-09-27 33/week @ 2024-10-04 12/week @ 2024-10-11 2/week @ 2024-10-18 103/week @ 2024-11-08 29/week @ 2024-11-15 11/week @ 2024-11-22 10/week @ 2024-11-29 23/week @ 2024-12-06

82 downloads per month

Apache-2.0

27KB
459 lines

Shuttle OpenDAL

This plugin allows services to connect to Apache OpenDAL™. OpenDAL is a data access layer that allows users to easily and efficiently retrieve data from various storage services in a unified way.

Users can connect OpenDAL to access data from a variety of storage services, including: s3, azblob, gcs, oss and so on.

Usage

IMPORTANT: Currently Shuttle isn't able to provision a storage for you (yet). This means you will have to create the storage service first and setup the secrets accordingly.

Add shuttle-opendal to the dependencies for your service by running cargo add shuttle-opendal. This resource will be provided by adding the shuttle_opendal::Opendal attribute to your Shuttle main decorated function.

It returns a opendal::Operator for you to connect the storage service.

Example

In the case of an Axum server, your main function will look like this:

use opendal::Operator;
use shuttle_axum::ShuttleAxum;

#[shuttle_runtime::main]
async fn app(
    #[shuttle_opendal::Opendal(scheme = "s3")]
    storage: Operator,
) -> ShuttleAxum {}

Parameters

Parameter Type Default Description
scheme str "memory" The scheme of the storage service to connect to.

All secrets are loaded from your Secrets.toml file.

For instance, when using s3, you can configure the scheme to s3 and specify the secrets: bucket, access_key_id, and secret_access_key.

Visit the OpenDAL Documentation for more information on how to setup the secrets for the storage service you want to connect to.

Dependencies

~15–28MB
~442K SLoC