2020-09-21 19:19:18 +08:00
|
|
|
|
/*************************************************************************
|
|
|
|
|
|
> File Name: hos_hash.h
|
|
|
|
|
|
> Author: pxz
|
|
|
|
|
|
> Created Time: Fri 18 Sep 2020 05:00:04 PM CST
|
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|
#ifndef __HOS_HASH_H__
|
|
|
|
|
|
#define __HOS_HASH_H__
|
|
|
|
|
|
|
2020-10-19 15:35:16 +08:00
|
|
|
|
#include <aws/core/Aws.h>
|
2021-04-23 09:57:58 +08:00
|
|
|
|
//#include "hos_client.h"
|
2020-09-21 19:19:18 +08:00
|
|
|
|
#include "uthash.h"
|
|
|
|
|
|
|
2021-04-23 09:57:58 +08:00
|
|
|
|
typedef struct hos_fd_context_s
|
2020-09-21 19:19:18 +08:00
|
|
|
|
{
|
|
|
|
|
|
size_t fd;
|
|
|
|
|
|
int mode;
|
2021-04-23 09:57:58 +08:00
|
|
|
|
//hos_client_handle handle;
|
2020-11-11 11:20:19 +08:00
|
|
|
|
char *bucket;
|
|
|
|
|
|
char *object;
|
2020-09-21 19:19:18 +08:00
|
|
|
|
void *callback;
|
|
|
|
|
|
void *userdata;
|
2020-10-19 15:35:16 +08:00
|
|
|
|
std::shared_ptr<Aws::IOStream> cache;
|
2020-12-01 16:12:41 +08:00
|
|
|
|
size_t cache_count;
|
2020-10-19 15:35:16 +08:00
|
|
|
|
size_t position;
|
2020-11-11 11:20:19 +08:00
|
|
|
|
size_t recive_cnt;
|
2020-12-01 18:24:20 +08:00
|
|
|
|
long cache_rest;
|
2020-11-11 11:20:19 +08:00
|
|
|
|
int fd_status;
|
2020-12-01 16:12:41 +08:00
|
|
|
|
#define HOS_FD_FREE 0
|
|
|
|
|
|
#define HOS_FD_REGISTER 1
|
|
|
|
|
|
#define HOS_FD_INJECT 2
|
2021-04-23 09:57:58 +08:00
|
|
|
|
size_t overtime; //计算后的时间点,超过即inject fd
|
2020-11-11 11:20:19 +08:00
|
|
|
|
size_t timeout; //配置的超时时间,从status变成INJECT开始计时
|
2020-09-21 19:19:18 +08:00
|
|
|
|
UT_hash_handle hh;
|
2021-04-23 09:57:58 +08:00
|
|
|
|
}hos_fd_context_t;
|
2020-09-21 19:19:18 +08:00
|
|
|
|
|
2021-04-23 09:57:58 +08:00
|
|
|
|
void add_fd_context(hos_fd_context_t **handle, hos_fd_context_t *input);
|
|
|
|
|
|
hos_fd_context_t *find_context_by_fd(hos_fd_context_t *handle, size_t fd);
|
|
|
|
|
|
void delete_context_by_fd(hos_fd_context_t **handle, size_t fd);
|
|
|
|
|
|
void delete_all(hos_fd_context_t **handle);
|
2020-09-21 19:19:18 +08:00
|
|
|
|
#endif
|