Skip to main content

Crate storj

Crate storj 

Source
Expand description

Native Rust Uplink client for the Storj decentralized object store.

1.1.1 extends the public storj::* API: access grants, buckets, objects (multi-segment upload/download), listing, copy/move, multipart, revoke, and Object Lock. Edge credential registration and linksharing are outside this crate’s scope.

Not a wrapper around uplink-c, and not a drop-in for crates.io uplink 0.11.0 (blocking FFI, !Send). Spec: docs/design-native-uplink.md.

Depend on this crate from crates.io (storj = "1.1"). Callers need their own Tokio runtime (tokio is not re-exported).

MSRV 1.88, edition 2024. Dual-licensed MIT OR Apache-2.0.

§Walkthrough

commit() publishes the object. Dropping Upload without commit aborts. poll_shutdown does not commit.

use storj::{Access, Project};
use tokio::io::AsyncWriteExt;

let access = Access::parse(&std::env::args().nth(1).expect("grant"))?;
let project = Project::open(&access).await?;
project.ensure_bucket("logs").await?;

let mut upload = project
    .upload_object("logs", "hello.txt", Default::default())
    .await?;
upload.write_all(b"hello storj").await?;
let _obj = upload.commit().await?;

let mut download = project
    .download_object("logs", "hello.txt", Default::default())
    .await?;
let mut buf = Vec::new();
tokio::io::copy(&mut download, &mut buf).await?;
download.close().await?;
project.close().await?;

Re-exports§

pub use access::Access;
pub use access::Permission;
pub use access::SharePrefix;
pub use config::Config;
pub use config::TlsIdentity;
pub use encryption::EncryptionKey;
pub use error::Error;
pub use error::ErrorKind;
pub use error::Result;
pub use project::BucketStream;
pub use project::ObjectStream;
pub use project::PartStream;
pub use project::Project;
pub use project::UploadStream;
pub use types::Bucket;
pub use types::BucketObjectLockConfiguration;
pub use types::CommitUploadOptions;
pub use types::CreateBucketOptions;
pub use types::CustomMetadata;
pub use types::DefaultRetention;
pub use types::DownloadOptions;
pub use types::ListBucketsOptions;
pub use types::ListObjectsOptions;
pub use types::ListUploadPartsOptions;
pub use types::ListUploadsOptions;
pub use types::Object;
pub use types::ObjectChecksum;
pub use types::ObjectChecksumAlgorithm;
pub use types::Part;
pub use types::Retention;
pub use types::RetentionMode;
pub use types::SetObjectRetentionOptions;
pub use types::SystemMetadata;
pub use types::UploadInfo;
pub use types::UploadOptions;
pub use types::verify_custom_metadata;
pub use upload::Download;
pub use upload::PartUpload;
pub use upload::Upload;

Modules§

access
Access grants: parse, serialize, share (restrict), and encryption-key override.
config
Client configuration and caller-supplied TLS identities.
constants
Protocol constants copied from uplink-go / satellite config (cited in the design). Production Reed-Solomon k/m/o/n is not hardcoded; BeginSegment supplies it.
encryption
Encryption key derivation and path cipher (re-exported from storj-encryption).
error
Public error type. Stable kind for matching; source may change.
project
Project — bucket and object operations.
types
Public metadata types (bucket, object, options, Object Lock).
upload
Upload / download / part-upload handles.

Structs§

DiagnosticRange
Download range, in plaintext bytes. Requested ranges can contain negative offsets/lengths; resolved ranges are clamped to the object and nonnegative.
NetworkOptions
TCP performance controls. Unsupported platform/kernel options are ignored.
Telemetry
Cloneable callback. Called synchronously; callbacks must be fast and nonblocking. Panics are isolated so an observer cannot fail an operation (with unwind builds).
TransferDiagnostics
Additional local diagnostics, without object paths, credentials or error text.

Enums§

Operation
Operation measured by a transfer event.
Outcome
Terminal outcome. Dropped unfinished transfers are cancelled.
TelemetryEvent
Telemetry deliberately excludes credentials, bucket names, keys and error text.
TransportKind
Actual wire transport selected for a connection.
TransportMode
Connection selection. Auto starts TCP after a 250 ms QUIC head start, or immediately if QUIC fails; the first authenticated connection wins.

Functions§

version
Crate version from Cargo.toml.