pub struct SDK { /* private fields */ }Implementations§
Source§impl SDK
impl SDK
Sourcepub fn app_key(&self) -> &PrivateKey
pub fn app_key(&self) -> &PrivateKey
Returns the application key used by the SDK.
This should be kept secret and secure. Applications should store it safely.
Sourcepub async fn upload<R: AsyncReadExt + Unpin + Send + 'static>(
&self,
reader: R,
options: UploadOptions,
) -> Result<Object, UploadError>
pub async fn upload<R: AsyncReadExt + Unpin + Send + 'static>( &self, reader: R, options: UploadOptions, ) -> Result<Object, UploadError>
Reads until EOF and uploads all slabs. The data will be erasure coded, encrypted, and uploaded using the uploader’s parameters.
§Arguments
r- The reader to read the data from. It will be read until EOF.options- The UploadOptions to use for the upload.
§Returns
A new object containing the metadata needed to download the object. The object can be sealed and pinned to the indexer when ready.
Sourcepub fn upload_packed(&self, options: UploadOptions) -> PackedUpload
pub fn upload_packed(&self, options: UploadOptions) -> PackedUpload
Creates a new packed upload. This allows multiple objects to be packed together
for more efficient uploads. The returned PackedUpload can be used to add objects to the upload, and then finalized to get the resulting objects.
§Arguments
options- The UploadOptions to use for the upload.
§Returns
A PackedUpload that can be used to add objects and finalize the upload.
Sourcepub async fn download<W: AsyncWriteExt + Unpin>(
&self,
w: &mut W,
object: &Object,
options: DownloadOptions,
) -> Result<(), DownloadError>
pub async fn download<W: AsyncWriteExt + Unpin>( &self, w: &mut W, object: &Object, options: DownloadOptions, ) -> Result<(), DownloadError>
Downloads an object using the provided writer and options.
Sourcepub async fn hosts(&self, query: HostQuery) -> Result<Vec<Host>, Error>
pub async fn hosts(&self, query: HostQuery) -> Result<Vec<Host>, Error>
Retrieves a list of hosts from the indexer matching the provided query that can be used for uploading and downloading data.
§Arguments
query- Filtering criteria to select hosts.
Sourcepub async fn account(&self) -> Result<Account, Error>
pub async fn account(&self) -> Result<Account, Error>
Retrieves account information from the indexer.
Sourcepub async fn object(&self, key: &Hash256) -> Result<Object, Error>
pub async fn object(&self, key: &Hash256) -> Result<Object, Error>
Retrieves an object from the indexer by its key.
§Arguments
key- The key of the object to retrieve.
Sourcepub async fn object_events(
&self,
cursor: Option<ObjectsCursor>,
limit: Option<usize>,
) -> Result<Vec<ObjectEvent>, Error>
pub async fn object_events( &self, cursor: Option<ObjectsCursor>, limit: Option<usize>, ) -> Result<Vec<ObjectEvent>, Error>
Retrieves a list of object events from the indexer. This can be used to synchronize local state with the indexer.
§Arguments
cursor- An optional cursor to continue from a previous call.limit- An optional limit on the number of events to retrieve.
Sourcepub async fn prune_slabs(&self) -> Result<(), Error>
pub async fn prune_slabs(&self) -> Result<(), Error>
Prunes unused slabs from the indexer. This helps to free up storage space by removing slabs that are no longer referenced by objects.
Sourcepub async fn update_object_metadata(&self, object: &Object) -> Result<(), Error>
pub async fn update_object_metadata(&self, object: &Object) -> Result<(), Error>
Updates the metadata of an object in the indexer. The object must already be pinned to the indexer.
§Arguments
object- The object to update.
Generates a shared URL for the given object that is valid until the specified time.
This object should be considered public even if the URL is kept secret, as anyone with the URL can access the object until the expiration time.
§Arguments
object- The object to share.valid_until- The time until which the shared URL is valid.
Retrieves a shared object from the given share URL.
§Arguments
share_url- The URL of the shared object.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SDK
impl !RefUnwindSafe for SDK
impl Send for SDK
impl Sync for SDK
impl Unpin for SDK
impl !UnwindSafe for SDK
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more