Benvenuto nel sito Assistenza

  Servizio Clienti per non udenti  

Cloud Storage - Funzionamento API

S3 request builder API
Queste API permettono di sviluppare nuovi tipi di richiesta.

#include <droplet.h>

void dpl_req_free(dpl_req_t *req);

dpl_req_t *dpl_req_new(dpl_ctx_t *ctx);
void dpl_req_set_method(dpl_req_t *req, dpl_method_t method);
dpl_status_t dpl_req_set_bucket(dpl_req_t *req, char *bucket);
dpl_status_t dpl_req_set_resource(dpl_req_t *req, char *resource);
dpl_status_t dpl_req_set_subresource(dpl_req_t *req, char *subresource);
void dpl_req_add_behavior(dpl_req_t *req, u_int flags);
void dpl_req_rm_behavior(dpl_req_t *req, u_int flags);
void dpl_req_set_location_constraint(dpl_req_t *req, dpl_location_constraint_t location_constraint);
void dpl_req_set_canned_acl(dpl_req_t *req, dpl_canned_acl_t canned_acl);
void dpl_req_set_storage_class(dpl_req_t *req, dpl_storage_class_t storage_class);
void dpl_req_set_condition(dpl_req_t *req, dpl_condition_t *condition);
dpl_status_t dpl_req_set_cache_control(dpl_req_t *req, char *cache_control);
dpl_status_t dpl_req_set_content_disposition(dpl_req_t *req, char *content_disposition);
dpl_status_t dpl_req_set_content_encoding(dpl_req_t *req, char *content_encoding);
void dpl_req_set_chunk(dpl_req_t *req, dpl_chunk_t *chunk);
dpl_status_t dpl_req_add_metadatum(dpl_req_t *req, char *key, char *value);
dpl_status_t dpl_req_add_metadata(dpl_req_t *req, dpl_dict_t *metadata);
dpl_status_t dpl_req_set_content_type(dpl_req_t *req, char *content_type);
dpl_status_t dpl_add_metadata_to_headers(dpl_dict_t *metadata, dpl_dict_t *headers);
dpl_status_t dpl_get_metadata_from_headers(dpl_dict_t *headers, dpl_dict_t *metadata);
dpl_status_t dpl_add_condition_to_headers(dpl_condition_t *condition, dpl_dict_t *headers);
dpl_status_t dpl_make_signature(dpl_ctx_t *ctx, char *method, char *bucket, char *resource, char *subresource, dpl_dict_t *headers, char *buf, u_int len, u_int *lenp);
dpl_status_t dpl_req_build(dpl_req_t *req, dpl_dict_t *query_params, char *buf, int len, u_int *lenp);


S3 convenience API

Queste API permettono di eseguire le operazioni basilari come creare un bucket, un file, o una lista di bucket.

#include <droplet.h>

//operations on buckets
dpl_status_t dpl_list_all_my_buckets(dpl_ctx_t *ctx, dpl_vec_t **vecp);
dpl_status_t dpl_make_bucket(dpl_ctx_t *ctx, char *bucket, dpl_location_constraint_t location_constraint, dpl_canned_acl_t canned_acl);
dpl_status_t dpl_list_bucket(dpl_ctx_t *ctx, char *bucket, char *prefix, char *delimiter, dpl_vec_t **objectsp, dpl_vec_t **common_prefixesp);

//operation on S3 files
dpl_status_t dpl_put(dpl_ctx_t *ctx, char *bucket, char *resource, char *subresource, dpl_dict_t *metadata, dpl_canned_acl_t canned_acl, char *data_buf, u_int data_len);
dpl_status_t dpl_put_buffered(dpl_ctx_t *ctx, char *bucket, char *resource, char *subresource, dpl_dict_t *metadata, dpl_canned_acl_t canned_acl, u_int data_len, dpl_conn_t **connp);
dpl_status_t dpl_get(dpl_ctx_t *ctx, char *bucket, char *resource, char *subresource, dpl_condition_t *condition, char **data_bufp, u_int *data_lenp, dpl_dict_t **metadatap);
dpl_status_t dpl_get_buffered(dpl_ctx_t *ctx, char *bucket, char *resource, char *subresource, dpl_condition_t *condition, dpl_header_func_t header_func, dpl_buffer_func_t buffer_func, void *cb_arg);
dpl_status_t dpl_delete(dpl_ctx_t *ctx, char *bucket, char *resource, char *subresource);
dpl_status_t dpl_head(dpl_ctx_t *ctx, char *bucket, char *resource, char *subresource, dpl_condition_t *condition, dpl_dict_t **metadatap);

//pricing API
double dpl_price_storage(dpl_ctx_t *ctx, size_t size);
char *dpl_price_storage_str(dpl_ctx_t *ctx, size_t size);


S3 convenience API Vdir/Vfile API
Queste API consentono di specificare il percorso relativo e assoluto di un file con il delimitatore API da S3
In oltre permette di attivare la crittografia dei dati in ingresso e in uscita.


//manipulate virtual directories
dpl_status_t dpl_iname(dpl_ctx_t *ctx, char *bucket, dpl_ino_t ino, char *path, u_int path_len);
dpl_status_t dpl_namei(dpl_ctx_t *ctx, char *path, char *bucket, dpl_ino_t ino, dpl_ino_t *parent_inop, dpl_ino_t *obj_inop, dpl_ftype_t *obj_typep);
dpl_ino_t dpl_cwd(dpl_ctx_t *ctx, char *bucket);
dpl_status_t dpl_opendir(dpl_ctx_t *ctx, char *locator, void **dir_hdlp);
dpl_status_t dpl_readdir(void *dir_hdl, dpl_dirent_t *dirent);
int dpl_eof(void *dir_hdl);
void dpl_closedir(void *dir_hdl);
dpl_status_t dpl_chdir(dpl_ctx_t *ctx, char *locator);
dpl_status_t dpl_mkdir(dpl_ctx_t *ctx, char *locator);
dpl_status_t dpl_mknod(dpl_ctx_t *ctx, char *locator);
dpl_status_t dpl_rmdir(dpl_ctx_t *ctx, char *locator);

//manipulates vfiles
dpl_status_t dpl_close(dpl_vfile_t *vfile);
dpl_status_t dpl_openwrite(dpl_ctx_t *ctx, char *locator, u_int flags, dpl_dict_t *metadata, dpl_canned_acl_t canned_acl, u_int data_len, dpl_vfile_t **vfilep);
dpl_status_t dpl_write(dpl_vfile_t *vfile, char *buf, u_int len);
dpl_status_t dpl_openread(dpl_ctx_t *ctx, char *locator, u_int flags, dpl_condition_t *condition, dpl_buffer_func_t buffer_func, void *cb_arg, dpl_dict_t **metadatap);
dpl_status_t dpl_openread_range(dpl_ctx_t *ctx, char *locator, u_int flags, dpl_condition_t *condition, int start, int end, char **data_bufp, u_int *data_lenp, dpl_dict_t **metadatap);
dpl_status_t dpl_unlink(dpl_ctx_t *ctx, char *locator);
dpl_status_t dpl_getattr(dpl_ctx_t *ctx, char *locator, dpl_dict_t **metadatap);
dpl_status_t dpl_setattr(dpl_ctx_t *ctx, char *locator, dpl_dict_t *metadata);
dpl_status_t dpl_fgenurl(dpl_ctx_t *ctx, char *locator, time_t expires, char *buf, u_int len, u_int *lenp);
dpl_status_t dpl_fcopy(dpl_ctx_t *ctx, char *src_locator, char *dst_locator);