XU XUv0.8.8
EN

API

#github.com/xulang-org/packages/s3

import: s3 #github.com/xulang-org/packages/s3

counts: 7 函数, 21 方法, 3 类型, 0 常量, 0 方法集

扩展包 `s3 #github.com/xulang-org/packages/s3`,由模块 github.com/xulang-org/packages 提供。

github.com/xulang-org/packages · 0.1.1 · 安装与使用

open

XuAPI
pub fn open(endpoint string, access_key string, secret_key string, region string) Client

用途

打开。

参数

endpoint string
endpoint(string)
access_key string
access_key(string)
secret_key string
secret_key(string)
region string
region(string)

返回

Client — 该类型的值

open_pool

XuAPI
pub fn open_pool(endpoint string, access_key string, secret_key string, region string, max_idle int) Pool

用途

打开pool。

参数

endpoint string
endpoint(string)
access_key string
access_key(string)
secret_key string
secret_key(string)
region string
region(string)
max_idle int
max_idle(int)

返回

Pool — 该类型的值

(&mut Client) make_bucket

XuAPI
pub fn (c &mut Client) make_bucket(bucket string) int

用途

`&mut Client` 上的方法:makebucket。失败时 throw。

参数

c &mut Client
接收者 &mut Client(可变借用)
bucket string
bucket(string)

返回

int — 该类型的值

(&mut Client) bucket_exists

XuAPI
pub fn (c &mut Client) bucket_exists(bucket string) bool

用途

`&mut Client` 上的方法:bucketexists。

参数

c &mut Client
接收者 &mut Client(可变借用)
bucket string
bucket(string)

返回

bool — 是否成立

(&mut Client) remove_bucket

XuAPI
pub fn (c &mut Client) remove_bucket(bucket string) int

用途

`&mut Client` 上的方法:删除bucket。失败时 throw。

参数

c &mut Client
接收者 &mut Client(可变借用)
bucket string
bucket(string)

返回

int — 该类型的值

struct Response

XuAPI
pub struct Response {
    pub status_code int
    pub body string
}

用途

公开结构体 `Response`。

参数

status_code int
字段(int)
body string
正文

struct Client

XuAPI
pub struct Client {
    pub host string
    pub port int
    pub access_key string
    pub secret_key string
    pub region string
}

用途

公开结构体 `Client`。

参数

host string
主机
port int
端口
access_key string
字段(string)
secret_key string
字段(string)
region string
字段(string)

new_client

XuAPI
pub fn new_client(endpoint string, access_key string, secret_key string, region string) Client

用途

构造 client。

参数

endpoint string
endpoint(string)
access_key string
access_key(string)
secret_key string
secret_key(string)
region string
region(string)

返回

Client — 该类型的值

(&mut Client) request

XuAPI
pub fn (c &mut Client) request(method string, path string, body string, content_type string) Response

用途

`&mut Client` 上的方法:请求。失败时 throw。

参数

c &mut Client
接收者 &mut Client(可变借用)
method string
method(string)
path string
文件系统路径(string)
body string
正文(string)
content_type string
content_type(string)

返回

Response — 该类型的值

(&mut Client) put_object

XuAPI
pub fn (c &mut Client) put_object(bucket string, key string, data string, content_type string) int

用途

`&mut Client` 上的方法:putobject。失败时 throw。

参数

c &mut Client
接收者 &mut Client(可变借用)
bucket string
bucket(string)
key string
键(string)
data string
数据(string)
content_type string
content_type(string)

返回

int — 该类型的值

(&mut Client) get_object

XuAPI
pub fn (c &mut Client) get_object(bucket string, key string) string

用途

`&mut Client` 上的方法:读取 object。失败时 throw。

参数

c &mut Client
接收者 &mut Client(可变借用)
bucket string
bucket(string)
key string
键(string)

返回

string — 结果字符串

(&mut Client) remove_object

XuAPI
pub fn (c &mut Client) remove_object(bucket string, key string) int

用途

`&mut Client` 上的方法:删除object。失败时 throw。

参数

c &mut Client
接收者 &mut Client(可变借用)
bucket string
bucket(string)
key string
键(string)

返回

int — 该类型的值

(&mut Client) object_exists

XuAPI
pub fn (c &mut Client) object_exists(bucket string, key string) bool

用途

`&mut Client` 上的方法:objectexists。

参数

c &mut Client
接收者 &mut Client(可变借用)
bucket string
bucket(string)
key string
键(string)

返回

bool — 是否成立

struct Pool

XuAPI
pub struct Pool {
    pub host string
    pub port int
    pub endpoint string
    pub access_key string
    pub secret_key string
    pub region string
    pub state chan pool.State
    pub max_idle int
}

用途

公开结构体 `Pool`。

参数

host string
主机
port int
端口
endpoint string
字段(string)
access_key string
字段(string)
secret_key string
字段(string)
region string
字段(string)
state chan pool.State
字段(通道;类型 chan pool.State)
max_idle int
字段(int)

new_pool

XuAPI
pub fn new_pool(endpoint string, access_key string, secret_key string, region string, max_idle int) Pool

用途

构造 pool。

参数

endpoint string
endpoint(string)
access_key string
access_key(string)
secret_key string
secret_key(string)
region string
region(string)
max_idle int
max_idle(int)

返回

Pool — 该类型的值

(&Pool) get

XuAPI
pub fn (p &Pool) get() Client

用途

在 `&Pool` 上调用 `get`。

参数

p &Pool
接收者 &Pool(借用)

返回

Client — 该类型的值

(&Pool) dup

XuAPI
pub fn (p &Pool) dup() Pool

用途

在 `&Pool` 上调用 `dup`。

参数

p &Pool
接收者 &Pool(借用)

返回

Pool — 该类型的值

(&Pool) get_conn

XuAPI
pub fn (p &Pool) get_conn() int

用途

`&Pool` 上的方法:读取 conn。

参数

p &Pool
接收者 &Pool(借用)

返回

int — 该类型的值

(&Pool) put_conn

XuAPI
pub fn (p &Pool) put_conn(fd int)

用途

`&Pool` 上的方法:put连接。

参数

p &Pool
接收者 &Pool(借用)
fd int
文件描述符(int)

(&Pool) discard_conn

XuAPI
pub fn (p &Pool) discard_conn(fd int)

用途

`&Pool` 上的方法:丢弃连接。

参数

p &Pool
接收者 &Pool(借用)
fd int
文件描述符(int)

(&Pool) make_bucket

XuAPI
pub fn (p &Pool) make_bucket(bucket string) int

用途

`&Pool` 上的方法:makebucket。失败时 throw。

参数

p &Pool
接收者 &Pool(借用)
bucket string
bucket(string)

返回

int — 该类型的值

(&Pool) bucket_exists

XuAPI
pub fn (p &Pool) bucket_exists(bucket string) bool

用途

`&Pool` 上的方法:bucketexists。

参数

p &Pool
接收者 &Pool(借用)
bucket string
bucket(string)

返回

bool — 是否成立

(&Pool) remove_bucket

XuAPI
pub fn (p &Pool) remove_bucket(bucket string) int

用途

`&Pool` 上的方法:删除bucket。失败时 throw。

参数

p &Pool
接收者 &Pool(借用)
bucket string
bucket(string)

返回

int — 该类型的值

(&Pool) put_object

XuAPI
pub fn (p &Pool) put_object(bucket string, key string, data string, content_type string) int

用途

`&Pool` 上的方法:putobject。失败时 throw。

参数

p &Pool
接收者 &Pool(借用)
bucket string
bucket(string)
key string
键(string)
data string
数据(string)
content_type string
content_type(string)

返回

int — 该类型的值

(&Pool) get_object

XuAPI
pub fn (p &Pool) get_object(bucket string, key string) string

用途

`&Pool` 上的方法:读取 object。失败时 throw。

参数

p &Pool
接收者 &Pool(借用)
bucket string
bucket(string)
key string
键(string)

返回

string — 结果字符串

(&Pool) remove_object

XuAPI
pub fn (p &Pool) remove_object(bucket string, key string) int

用途

`&Pool` 上的方法:删除object。失败时 throw。

参数

p &Pool
接收者 &Pool(借用)
bucket string
bucket(string)
key string
键(string)

返回

int — 该类型的值

(&Pool) object_exists

XuAPI
pub fn (p &Pool) object_exists(bucket string, key string) bool

用途

`&Pool` 上的方法:objectexists。

参数

p &Pool
接收者 &Pool(借用)
bucket string
bucket(string)
key string
键(string)

返回

bool — 是否成立

(&Pool) close

XuAPI
pub fn (p &Pool) close()

用途

`&Pool` 上的方法:关闭资源。

参数

p &Pool
接收者 &Pool(借用)

sha256_hex

XuAPI
pub fn sha256_hex(data string) string

用途

SHA-256十六进制。

参数

data string
数据(string)

返回

string — 结果字符串

hmac_hex

XuAPI
pub fn hmac_hex(key string, data string) string

用途

HMAC十六进制。

参数

key string
键(string)
data string
数据(string)

返回

string — 结果字符串

compute_auth_header

XuAPI
pub fn compute_auth_header( method string, path string, host string, access_key string, secret_key string, region string, amz_date string, date_stamp string, payload_hash string ) string

用途

computeauth头。

参数

method string
method(string)
path string
文件系统路径(string)
host string
主机(string)
access_key string
access_key(string)
secret_key string
secret_key(string)
region string
region(string)
amz_date string
amz_date(string)
date_stamp string
date_stamp(string)
payload_hash string
payload_hash(string)

返回

string — 结果字符串