diff options
author | Bryan Ischo <bryan@ischo.com> | 2008-07-21 12:28:51 +0000 |
---|---|---|
committer | Bryan Ischo <bryan@ischo.com> | 2008-07-21 12:28:51 +0000 |
commit | 8a2f22506a4e3a8f07356aaa3a223428243acda4 (patch) | |
tree | 50a226caf30348afc47a227295f85511f2692c0d /inc | |
parent | 5b2d5978bfea855912ba38e32985cee8c0f35a89 (diff) | |
download | ceph-libs3-8a2f22506a4e3a8f07356aaa3a223428243acda4.tar.gz |
* Removed http response code from complete callback (libs3 users should only
care about the actual response code)
* Cleaned up some stuff
* Added S3_status_is_retryable
Diffstat (limited to 'inc')
-rw-r--r-- | inc/libs3.h | 27 | ||||
-rw-r--r-- | inc/request.h | 6 |
2 files changed, 26 insertions, 7 deletions
diff --git a/inc/libs3.h b/inc/libs3.h index 2a94eed..9973cee 100644 --- a/inc/libs3.h +++ b/inc/libs3.h @@ -134,7 +134,7 @@ typedef enum // Errors that prevent the S3 request from being issued or response from // being read - S3StatusFailure , + S3StatusInternalError , S3StatusOutOfMemory , S3StatusInterrupted , S3StatusFailedToCreateMutex , @@ -177,6 +177,10 @@ typedef enum S3StatusBadAclGrantee , S3StatusBadAclPermission , S3StatusAclXmlDocumentTooLarge , + S3StatusNameLookupError , + S3StatusFailedToConnect , + S3StatusConnectionFailed , + S3StatusAbortedByCallback , // Errors from the S3 service S3StatusErrorAccessDenied , @@ -343,6 +347,7 @@ typedef struct S3NameValue const char *value; } S3NameValue; + /** * S3ResponseProperties is passed to the properties callback function which is * called when the complete response status code and properties have been @@ -665,13 +670,13 @@ typedef void (S3MutexDestroyCallback)(struct S3Mutex *mutex); * @param callbackData is the callback data as specified when the S3Request * for which this callback was specified was initialized * @param properties is the properties that are available from the response. - * @return S3Status??? + * @return S3StatusOK to continue processing the request, anything else to + * immediately abort the request with that status **/ typedef S3Status (S3ResponsePropertiesCallback) (const S3ResponseProperties *properties, void *callbackData); typedef void (S3ResponseCompleteCallback)(S3Status status, - int httpResponseCode, const S3ErrorDetails *errorDetails, void *callbackData); @@ -740,7 +745,8 @@ typedef S3Status (S3ListBucketCallback)(int isTruncated, * in the bufferReturn parameter * @param bufferReturn returns the bext set of bytes to be written to the * service as the contents of the object being put - * @return S3Status??? + * @return < 0 to abort the request with S3StatusAbortedByCallback, + * 0 to indicate end of data, > 0 to add more data. **/ typedef int (S3PutObjectDataCallback)(int bufferSize, char *buffer, void *callbackData); @@ -758,6 +764,8 @@ typedef int (S3PutObjectDataCallback)(int bufferSize, char *buffer, * for which this callback was specified was initialized * @param bufferSize gives the number of bytes in buffer * @param buffer is the data being passed into the callback + * @return S3StatusOK to indicate success, anything else to abort the + * request immediately with that status **/ typedef S3Status (S3GetObjectDataCallback)(int bufferSize, const char *buffer, void *callbackData); @@ -853,6 +861,17 @@ S3Status S3_convert_acl(char *aclXml, char *ownerId, char *ownerDisplayName, int *aclGrantCountReturn, S3AclGrant *aclGrants); +/** + * Returns nonzero if the status indicates that the request should be + * immediately retried, because the error was of a nature that is likely due + * to transient conditions on the local system or S3, such as network + * failures, or internal retryable errors reported by S3. Returns zero + * otherwise. + * + * @param status is the status to evaluate + **/ +int S3_status_is_retryable(S3Status status); + /** ************************************************************************** * Request Context Management Functions diff --git a/inc/request.h b/inc/request.h index 50ebf56..1ca7ddf 100644 --- a/inc/request.h +++ b/inc/request.h @@ -135,9 +135,6 @@ typedef struct Request // libcurl requires that the uri be stored outside of the curl handle char uri[MAX_URI_SIZE + 1]; - // The HTTP response code that S3 sent back for this request - long httpResponseCode; - // Callback to be made when headers are available. Might not be called. S3ResponsePropertiesCallback *propertiesCallback; @@ -186,5 +183,8 @@ void request_perform(const RequestParams *params, S3RequestContext *context); // curl has finished the request void request_finish(Request *request); +// Convert a CURLE code to an S3Status +S3Status request_curl_code_to_status(CURLcode code); + #endif /* REQUEST_H */ |