Skip to content

Commit

Permalink
support ArchiveIR (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
bachue authored Dec 6, 2023
1 parent 2617965 commit 751ebd7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
uses: lukka/[email protected]
with:
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgGitCommitId: 'acc3bcf76b84ae5041c86ab55fe138ae7b8255c7'
vcpkgGitCommitId: 'a42af01b72c28a8e1d7b48107b33e4f286a55ef6'
vcpkgJsonGlob: 'vcpkg.json'
- name: Cmake
uses: lukka/run-cmake@v3
Expand Down
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 751ebd7

Please sign in to comment.