Enum cargo_registry::uploaders::Uploader
[−]
[src]
pub enum Uploader { S3 { bucket: Bucket, proxy: Option<String>, }, Local, NoOp, }
Variants
S3
For production usage, uploads and redirects to s3. For test usage with a proxy.
Fields of S3
bucket: Bucket | |
proxy: Option<String> |
Local
For development usage only: "uploads" crate files to dist
and serves them
from there as well to enable local publishing and download
NoOp
For one-off scripts where creating a Config is needed, but uploading is not.
Methods
impl Uploader
[src]
fn proxy(&self) -> Option<&str>
[src]
fn crate_location(&self, crate_name: &str, version: &str) -> Option<String>
[src]
Returns the URL of an uploaded crate's version archive.
The function doesn't check for the existence of the file.
It returns None
if the current Uploader
is NoOp
.
fn readme_location(&self, crate_name: &str, version: &str) -> Option<String>
[src]
Returns the URL of an uploaded crate's version readme.
The function doesn't check for the existence of the file.
It returns None
if the current Uploader
is NoOp
.
fn crate_path(name: &str, version: &str) -> String
[src]
Returns the interna path of an uploaded crate's version archive.
fn readme_path(name: &str, version: &str) -> String
[src]
Returns the interna path of an uploaded crate's version readme.
fn upload(
&self,
handle: Easy,
path: &str,
body: &mut Read,
content_type: &str,
content_length: u64
) -> CargoResult<(Option<String>, Vec<u8>)>
[src]
&self,
handle: Easy,
path: &str,
body: &mut Read,
content_type: &str,
content_length: u64
) -> CargoResult<(Option<String>, Vec<u8>)>
Uploads a file using the configured uploader (either S3
, Local
or NoOp
).
It returns a a tuple containing the path of the uploaded file and its checksum.
fn upload_crate(
&self,
req: &mut Request,
krate: &Crate,
readme: Option<String>,
max: u64,
vers: &Version
) -> CargoResult<(Vec<u8>, Bomb, Bomb)>
[src]
&self,
req: &mut Request,
krate: &Crate,
readme: Option<String>,
max: u64,
vers: &Version
) -> CargoResult<(Vec<u8>, Bomb, Bomb)>
Uploads a crate and its readme. Returns the checksum of the uploaded crate file, and bombs for the uploaded crate and the uploaded readme.
fn delete(&self, app: Arc<App>, path: &str) -> CargoResult<()>
[src]
Deletes an uploaded file.
Trait Implementations
impl Clone for Uploader
[src]
fn clone(&self) -> Uploader
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more