Skip to content

Commit 3fbcb3d

Browse files
committed
Merge #1: Improved documentation
Approved-by: Qqwy Priority: Normal Auto-deploy: false
2 parents f7e55e8 + a93d092 commit 3fbcb3d

File tree

13 files changed

+54
-4
lines changed

13 files changed

+54
-4
lines changed

opsqueue/src/common/chunk.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//! Dealing with `Chunk``s, the most fine-grained datatype the queue itself works with.
2+
//!
3+
//! While the smallest datatype is the 'Operation', the Opsqueue queue binary itself
4+
//! only deals with _chunks_ of them. The operations inside of them are hidden and only read/written
5+
//! from/to object store all the way in the client.
16
use chrono::{DateTime, Utc};
27

38
use serde::{Deserialize, Serialize};

opsqueue/src/common/errors.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//! Common error types
2+
//!
3+
//! You might notice in many places in Opsqueue that we use very fine-grained error types,
4+
//! and combine them together using the `E` helper.
5+
//!
6+
//! This is a conscious choice: While it makes some function signatures more complex,
7+
//! it allows us to be super precise in what kind of errors can and cannot occur
8+
//! in certain API calls.
19
use serde::{Deserialize, Serialize};
210
use thiserror::Error;
311

opsqueue/src/common/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Common datatypes and errors shared across all parts of Opsqueue
12
use rustc_hash::FxHashMap;
23

34
pub mod chunk;

opsqueue/src/common/submission.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Dealing with `Submission`s: Collections of (`Chunks`s of) operations.
12
use std::fmt::Display;
23
use std::time::Duration;
34

opsqueue/src/config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//! Defines the source of truth for configuring the Opsqueue queue
2+
//!
3+
//! We make use of the excellent `clap` crate to make customizing the configuration
4+
//! with command-line args easier.
15
use std::num::NonZero;
26

37
use clap::Parser;

opsqueue/src/consumer/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! The Consumer side: Interface to reserve, work on, and complete/fail individual Chunks
12
pub mod common;
23
pub mod strategy;
34

opsqueue/src/db/conn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use super::{magic::*, Connection};
1717
/// You can get a `WriterPool` from [`DBPools::writer_pool`], and a [`ReaderPool`] from
1818
/// [`DBPools::reader_pool`].
1919
///
20-
/// [`Pool`]: super::pool::Pool
20+
/// [`Pool`]: super::Pool
2121
/// [`ReaderPool`]: super::ReaderPool
2222
/// [`WriterPool`]: super::WriterPool
2323
/// [`DBPools::reader_pool`]: super::DBPools::reader_pool

opsqueue/src/db/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ impl WriterPool {
276276
///
277277
/// See [`DBPools`] for further explanation about readers and writers.
278278
///
279-
/// [`DBPools`]: super::DBPools
279+
/// [`DBPools`]: DBPools
280280
pub async fn writer_conn(&self) -> sqlx::Result<Writer<NoTransaction>> {
281281
self.acquire().await
282282
}
@@ -287,7 +287,7 @@ impl ReaderPool {
287287
///
288288
/// See [`DBPools`] for further explanation about readers and writers.
289289
///
290-
/// [`DBPools`]: super::DBPools
290+
/// [`DBPools`]: DBPools
291291
pub async fn reader_conn(&self) -> sqlx::Result<Reader<NoTransaction>> {
292292
self.acquire().await
293293
}

opsqueue/src/lib.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
//! Opsqueue: A lightweight batch processing queue for heavy loads
2+
//!
3+
//! Simple 'getting started' instructions can be found [in the repository README](https://github.com/channable/opsqueue/).
4+
//!
5+
//! The Rust codebase defines both the 'server', which makes up the bulk of the Opsqueue binary itself,
6+
//! and the 'client', which is the common part of functionality that clients written in different other programming languages
7+
//! can all use.
8+
//!
9+
//! Many datatypes are shared between this server and client, and therefore their code lives together in the same crate.
10+
//! Instead, we use feature-flags (`client-logic` and `server-logic`) to decide what concrete parts to include when building.
11+
//! The set of dependencies is based on these same feature-flags.
12+
//! Most interestingly, in the test suite we enable both feature-flags so we're able to do a bunch of round-trip testing
13+
//! immediately in Rust code.
14+
//!
15+
//! # Module setup
16+
//! - The basic logic is divided in the `producer` and `consumer` modules. These both have their own `db` submodule.
17+
//! - Common functionality and datatypes exists in the `common` module
18+
//! - Common database helpers live in the `db` module.
19+
//! - Reading/writing to object stores like GCS or S3 is abstracted in the `object_store` module.
20+
//! - Finally, extra modules to have a single source of truth for configuration of the queue, and to nicely do tracing and expose metrics exist.
21+
122
pub mod common;
223
pub mod consumer;
324
pub mod producer;

opsqueue/src/producer/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! The Producer side: Interface to create and read submissions
12
#[cfg(feature = "client-logic")]
23
pub mod client;
34
pub mod common;

0 commit comments

Comments
 (0)