Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement reduce and dependency task logic #144

Merged
merged 33 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7dd1adf
WIP: implement document materialisation and storage
sandreae Jun 4, 2022
f19c136
WIP: Implement document_view materialisation
sandreae Jun 4, 2022
be401bf
Bump p2panda_rs branch
sandreae Jun 4, 2022
50a7ea5
Tests for reduce_task
sandreae Jun 8, 2022
f8b5b8e
Clipp
sandreae Jun 8, 2022
89be006
Test for reducing document_views
sandreae Jun 8, 2022
d4a3c79
Return next dependency tasks
sandreae Jun 8, 2022
045bfca
fmt
sandreae Jun 8, 2022
a7c76b3
Implement dependency task logic
sandreae Jun 8, 2022
f33b6be
Get parent relations too
sandreae Jun 8, 2022
11dd828
Handle errors
sandreae Jun 8, 2022
ddda36c
Completely redo dependency task logic :lolz:
sandreae Jun 9, 2022
82188c2
Add test for deleted documents
sandreae Jun 9, 2022
2b68e43
Schema task
sandreae Jun 9, 2022
54e4a9b
Refactoring and commetns in reduce
sandreae Jun 10, 2022
17d0aa4
Comment for helper tasks
sandreae Jun 13, 2022
a5f9415
A few more comments
sandreae Jun 13, 2022
2be82ba
Some more comments
sandreae Jun 13, 2022
e8eca47
We don't need to check parent dependencies in dependency task
sandreae Jun 13, 2022
89d4357
Remove code relating to schema task
sandreae Jun 13, 2022
15ff1a0
Fix reduce error test
sandreae Jun 13, 2022
e2193a7
Make clippy happy
sandreae Jun 13, 2022
6f8b43d
Update CHANGELOG
sandreae Jun 13, 2022
89783ac
Changes after rebase
sandreae Jun 14, 2022
b788737
Review changes
sandreae Jun 14, 2022
1bb76ec
Rephrase dependency task docstrings
cafca Jun 14, 2022
1c6bd0a
Refactoring in dependency task
sandreae Jun 15, 2022
95abba9
More detailed docs for sependency task
sandreae Jun 15, 2022
7263bfc
Reduce task doc string
sandreae Jun 15, 2022
1f33743
Remove comment about wanted schema
sandreae Jun 15, 2022
43bd91a
Fix rebase
adzialocha Jun 15, 2022
ba3d649
Fix missing docstring after rebase
adzialocha Jun 15, 2022
b0d0124
Try to improve control flow in reduce task as well
adzialocha Jun 15, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- GraphQL endpoint for publishing entries [#123](https://github.com/p2panda/aquadoggo/pull/132)
- Implement SQL `DocumentStore` [#118](https://github.com/p2panda/aquadoggo/pull/118)
- Implement SQL `SchemaStore` [#130](https://github.com/p2panda/aquadoggo/pull/130)
- Reduce and dependency tasks [#144](https://github.com/p2panda/aquadoggo/pull/144)
- GraphQL endpoints for replication [#100](https://github.com/p2panda/aquadoggo/pull/100)

### Changed
Expand Down
34 changes: 17 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions aquadoggo/src/db/provider.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

use async_trait::async_trait;
use sqlx::query_scalar;

Expand All @@ -14,20 +15,21 @@ use crate::graphql::client::{
EntryArgsRequest, EntryArgsResponse, PublishEntryRequest, PublishEntryResponse,
};

#[derive(Debug, Clone)]
/// Sql based storage that implements `StorageProvider`
/// Sql based storage that implements `StorageProvider`.
#[derive(Clone, Debug)]
pub struct SqlStorage {
pub(crate) pool: Pool,
}

impl SqlStorage {
/// Create a new `SqlStorage` using the provided db `Pool`
/// Create a new `SqlStorage` using the provided db `Pool`.
pub fn new(pool: Pool) -> Self {
Self { pool }
}
}

/// A `StorageProvider` implementation based on `sqlx` that supports SQLite and PostgreSQL databases.
/// A `StorageProvider` implementation based on `sqlx` that supports SQLite and PostgreSQL
/// databases.
#[async_trait]
impl StorageProvider<StorageEntry, StorageLog> for SqlStorage {
type EntryArgsResponse = EntryArgsResponse;
Expand Down
2 changes: 0 additions & 2 deletions aquadoggo/src/db/stores/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ impl DocumentStore for SqlStorage {
.await
.map_err(|e| DocumentStorageError::FatalStorageError(e.to_string()))?;

println!("{:#?}", document_view_field_rows);

if document_view_field_rows.is_empty() {
return Ok(None);
}
Expand Down
4 changes: 2 additions & 2 deletions aquadoggo/src/materializer/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use p2panda_rs::document::{DocumentId, DocumentViewId};

#[derive(Clone, Eq, PartialEq, Debug, Hash)]
pub struct TaskInput {
document_id: Option<DocumentId>,
document_view_id: Option<DocumentViewId>,
pub document_id: Option<DocumentId>,
pub document_view_id: Option<DocumentViewId>,
}

impl TaskInput {
Expand Down
Loading