Skip to content

Commit

Permalink
support dora idle tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
bachue committed Aug 22, 2024
1 parent 65f7cb8 commit 8435926
Show file tree
Hide file tree
Showing 34 changed files with 719 additions and 72 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## CHANGE LOG

## v7.8.0 (2024-08-20)

- 支持闲时任务

## v7.7.0 (2023-12-25)

- 支持归档直读存储类型
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CMAKE_POLICY(SET CMP0074 NEW)
SET(PROJECT_NAME qiniu)

# 建立项目
PROJECT(${PROJECT_NAME} VERSION 7.7.0 LANGUAGES C)
PROJECT(${PROJECT_NAME} VERSION 7.8.0 LANGUAGES C)

set(CMAKE_C_STANDARD 99)

Expand Down
43 changes: 41 additions & 2 deletions examples/fop_video_avthumb.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ int main(int argc, char **argv) {

char *fops[] = {avthumbMp4Fop, vframeJpgFop};

Qiniu_Error error = Qiniu_FOP_Pfop(&client, &pfopRet, bucket, key, fops, 2, pipeline, notifyURL, force);
Qiniu_FOP_PfopParams params = {
.bucket = bucket,
.key = key,
.pipeline = pipeline,
.notifyURL = notifyURL,
.fops = fops,
.fopCount = 2,
.force = force,
};
Qiniu_Error error = Qiniu_FOP_Pfop_v2(&client, &pfopRet, &params);
if (error.code != 200) {
printf("video file pfop %s:%s error.\n", bucket, key);
debug_log(&client, error);
Expand All @@ -52,7 +61,37 @@ int main(int argc, char **argv) {
printf("video file pfop %s:%s success, persistentId: %s .\n\n", bucket, key, pfopRet.persistentId);
}

Qiniu_FOP_PrefopRet prefopRet;
Qiniu_FOP_PrefopItemRet prefopItemRet[2];
Qiniu_ItemCount itemsCount;
error = Qiniu_FOP_Prefop(&client, &prefopRet, (Qiniu_FOP_PrefopItemRet *)&prefopItemRet, &itemsCount, pfopRet.persistentId, 2);
if (error.code != 200)
{
debug_log(&client, error);
}
else
{
printf("ID: %s\n", prefopRet.id);
printf("Code: %d\n", prefopRet.code);
printf("Desc: %s\n", prefopRet.desc);
printf("InputBucket: %s\n", prefopRet.inputBucket);
printf("InputKey: %s\n", prefopRet.inputKey);
printf("Type: %d\n", prefopRet.type);

for (Qiniu_ItemCount i = 0; i < itemsCount; i++)
{
printf("\tIndex: %d\n", i);
printf("\tCmd: %s\n", prefopItemRet[i].cmd);
printf("\tCode: %d\n", prefopItemRet[i].code);
printf("\tDesc: %s\n", prefopItemRet[i].desc);
printf("\tError: %s\n", prefopItemRet[i].error);
printf("\tHash: %s\n", prefopItemRet[i].hash);
printf("\tKey: %s\n", prefopItemRet[i].key);
printf("\tReturnOld: %d\n", prefopItemRet[i].returnOld);
}
}

Qiniu_Free(avthumbMp4Fop);
Qiniu_Free(vframeJpgFop);
Qiniu_Client_Cleanup(&client);
}
}
5 changes: 2 additions & 3 deletions qiniu/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static char *Qiniu_escape(const char *s, escapeMode mode, Qiniu_Bool *fesc)
{
int spaceCount = 0;
int hexCount = 0;
int i, j, len = strlen(s);
size_t i, j, len = strlen(s);
int c;
char *t;

Expand Down Expand Up @@ -674,8 +674,7 @@ Qiniu_Writer Qiniu_FILE_Writer(FILE *fp)
/*============================================================================*/
/* func Qiniu_Copy */

Qiniu_Error Qiniu_OK = {
200, "OK"};
Qiniu_Error Qiniu_OK = {200, "OK"};

Qiniu_Error Qiniu_Copy(Qiniu_Writer w, Qiniu_Reader r, void *buf, size_t n, Qiniu_Int64 *ret)
{
Expand Down
4 changes: 4 additions & 0 deletions qiniu/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ typedef off_t Qiniu_Off_T;

#endif

#if defined(_WIN32)
#pragma pack(1)
#endif

#ifdef __cplusplus
extern "C"
Expand Down Expand Up @@ -357,7 +359,9 @@ typedef struct stat Qiniu_FileInfo;

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

#if defined(_WIN32)
#pragma pack()
#endif

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion qiniu/base_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static ssize_t Qiniu_ReadBuf_ReadAt(Qiniu_ReadBuf *self, void *buf, size_t n, Qi
n = max & (~(size_t)0L);
}
memcpy(buf, self->buf + off, n);
return n;
return (ssize_t)n;
}

Qiniu_Reader Qiniu_BufReader(Qiniu_ReadBuf *self, const char *buf, size_t bytes)
Expand Down
4 changes: 2 additions & 2 deletions qiniu/cdn.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ char *Qiniu_CDN_CreateTimestampAntiLeechURL(const char *host, const char *fileNa
char *queryStrEscaped = NULL;

char expireHex[20];
sprintf(expireHex, "%0llx", deadline);
snprintf(expireHex, 20, "%0llx", deadline);

if (queryStr != NULL && strcmp("", queryStr) != 0) {
queryStrEscaped = Qiniu_PathEscape(queryStr, &queryStrEscapeOk);
Expand Down Expand Up @@ -611,4 +611,4 @@ void Qiniu_Free_CDNLogListRet(Qiniu_CDN_LogListRet *ret) {
}
Qiniu_Free(ret->data);
}
}
}
8 changes: 8 additions & 0 deletions qiniu/cdn.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
#include "macro.h"
#include "http.h"

#if defined(_WIN32)
#pragma pack(1)
#endif

#ifdef __cplusplus
extern "C"
{
Expand Down Expand Up @@ -164,6 +168,10 @@ QINIU_DLLAPI extern void Qiniu_Free_CDNLogListRet(Qiniu_CDN_LogListRet *ret);

//=====================================================================

#if defined(_WIN32)
#pragma pack()
#endif

#ifdef __cplusplus
}
#endif
Expand Down
8 changes: 8 additions & 0 deletions qiniu/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
#include "macro.h"
#include "base.h"

#if defined(_WIN32)
#pragma pack(1)
#endif

#ifdef __cplusplus
extern "C"
{
Expand Down Expand Up @@ -64,6 +68,10 @@ extern "C"
// 不再推荐使用,建议使用 Qiniu_Use_Region("cn-east-2") 方法替代
QINIU_DLLAPI extern void Qiniu_Use_Zone_Cn_East_2(Qiniu_Bool useHttps);

#if defined(_WIN32)
#pragma pack()
#endif

#ifdef __cplusplus
}
#endif
Expand Down
8 changes: 8 additions & 0 deletions qiniu/emu_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

#include "macro.h"

#if defined(_WIN32)
#pragma pack(1)
#endif

#ifdef __cplusplus
extern "C"
{
Expand Down Expand Up @@ -51,6 +55,10 @@ QINIU_DLLAPI extern char* Qiniu_Posix_strndup(const char *, size_t n);

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

#if defined(_WIN32)
#pragma pack()
#endif

#ifdef __cplusplus
}
#endif
Expand Down
Loading

0 comments on commit 8435926

Please sign in to comment.