Skip to content

Commit

Permalink
Merge pull request #3 from andrewwhitehead/main
Browse files Browse the repository at this point in the history
Use released version of sqlx and update URLs
  • Loading branch information
andrewwhitehead authored Jan 11, 2021
2 parents 57a631b + 7a8a437 commit 3dfcf5f
Show file tree
Hide file tree
Showing 31 changed files with 1,604 additions and 1,079 deletions.
392 changes: 230 additions & 162 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "aries-askar"
version = "0.1.0"
version = "0.1.2"
authors = ["Hyperledger Aries Contributors <[email protected]>"]
edition = "2018"
description = "Hyperledger Aries Askar secure storage"
license = "MIT/Apache-2.0"
readme = "README.md"
repository = "https://github.com/bcgov/aries-askar/"
repository = "https://github.com/hyperledger/aries-askar/"
categories = ["cryptography", "database"]
keywords = ["hyperledger", "aries", "ssi", "verifiable", "credentials"]

Expand All @@ -26,6 +26,7 @@ all = ["any", "postgres", "sqlite"]
any = []
ffi = ["any", "ffi-support", "logger"]
indy_compat = ["sqlx", "sqlx/sqlite"]
jemalloc = ["jemallocator"]
logger = ["env_logger", "log"]
postgres = ["sqlx", "sqlx/postgres", "sqlx/tls"]
sqlite = ["num_cpus", "sqlx", "sqlx/sqlite"]
Expand All @@ -46,9 +47,10 @@ futures-lite = "1.7"
hex = "0.4"
hmac = "0.10"
itertools = "0.9"
jemallocator = { version = "0.3", optional = true }
log = { version = "0.4", optional = true }
num_cpus = { version = "1.0", optional = true }
once_cell = "1.4"
once_cell = "1.5"
percent-encoding = "2.0"
rand = "0.7"
rmp-serde = "0.14"
Expand All @@ -62,17 +64,15 @@ uuid = { version = "0.8", features = ["v4"] }
zeroize = { version = "1.1.0", features = ["zeroize_derive"] }

[dependencies.indy-utils]
version = "=0.3.8"
version = "=0.3.9"
default-features = false
features = ["ed25519", "pack", "serde_support", "wql"]

[dependencies.sqlx]
version = "0.4.1"
version = "0.4.2"
default-features = false
features = ["chrono", "runtime-async-std-rustls"]
optional = true
git = "https://github.com/andrewwhitehead/sqlx"
branch = "pool-release-dec-size"

# [target.'cfg(target_os = "macos")'.dependencies]
# keychain-services = { path = "../keychain-services.rs" }
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ The initial implementation of `aries-askar` was developed by the Verifiable Orga

## Contributing

Pull requests are welcome! Please read our [contributions guide](https://github.com/bcgov/aries-askar/blob/master/CONTRIBUTING.md) and submit your PRs. We enforce [developer certificate of origin](https://developercertificate.org/) (DCO) commit signing. See guidance [here](https://github.com/apps/dco).
Pull requests are welcome! Please read our [contributions guide](https://github.com/hyperledger/aries-askar/blob/master/CONTRIBUTING.md) and submit your PRs. We enforce [developer certificate of origin](https://developercertificate.org/) (DCO) commit signing. See guidance [here](https://github.com/apps/dco).

We also welcome issues submitted about problems you encounter in using `aries-askar`.

## License

Licensed under either of

- Apache License, Version 2.0 ([LICENSE-APACHE](https://github.com/bcgov/aries-askar/blob/master/LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](https://github.com/bcgov/aries-askar/blob/master/LICENSE-MIT) or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 ([LICENSE-APACHE](https://github.com/hyperledger/aries-askar/blob/master/LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](https://github.com/hyperledger/aries-askar/blob/master/LICENSE-MIT) or http://opensource.org/licenses/MIT)

at your option.
21 changes: 16 additions & 5 deletions src/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,25 @@ use super::postgres::PostgresStore;
#[cfg(feature = "sqlite")]
use super::sqlite::SqliteStore;

/// A generic `Store` implementation for any supported backend
pub type AnyStore = Store<AnyBackend>;

/// A generic `Session` implementation for any supported backend
pub type AnySession = Session<AnyQueryBackend>;

/// An enumeration of supported store backends
#[derive(Debug)]
pub enum AnyBackend {
/// A PostgreSQL store
#[cfg(feature = "postgres")]
Postgres(PostgresStore),

/// A Sqlite store
#[cfg(feature = "sqlite")]
Sqlite(SqliteStore),

#[allow(unused)]
#[doc(hidden)]
Other,
}

Expand All @@ -44,15 +50,15 @@ macro_rules! with_backend {
impl Backend for AnyBackend {
type Session = AnyQueryBackend;

fn create_profile(&self, name: Option<String>) -> BoxFuture<Result<String>> {
fn create_profile(&self, name: Option<String>) -> BoxFuture<'_, Result<String>> {
with_backend!(self, store, store.create_profile(name))
}

fn get_profile_name(&self) -> &str {
with_backend!(self, store, store.get_profile_name())
}

fn remove_profile(&self, name: String) -> BoxFuture<Result<bool>> {
fn remove_profile(&self, name: String) -> BoxFuture<'_, Result<bool>> {
with_backend!(self, store, store.remove_profile(name))
}

Expand All @@ -64,7 +70,7 @@ impl Backend for AnyBackend {
tag_filter: Option<TagFilter>,
offset: Option<i64>,
limit: Option<i64>,
) -> BoxFuture<Result<Scan<'static, Entry>>> {
) -> BoxFuture<'_, Result<Scan<'static, Entry>>> {
with_backend!(
self,
store,
Expand Down Expand Up @@ -95,23 +101,28 @@ impl Backend for AnyBackend {
&mut self,
method: WrapKeyMethod,
pass_key: PassKey<'_>,
) -> BoxFuture<Result<()>> {
) -> BoxFuture<'_, Result<()>> {
with_backend!(self, store, store.rekey_backend(method, pass_key))
}

fn close(&self) -> BoxFuture<Result<()>> {
fn close(&self) -> BoxFuture<'_, Result<()>> {
with_backend!(self, store, store.close())
}
}

/// An enumeration of supported backend session types
#[derive(Debug)]
pub enum AnyQueryBackend {
/// A PostgreSQL store session
#[cfg(feature = "postgres")]
PostgresSession(<PostgresStore as Backend>::Session),

/// A Sqlite store session
#[cfg(feature = "sqlite")]
SqliteSession(<SqliteStore as Backend>::Session),

#[allow(unused)]
#[doc(hidden)]
Other,
}

Expand Down
Loading

0 comments on commit 3dfcf5f

Please sign in to comment.