Skip to content

Commit

Permalink
Add call to funding to init
Browse files Browse the repository at this point in the history
  • Loading branch information
durch committed Sep 1, 2024
1 parent 517b497 commit 6411384
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

Rust library for working with Amazon S3 or arbitrary S3 compatible APIs, fully compatible with **async/await** and `futures ^0.3`. All `async` features can be turned off and sync only implementations can be used.

### Support further maintenance and development
### :raised_hands: Support further maintenance and development

As many have noted my attention to the this library oscialtes, the best way to ensure I keep maintaining and adding features to it is to donate som BTC, or become a sponsor. Thank you for the support!

+ BTC - `bc1q7ukqe09zplg2sltgfrkukghpelfaz7qja8pw6u`
**:moneybag: BTC :point_right: bc1q7ukqe09zplg2sltgfrkukghpelfaz7qja8pw6u**

### Intro

Expand Down
4 changes: 3 additions & 1 deletion s3/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rust-s3"
version = "0.36.0-alpha.3"
version = "0.36.0-alpha.4"
authors = ["Drazen Urch"]
description = "Rust library for working with AWS S3 and compatible object storage APIs"
repository = "https://github.com/durch/rust-s3"
Expand Down Expand Up @@ -120,6 +120,8 @@ sync-native-tls-vendored = [
]
sync-rustls-tls = ["sync", "aws-creds/rustls-tls", "attohttpc/tls-rustls"]

disable-call-for-funding = []

[dev-dependencies]
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros", "fs"] }
async-std = { version = "1", features = ["attributes"] }
Expand Down
5 changes: 4 additions & 1 deletion s3/src/bucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ use crate::serde_types::{
};
#[allow(unused_imports)]
use crate::utils::{error_from_response_data, PutStreamResponse};
use crate::PostPolicy;
use crate::{init_once, PostPolicy};
use http::header::HeaderName;
use http::HeaderMap;

Expand Down Expand Up @@ -600,6 +600,9 @@ impl Bucket {
region: Region,
credentials: Credentials,
) -> Result<Box<Bucket>, S3Error> {
#[cfg(not(feature = "disable-call-for-funding"))]
init_once();

#[cfg(feature = "with-tokio")]
let options = ClientOptions::default();

Expand Down
17 changes: 17 additions & 0 deletions s3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
#[macro_use]
extern crate serde_derive;

use std::sync::atomic::AtomicBool;

pub use awscreds as creds;
pub use awsregion as region;

pub use bucket::Bucket;
pub use bucket::Tag;
pub use bucket_ops::BucketConfiguration;
use log::info;
pub use post_policy::{PostPolicy, PostPolicyChecksum, PostPolicyField, PostPolicyValue};
pub use region::Region;

Expand All @@ -28,3 +31,17 @@ pub mod utils;
const LONG_DATETIME: &[time::format_description::FormatItem<'static>] =
time::macros::format_description!("[year][month][day]T[hour][minute][second]Z");
const EMPTY_PAYLOAD_SHA: &str = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";

#[cfg(not(feature = "disable-call-for-funding"))]
static INITIALIZED: AtomicBool = AtomicBool::new(false);

#[cfg(not(feature = "disable-call-for-funding"))]
#[inline(always)]
pub(crate) fn init_once() {
if !INITIALIZED.load(std::sync::atomic::Ordering::Relaxed) {
INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
info!(
"###############################################################################################################\nSupport further `rust-s3` development by donating BTC to bc1q7ukqe09zplg2sltgfrkukghpelfaz7qja8pw6u. Thank you!\n###############################################################################################################"
);
}
}

0 comments on commit 6411384

Please sign in to comment.