-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfileserver.h
More file actions
91 lines (84 loc) · 2.8 KB
/
Copy pathfileserver.h
File metadata and controls
91 lines (84 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* Copyright (c) 2011-2026 Cisco Systems, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
/** @file fileserver.h
* Dispatcher-next HTTP(S) fileserver block transport.
*/
#ifndef RAZORBACK_FILESERVER_H
#define RAZORBACK_FILESERVER_H
#include <razorback/types.h>
#include <razorback/visibility.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct RzbNextFileserverClient RzbNextFileserverClient_t;
enum RzbNextFileserverStatus
{
RZB_NEXT_FILESERVER_OK = 0,
RZB_NEXT_FILESERVER_LOCAL_ERROR = 1,
RZB_NEXT_FILESERVER_NOT_FOUND = 2,
RZB_NEXT_FILESERVER_RETRYABLE = 3,
RZB_NEXT_FILESERVER_HTTP_ERROR = 4,
RZB_NEXT_FILESERVER_PAYLOAD_MISMATCH = 5
};
SO_PUBLIC extern RzbNextFileserverClient_t * RzbNextFileserverClient_Create(
const char *baseUrl,
uint64_t fetchTimeoutSeconds,
uint64_t uploadTimeoutSeconds
);
SO_PUBLIC extern void RzbNextFileserverClient_Destroy(
RzbNextFileserverClient_t *client
);
SO_PUBLIC extern enum RzbNextFileserverStatus RzbNextFileserver_BuildUrl(
const RzbNextFileserverClient_t *client,
const struct BlockId *blockId,
char **url
);
SO_PUBLIC extern enum RzbNextFileserverStatus RzbNextFileserver_StoreFile(
RzbNextFileserverClient_t *client,
const struct BlockId *blockId,
const char *fileName
);
SO_PUBLIC extern enum RzbNextFileserverStatus RzbNextFileserver_StoreBytes(
RzbNextFileserverClient_t *client,
const struct BlockId *blockId,
const uint8_t *data,
size_t length
);
SO_PUBLIC extern enum RzbNextFileserverStatus RzbNextFileserver_StoreBlockPoolItem(
RzbNextFileserverClient_t *client,
struct BlockPoolItem *item
);
SO_PUBLIC extern enum RzbNextFileserverStatus RzbNextFileserver_FetchToFile(
RzbNextFileserverClient_t *client,
const struct BlockId *blockId,
char **fileName
);
SO_PUBLIC extern enum RzbNextFileserverStatus RzbNextFileserver_FetchBlock(
RzbNextFileserverClient_t *client,
struct Block *block
);
SO_PUBLIC extern bool RzbNextFileserver_AttachFileToBlock(
struct Block *block,
char *fileName,
bool tempFile
);
SO_PUBLIC extern void RzbNextFileserver_FreeBlockData(struct Block *block);
#ifdef __cplusplus
}
#endif
#endif /* RAZORBACK_FILESERVER_H */