Skip to content

Commit

Permalink
support ArchiveIR
Browse files Browse the repository at this point in the history
  • Loading branch information
bachue committed Nov 23, 2023
1 parent 2617965 commit f3bf981
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
36 changes: 21 additions & 15 deletions qiniu/rs.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,18 +382,21 @@ Qiniu_Error Qiniu_RS_ChangeType(Qiniu_Client *self, const char *bucket, const ch
char *fileTypeStr = NULL, buf[4] = {0};
switch (fileType)
{
case 0:
case QINIU_FILE_TYPE_STANDARD:
fileTypeStr = "0";
break;
case 1:
case QINIU_FILE_TYPE_IA:
fileTypeStr = "1";
break;
case 2:
case QINIU_FILE_TYPE_ARCHIVE:
fileTypeStr = "2";
break;
case 3:
case QINIU_FILE_TYPE_DEEP_ARCHIVE:
fileTypeStr = "3";
break;
case QINIU_FILE_TYPE_ARCHIVE_IR:
fileTypeStr = "4";
break;
default:
snprintf(buf, sizeof(buf), "%d", fileType);
fileTypeStr = &buf[0];
Expand Down Expand Up @@ -909,28 +912,31 @@ Qiniu_Error Qiniu_RS_BatchChangeType(Qiniu_Client *self, Qiniu_RS_BatchItemRet *
entryURI = Qiniu_String_Concat3(entry->bucket, ":", entry->key);
entryURIEncoded = Qiniu_String_Encode(entryURI);

char *entryType = NULL, buf[4] = {0};
char *fileType = NULL, buf[4] = {0};
switch (entry->fileType)
{
case 0:
entryType = "0";
case QINIU_FILE_TYPE_STANDARD:
fileType = "0";
break;
case QINIU_FILE_TYPE_IA:
fileType = "1";
break;
case 1:
entryType = "1";
case QINIU_FILE_TYPE_ARCHIVE:
fileType = "2";
break;
case 2:
entryType = "2";
case QINIU_FILE_TYPE_DEEP_ARCHIVE:
fileType = "3";
break;
case 3:
entryType = "3";
case QINIU_FILE_TYPE_ARCHIVE_IR:
fileType = "4";
break;
default:
snprintf(buf, sizeof(buf), "%d", entry->fileType);
entryType = &buf[0];
fileType = &buf[0];
break;
}

bodyPart = Qiniu_String_Concat(entryURIEncoded, "/type/", entryType, NULL);
bodyPart = Qiniu_String_Concat(entryURIEncoded, "/type/", fileType, NULL);
opBody = Qiniu_String_Concat2("op=/chtype/", bodyPart);
Qiniu_Free(entryURI);
Qiniu_Free(entryURIEncoded);
Expand Down
8 changes: 8 additions & 0 deletions qiniu/rs.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ extern "C"
{
#endif

/*============================================================================*/

#define QINIU_FILE_TYPE_STANDARD 0
#define QINIU_FILE_TYPE_IA 1
#define QINIU_FILE_TYPE_ARCHIVE 2
#define QINIU_FILE_TYPE_DEEP_ARCHIVE 3
#define QINIU_FILE_TYPE_ARCHIVE_IR 4

/*============================================================================*/
/* type PutPolicy, GetPolicy */

Expand Down

0 comments on commit f3bf981

Please sign in to comment.