Skip to content

Commit 33c7dad

Browse files
author
hansdude
committed
Merge pull request #28 from hansdude/master
Added the S3 compatible GET and PUT commands back.
2 parents 8ee82dc + cd3050f commit 33c7dad

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/ds3.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,11 @@ ds3_request* ds3_init_get_bucket(const char* bucket_name) {
709709
return (ds3_request*) _common_request_init(HTTP_GET, _build_path("/", bucket_name, NULL));
710710
}
711711

712+
ds3_request* ds3_init_get_object(const char* bucket_name, const char* object_name) {
713+
struct _ds3_request* request = _common_request_init(HTTP_GET, _build_path("/", bucket_name, object_name));
714+
return (ds3_request*) request;
715+
}
716+
712717
ds3_request* ds3_init_get_object_for_job(const char* bucket_name, const char* object_name, uint64_t offset, const char* job_id) {
713718
char buff[21];
714719
struct _ds3_request* request = _common_request_init(HTTP_GET, _build_path("/", bucket_name, object_name));
@@ -725,6 +730,12 @@ ds3_request* ds3_init_delete_object(const char* bucket_name, const char* object_
725730
return (ds3_request*) _common_request_init(HTTP_DELETE, _build_path("/", bucket_name, object_name));
726731
}
727732

733+
ds3_request* ds3_init_put_object(const char* bucket_name, const char* object_name, uint64_t length) {
734+
struct _ds3_request* request = _common_request_init(HTTP_PUT, _build_path("/", bucket_name, object_name));
735+
request->length = length;
736+
return (ds3_request*) request;
737+
}
738+
728739
ds3_request* ds3_init_put_object_for_job(const char* bucket_name, const char* object_name, uint64_t offset, uint64_t length, const char* job_id) {
729740
struct _ds3_request* request = _common_request_init(HTTP_PUT, _build_path("/", bucket_name, object_name));
730741
char buff[21];

src/ds3.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,10 @@ LIBRARY_API ds3_error* ds3_create_client_from_env(ds3_client** client);
197197

198198
LIBRARY_API ds3_request* ds3_init_get_service(void);
199199
LIBRARY_API ds3_request* ds3_init_get_bucket(const char* bucket_name);
200+
LIBRARY_API ds3_request* ds3_init_get_object(const char* bucket_name, const char* object_name);
200201
LIBRARY_API ds3_request* ds3_init_get_object_for_job(const char* bucket_name, const char* object_name, uint64_t offset, const char* job_id);
201202
LIBRARY_API ds3_request* ds3_init_put_bucket(const char* bucket_name);
203+
LIBRARY_API ds3_request* ds3_init_put_object(const char* bucket_name, const char* object_name, uint64_t size);
202204
LIBRARY_API ds3_request* ds3_init_put_object_for_job(const char* bucket_name, const char* object_name, uint64_t offset, uint64_t length, const char* job_id);
203205
LIBRARY_API ds3_request* ds3_init_delete_bucket(const char* bucket_name);
204206
LIBRARY_API ds3_request* ds3_init_delete_object(const char* bucket_name, const char* object_name);

test/test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ void print_error(const ds3_error* error) {
3333
void handle_error(ds3_error* error) {
3434
if (error != NULL) {
3535
print_error(error);
36-
ds3_free_error(error);
3736
BOOST_FAIL("Test failed with a ds3_error");
37+
ds3_free_error(error);
3838
}
3939
}
4040

0 commit comments

Comments
 (0)