Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,9 @@ cargo run --release -p stresstest -- -c stresstest/config/example.yaml
Similar to the objectstore server, you can find example configuration files in
the `config` subfolder. Copy and save your own files there, as they will not be
tracked by git.

## License

Like Sentry, Objectstore is licensed under the FSL. See the `LICENSE.md` file
and [this blog post](https://blog.sentry.io/introducing-the-functional-source-license-freedom-without-free-riding/)
for more information.
7 changes: 7 additions & 0 deletions objectstore-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
[package]
name = "objectstore-client"
authors = ["Sentry <oss@sentry.io>"]
description = "Client SDK for Objectstore, the Sentry object storage platform"
homepage = "https://getsentry.github.io/objectstore/"
repository = "https://github.com/getsentry/objectstore"
license-file = "../LICENSE.md"
version = "0.1.0"
edition = "2024"
rust-version = "1.89"
publish = true

[dependencies]
anyhow = { workspace = true }
Expand Down
24 changes: 24 additions & 0 deletions objectstore-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Objectstore Client

The client is used to interface with the objectstore backend. It handles
responsibilities like transparent compression, and making sure that uploads and
downloads are done as efficiently as possible.

## Usage

```rust
use objectstore_client::ClientBuilder;

let client = ClientBuilder::new("http://localhost:8888/", "my-usecase")?
.for_organization(42);

let id = client.put("hello world").send().await?;
let object = client.get(&id.key).send().await?.expect("object to exist");
assert_eq!(object.payload().await?, "hello world");
```

## License

Like Sentry, Objectstore is licensed under the FSL. See the `LICENSE.md` file
and [this blog post](https://blog.sentry.io/introducing-the-functional-source-license-freedom-without-free-riding/)
for more information.
16 changes: 16 additions & 0 deletions objectstore-client/src/get.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{fmt, io};

use async_compression::tokio::bufread::ZstdDecoder;
use bytes::BytesMut;
use futures_util::{StreamExt, TryStreamExt};
use objectstore_types::Metadata;
use reqwest::StatusCode;
Expand All @@ -19,6 +20,21 @@ pub struct GetResult {
/// The response stream.
pub stream: ClientStream,
}

impl GetResult {
/// Loads the object payload fully into memory.
pub async fn payload(self) -> anyhow::Result<bytes::Bytes> {
let bytes: BytesMut = self.stream.try_collect().await?;
Ok(bytes.freeze())
}

/// Loads the object payload fully into memory and interprets it as UTF-8 text.
pub async fn text(self) -> anyhow::Result<String> {
let bytes = self.payload().await?;
Ok(String::from_utf8(bytes.to_vec())?)
}
}

impl fmt::Debug for GetResult {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("GetResult")
Expand Down
25 changes: 21 additions & 4 deletions objectstore-client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
//! The Storage Client
//! # Objectstore Client
//!
//! The Client is used to interface with the objectstore backend.
//! It handles responsibilities like transparent compression, and making sure that
//! uploads and downloads are done as efficiently as possible.
//! The client is used to interface with the objectstore backend. It handles responsibilities like
//! transparent compression, and making sure that uploads and downloads are done as efficiently as
//! possible.
//!
//! ## Usage
//!
//! ```no_run
//! use objectstore_client::ClientBuilder;
//!
//! #[tokio::main]
//! # async fn main() -> anyhow::Result<()> {
//! let client = ClientBuilder::new("http://localhost:8888/", "my-usecase")?
//! .for_organization(42);
//!
//! let id = client.put("hello world").send().await?;
//! let object = client.get(&id.key).send().await?.expect("object to exist");
//! assert_eq!(object.payload().await?, "hello world");
//! # Ok(())
//! # }
//! ```
#![warn(missing_docs)]
#![warn(missing_debug_implementations)]

Expand Down
6 changes: 6 additions & 0 deletions objectstore-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
[package]
name = "objectstore-server"
authors = ["Sentry <oss@sentry.io>"]
description = "Web server application of Objectstore, the Sentry object storage platform"
homepage = "https://getsentry.github.io/objectstore/"
repository = "https://github.com/getsentry/objectstore"
license-file = "../LICENSE.md"
version = "0.1.0"
edition = "2024"
build = "build.rs"
publish = false

[dependencies]
anyhow = { workspace = true }
Expand Down
6 changes: 6 additions & 0 deletions objectstore-service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
[package]
name = "objectstore-service"
authors = ["Sentry <oss@sentry.io>"]
description = "Storage and backend logic of Objectstore, the Sentry object storage platform"
homepage = "https://getsentry.github.io/objectstore/"
repository = "https://github.com/getsentry/objectstore"
license-file = "../LICENSE.md"
version = "0.1.0"
edition = "2024"
publish = false

[dependencies]
anyhow = { workspace = true }
Expand Down
6 changes: 6 additions & 0 deletions objectstore-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
[package]
name = "objectstore-types"
authors = ["Sentry <oss@sentry.io>"]
description = "Shared types for the Objectstore client and server"
homepage = "https://getsentry.github.io/objectstore/"
repository = "https://github.com/getsentry/objectstore"
license-file = "../LICENSE.md"
version = "0.1.0"
edition = "2024"
publish = false

[dependencies]
anyhow = { workspace = true }
Expand Down
6 changes: 6 additions & 0 deletions stresstest/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
[package]
name = "stresstest"
authors = ["Sentry <oss@sentry.io>"]
description = "Tool for generating file storage load against Objectstore servers"
homepage = "https://getsentry.github.io/objectstore/"
repository = "https://github.com/getsentry/objectstore"
license-file = "../LICENSE.md"
version = "0.1.0"
edition = "2024"
publish = false

[dependencies]
anyhow = { workspace = true }
Expand Down