Struct s3handler::tokio_async::primitives::Canal[][src]

pub struct Canal {
    pub up_pool: Option<Box<dyn DataPool>>,
    pub upstream_object: Option<S3Object>,
    pub down_pool: Option<Box<dyn DataPool>>,
    pub downstream_object: Option<S3Object>,
    // some fields omitted
}

Fields

up_pool: Option<Box<dyn DataPool>>upstream_object: Option<S3Object>down_pool: Option<Box<dyn DataPool>>downstream_object: Option<S3Object>

Implementations

impl Canal[src]

A canal presets a object link for two object from resource pool to pool. If everything is set, the async api can pull/push the objects.

The download_file, and upload_file api will setup the up pool as s3 pool, and set up the down pool as file pool for the most usage case.

The terms object, key, bucket, folder, path may be easiler for readness in coding, so there are several similar methods help you to setup things. If you down want these duplicate functions, you can enable the slim feature.

pub fn is_connect(&self) -> bool[src]

Check the two pools are set or not

pub fn toward(mut self: Self, resource_location: &str) -> Result<Self, Error>[src]

Set downd pool as file pool, and toward to the resource_location

pub fn from(mut self: Self, resource_location: &str) -> Result<Self, Error>[src]

Set up pool as file pool, and from to the resource_location

pub async fn download_file(self, resource_location: &str) -> Result<(), Error>[src]

Download object from s3 pool to file pool This function set file pool as down pool and s3 pool as up pool then toward to the resource_location, pull the object from uppool into down pool.

pub async fn upload_file(self, resource_location: &str) -> Result<(), Error>[src]

Upload object from file pool to s3 pool This function set file pool as down pool and s3 pool as up pool then toward to the resource_location, push the object from uppool into down pool.

pub fn from_pool(&mut self, pool: Box<dyn DataPool>)[src]

Setup the up pool

pub fn toward_pool(&mut self, pool: Box<dyn DataPool>)[src]

Setup the down pool

pub fn _object(mut self: Self, object_name: &str) -> Self[src]

pub fn _bucket(mut self: Self, bucket_name: &str) -> Self[src]

pub fn object(self, object_name: &str) -> Self[src]

Setup the object for the first pool connected by canal, This api can be used without fully setting up two pools, and just set up the object as you what you think.

pub fn key(self, key_name: &str) -> Self[src]

The same as object()

pub fn bucket(self, bucket_name: &str) -> Self[src]

Setup the bucket for the first pool connected by canal, This api can be used without fully setting up two pools, and just set up the object as you what you think.

pub fn folder(self, folder_name: &str) -> Self[src]

The same as bucket()

pub fn _toward_object(&mut self, object_name: &str)[src]

pub fn toward_object(&mut self, object_name: &str)[src]

Setup the object in the down pool

pub fn toward_key(&mut self, object_name: &str)[src]

The same as toward_object()

pub fn _toward_bucket(&mut self, bucket_name: &str)[src]

pub fn toward_bucket(&mut self, bucket_name: &str)[src]

Setup the bucket in the down pool

pub fn toward_folder(&mut self, folder_name: &str)[src]

The same as toward_bucket()

pub fn toward_path(&mut self, path: &str)[src]

Setup the path in the down pool

pub fn _from_object(&mut self, object_name: &str)[src]

pub fn from_object(&mut self, object_name: &str)[src]

Setup the object in the up pool

pub fn from_key(&mut self, object_name: &str)[src]

The same as from_object()

pub fn _from_bucket(&mut self, bucket_name: &str)[src]

pub fn from_bucket(&mut self, bucket_name: &str)[src]

Setup the bucket in the up pool

pub fn from_folder(&mut self, folder_name: &str)[src]

The same as from_bucket()

pub fn from_path(&mut self, path: &str)[src]

Setup the path in the up pool

pub async fn push(self) -> Result<(), Error>[src]

Push the object from down pool to up pool. It will raise error if the canal is not will setup.

pub async fn pull(self) -> Result<(), Error>[src]

Pull the object from up pool to down pool. It will raise error if the canal is not will setup.

pub async fn upstream_remove(self) -> Result<(), Error>[src]

Remove the object in the up pool.

pub async fn downstream_remove(self) -> Result<(), Error>[src]

Remove the object in the down pool.

pub async fn remove(self) -> Result<(), Error>[src]

Remove the object depence on the first pool connected by the canal This api can be used without fully setting up two pools, and remove object as you what you think.

pub async fn upstream_list(self) -> Result<Box<dyn S3Folder>, Error>[src]

List the objects in the up pool.

pub async fn downstream_list(self) -> Result<Box<dyn S3Folder>, Error>[src]

List the objects in the down pool.

pub async fn list(self) -> Result<Box<dyn S3Folder>, Error>[src]

List the objects depence on the first pool connected by the canal This api can be used without fully setting up two pools, and list objects as you what you think.

Trait Implementations

impl Debug for Canal[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.