Skip to content

Commit

Permalink
Merge branch 'development' into static-file-server
Browse files Browse the repository at this point in the history
  • Loading branch information
sandreae committed Aug 9, 2023
2 parents 2799ddd + a6981fd commit ff170a3
Show file tree
Hide file tree
Showing 19 changed files with 605 additions and 140 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Only replicate and materialize configured "supported schema" [#569](https://github.com/p2panda/aquadoggo/pull/469)
- Parse supported schema ids from `config.toml` [#473](https://github.com/p2panda/aquadoggo/pull/473)
- Serve static files from `blobs` directory [#480](https://github.com/p2panda/aquadoggo/pull/480)
- Add method to store for pruning document views [#491](https://github.com/p2panda/aquadoggo/pull/491)
- Introduce `BlobStore` [#484](https://github.com/p2panda/aquadoggo/pull/484)

### Changed

Expand All @@ -54,6 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Remove `quick_commit` from materialization service [#450](https://github.com/p2panda/aquadoggo/pull/450)
- Reduce `warn` logging in network and replication services [#467](https://github.com/p2panda/aquadoggo/pull/467)
- `mdns` and `autonat` disabled by default [#475](https://github.com/p2panda/aquadoggo/pull/475)
- By default, nodes support _any_ schema [#487](https://github.com/p2panda/aquadoggo/pull/487)

### Fixed

Expand Down Expand Up @@ -84,6 +87,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Do nothing on log insertion conflict [#468](https://github.com/p2panda/aquadoggo/pull/468)
- Don't update or announce an update in schema provider if a schema with this id exists already [#472](https://github.com/p2panda/aquadoggo/pull/472)
- Do nothing on document_view insertion conflicts [#474](https://github.com/p2panda/aquadoggo/pull/474)
- Only over-write `http_port` when cli arg is passed [#489](https://github.com/p2panda/aquadoggo/pull/489)

### Open Sauce

Expand Down
3 changes: 1 addition & 2 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions aquadoggo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ lipmaa-link = "0.2.2"
log = "0.4.19"
once_cell = "1.18.0"
openssl-probe = "0.1.5"
p2panda-rs = { version = "0.7.1", features = [
p2panda-rs = { git = "https://github.com/p2panda/p2panda", rev = "17f4fcb1dcf7cebabd6d9b5a824399e9384d96b2", features = [
"storage-provider",
] }
rand = "0.8.5"
Expand Down Expand Up @@ -91,7 +91,7 @@ http = "0.2.9"
hyper = "0.14.19"
libp2p-swarm-test = "0.2.0"
once_cell = "1.17.0"
p2panda-rs = { version = "0.7.1", features = [
p2panda-rs = { git = "https://github.com/p2panda/p2panda", rev = "17f4fcb1dcf7cebabd6d9b5a824399e9384d96b2", features = [
"test-utils",
"storage-provider",
] }
Expand Down
18 changes: 9 additions & 9 deletions aquadoggo/migrations/20220510022755_create-documents.sql
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
-- SPDX-License-Identifier: AGPL-3.0-or-later

CREATE TABLE IF NOT EXISTS document_view_fields (
document_view_id TEXT NOT NULL,
operation_id TEXT NOT NULL,
name TEXT NOT NULL,
FOREIGN KEY(operation_id) REFERENCES operations_v1(operation_id)
);

CREATE INDEX idx_document_view_fields ON document_view_fields (document_view_id, operation_id, name);

CREATE TABLE IF NOT EXISTS document_views (
document_view_id TEXT NOT NULL UNIQUE,
schema_id TEXT NOT NULL,
PRIMARY KEY (document_view_id)
);

CREATE TABLE IF NOT EXISTS document_view_fields (
document_view_id TEXT NOT NULL,
operation_id TEXT NOT NULL,
name TEXT NOT NULL,
FOREIGN KEY(document_view_id) REFERENCES document_views(document_view_id) ON DELETE CASCADE
);

CREATE INDEX idx_document_view_fields ON document_view_fields (document_view_id, operation_id, name);

CREATE TABLE IF NOT EXISTS documents (
document_id TEXT NOT NULL UNIQUE,
document_view_id TEXT NOT NULL,
Expand Down
10 changes: 4 additions & 6 deletions aquadoggo/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ pub struct Configuration {
pub worker_pool_size: u32,

/// The ids of schema this node supports.
pub supported_schema_ids: Vec<SchemaId>,

/// If set to true then the node will dynamically support any new schema it replicates.
pub dynamic_schema: bool,
///
/// If `None` then the node will support all system schema and any new schema it discovers.
pub supported_schema_ids: Option<Vec<SchemaId>>,
}

impl Default for Configuration {
Expand All @@ -64,8 +63,7 @@ impl Default for Configuration {
http_port: 2020,
network: NetworkConfiguration::default(),
worker_pool_size: 16,
supported_schema_ids: vec![],
dynamic_schema: false,
supported_schema_ids: None,
}
}
}
Expand Down
42 changes: 32 additions & 10 deletions aquadoggo/src/db/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,55 @@ pub enum SqlStoreError {

#[error("Deletion of row from table {0} did not show any effect")]
Deletion(String),

/// Error returned from BlobStore.
#[error(transparent)]
BlobStoreError(#[from] BlobStoreError),
}

/// `SchemaStore` errors.
#[derive(Error, Debug)]
pub enum SchemaStoreError {
/// Catch all error which implementers can use for passing their own errors up the chain.
#[error("Error occured in DocumentStore: {0}")]
#[allow(dead_code)]
Custom(String),

/// Error returned from converting p2panda-rs `DocumentView` into `SchemaView.
#[error(transparent)]
SystemSchemaError(#[from] SystemSchemaError),
SystemSchema(#[from] SystemSchemaError),

/// Error returned from p2panda-rs `Schema` methods.
#[error(transparent)]
SchemaError(#[from] SchemaError),
Schema(#[from] SchemaError),

/// Error returned from p2panda-rs `SchemaId` methods.
#[error(transparent)]
SchemaIdError(#[from] SchemaIdError),
SchemaId(#[from] SchemaIdError),

/// Error returned from `DocumentStore` methods.
#[error(transparent)]
DocumentStorageError(#[from] DocumentStorageError),
DocumentStorage(#[from] DocumentStorageError),

/// Error returned from `OperationStore` methods.
#[error(transparent)]
OperationStorageError(#[from] OperationStorageError),
OperationStorage(#[from] OperationStorageError),
}

#[derive(Error, Debug)]
pub enum BlobStoreError {
/// Error when no "pieces" field found on blob document.
#[error("Missing \"pieces\" field on blob document")]
NotBlobDocument,

/// Error when no pieces found for existing blob document.
#[error("No pieces found for the requested blob")]
NoBlobPiecesFound,

/// Error when some pieces not found for existing blob document.
#[error("Some pieces missing for the requested blob")]
MissingPieces,

/// Error when combined pieces length and claimed blob length don't match.
#[error("The combined pieces length and claimed blob length don't match")]
IncorrectLength,

/// Error returned from `DocumentStore` methods.
#[error(transparent)]
DocumentStorageError(#[from] DocumentStorageError),
}
Loading

0 comments on commit ff170a3

Please sign in to comment.