S3: better testing, stat is semi-fake, other functions aren't.
parent
4f7350dc6a
commit
a12ed015a6
|
@ -94,7 +94,9 @@ static void def_file_name(s3_options_t * o, char * out_name, char const * path){
|
|||
|
||||
static void def_bucket_name(s3_options_t * o, char * out_name, char const * path){
|
||||
// S3_MAX_BUCKET_NAME_SIZE
|
||||
out_name += sprintf(out_name, "%s-", o->bucket_prefix_cur);
|
||||
if(o->bucket_per_file){
|
||||
out_name += sprintf(out_name, "%s-", o->bucket_prefix_cur);
|
||||
}
|
||||
// duplicate path except "/"
|
||||
while(*path != 0){
|
||||
char c = *path;
|
||||
|
@ -215,6 +217,7 @@ static aiori_fd_t *S3_Create(char *path, int iorflags, aiori_mod_opt_t * options
|
|||
s3_options_t * o = (s3_options_t*) options;
|
||||
char p[FILENAME_MAX];
|
||||
def_file_name(o, p, path);
|
||||
|
||||
|
||||
if(iorflags & IOR_CREAT){
|
||||
if(o->bucket_per_file){
|
||||
|
@ -314,8 +317,7 @@ static IOR_offset_t S3_Xfer(int access, aiori_fd_t * afd, IOR_size_t * buffer, I
|
|||
}else{
|
||||
sprintf(p, "%s", fd->object);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(access == WRITE){
|
||||
S3_put_object(& o->bucket_context, p, length, NULL, NULL, o->timeout, &putObjectHandler, & dh);
|
||||
}else{
|
||||
|
@ -361,19 +363,20 @@ static void S3_Delete(char *path, aiori_mod_opt_t * options)
|
|||
s3_options_t * o = (s3_options_t*) options;
|
||||
char p[FILENAME_MAX];
|
||||
def_file_name(o, p, path);
|
||||
|
||||
|
||||
if(o->bucket_per_file){
|
||||
o->bucket_context.bucketName = p;
|
||||
s3_delete_req req = {0, o, 1, NULL};
|
||||
while(req.truncated){
|
||||
s3_delete_req req = {0, o, 0, NULL};
|
||||
do{
|
||||
S3_list_bucket(& o->bucket_context, NULL, req.nextMarker, NULL, INT_MAX, NULL, o->timeout, & list_delete_handler, & req);
|
||||
}
|
||||
}while(req.truncated);
|
||||
S3_delete_bucket(o->s3_protocol, S3UriStylePath, o->access_key, o->secret_key, NULL, o->host, p, o->authRegion, NULL, o->timeout, & responseHandler, NULL);
|
||||
}else{
|
||||
s3_delete_req req = {0, o, 1, NULL};
|
||||
while(req.truncated){
|
||||
s3_delete_req req = {0, o, 0, NULL};
|
||||
do{
|
||||
S3_list_bucket(& o->bucket_context, p, req.nextMarker, NULL, INT_MAX, NULL, o->timeout, & list_delete_handler, & req);
|
||||
}
|
||||
}while(req.truncated);
|
||||
S3_delete_object(& o->bucket_context, p, NULL, o->timeout, & responseHandler, NULL);
|
||||
}
|
||||
CHECK_ERROR(p);
|
||||
|
@ -382,8 +385,9 @@ static void S3_Delete(char *path, aiori_mod_opt_t * options)
|
|||
static int S3_mkdir (const char *path, mode_t mode, aiori_mod_opt_t * options){
|
||||
s3_options_t * o = (s3_options_t*) options;
|
||||
char p[FILENAME_MAX];
|
||||
|
||||
def_bucket_name(o, p, path);
|
||||
|
||||
|
||||
if (o->bucket_per_file){
|
||||
S3_create_bucket(o->s3_protocol, o->access_key, o->secret_key, NULL, o->host, p, o->authRegion, S3CannedAclPrivate, o->locationConstraint, NULL, o->timeout, & responseHandler, NULL);
|
||||
CHECK_ERROR(p);
|
||||
|
@ -402,14 +406,8 @@ static int S3_rmdir (const char *path, aiori_mod_opt_t * options){
|
|||
s3_options_t * o = (s3_options_t*) options;
|
||||
char p[FILENAME_MAX];
|
||||
|
||||
def_bucket_name(o, p, path);
|
||||
def_bucket_name(o, p, path);
|
||||
if (o->bucket_per_file){
|
||||
o->bucket_context.bucketName = p;
|
||||
s3_delete_req req = {0, o, 1, NULL};
|
||||
while(req.truncated){
|
||||
S3_list_bucket(& o->bucket_context, req.nextMarker, NULL, NULL, INT_MAX, NULL, o->timeout, & list_delete_handler, & req);
|
||||
}
|
||||
|
||||
S3_delete_bucket(o->s3_protocol, S3UriStylePath, o->access_key, o->secret_key, NULL, o->host, p, o->authRegion, NULL, o->timeout, & responseHandler, NULL);
|
||||
CHECK_ERROR(p);
|
||||
return 0;
|
||||
|
@ -425,7 +423,7 @@ static int S3_stat(const char *path, struct stat *buf, aiori_mod_opt_t * options
|
|||
char p[FILENAME_MAX];
|
||||
def_file_name(o, p, path);
|
||||
memset(buf, 0, sizeof(struct stat));
|
||||
// TODO count the individual file fragment sizes together
|
||||
// TODO count the individual file fragment sizes together
|
||||
if (o->bucket_per_file){
|
||||
S3_test_bucket(o->s3_protocol, S3UriStylePath, o->access_key, o->secret_key,
|
||||
NULL, o->host, p, o->authRegion, 0, NULL,
|
||||
|
|
|
@ -22,10 +22,12 @@ source $ROOT/test-lib.sh
|
|||
|
||||
I=100 # Start with this ID
|
||||
IOR 2 -a S3-libs3 --S3.host=localhost:9000 --S3.secret-key=secretkey --S3.access-key=accesskey -b $((10*1024*1024)) -t $((10*1024*1024))
|
||||
MDTEST 2 -a S3-libs3 --S3.host=localhost:9000 --S3.secret-key=secretkey --S3.access-key=accesskey -n 10
|
||||
MDTEST 2 -a S3-libs3 -L --S3.host=localhost:9000 --S3.secret-key=secretkey --S3.access-key=accesskey -n 10
|
||||
MDTEST 2 -a S3-libs3 --S3.host=localhost:9000 --S3.secret-key=secretkey --S3.access-key=accesskey -n 5 -w 1024 -e 1024
|
||||
|
||||
IOR 1 -a S3-libs3 --S3.host=localhost:9000 --S3.secret-key=secretkey --S3.access-key=accesskey -b $((10*1024)) -t $((10*1024)) --S3.bucket-per-file
|
||||
MDTEST 1 -a S3-libs3 --S3.host=localhost:9000 --S3.secret-key=secretkey --S3.access-key=accesskey --S3.bucket-per-file -n 10
|
||||
MDTEST 1 -a S3-libs3 -L --S3.host=localhost:9000 --S3.secret-key=secretkey --S3.access-key=accesskey --S3.bucket-per-file -n 5
|
||||
MDTEST 1 -a S3-libs3 --S3.host=localhost:9000 --S3.secret-key=secretkey --S3.access-key=accesskey --S3.bucket-per-file -n 10 -w 1024 -e 1024
|
||||
|
||||
|
||||
kill -9 %1
|
||||
|
|
Loading…
Reference in New Issue