-
Notifications
You must be signed in to change notification settings - Fork 25
/
kv-store.h
61 lines (48 loc) · 2.18 KB
/
kv-store.h
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
#ifndef JS_COMPUTE_RUNTIME_KV_STORE_H
#define JS_COMPUTE_RUNTIME_KV_STORE_H
#include "builtin.h"
#include "builtins/request-response.h"
#include "host_interface/host_api.h"
#include "js-compute-builtins.h"
namespace builtins {
class KVStoreEntry final : public BuiltinImpl<KVStoreEntry> {
template <RequestOrResponse::BodyReadResult result_type>
static bool bodyAll(JSContext *cx, unsigned argc, JS::Value *vp);
static bool body_get(JSContext *cx, unsigned argc, JS::Value *vp);
static bool bodyUsed_get(JSContext *cx, unsigned argc, JS::Value *vp);
public:
static constexpr const char *class_name = "KVStoreEntry";
using Slots = RequestOrResponse::Slots;
static const JSFunctionSpec static_methods[];
static const JSPropertySpec static_properties[];
static const JSFunctionSpec methods[];
static const JSPropertySpec properties[];
static const unsigned ctor_length = 0;
static bool init_class(JSContext *cx, JS::HandleObject global);
static bool constructor(JSContext *cx, unsigned argc, JS::Value *vp);
static JSObject *create(JSContext *cx, host_api::HttpBody body_handle);
};
class KVStore final : public BuiltinImpl<KVStore> {
static bool delete_(JSContext *cx, unsigned argc, JS::Value *vp);
static bool get(JSContext *cx, unsigned argc, JS::Value *vp);
static bool put(JSContext *cx, unsigned argc, JS::Value *vp);
public:
static constexpr const char *class_name = "KVStore";
enum class Slots {
KVStore,
Count,
};
static const JSFunctionSpec static_methods[];
static const JSPropertySpec static_properties[];
static const JSFunctionSpec methods[];
static const JSPropertySpec properties[];
static const unsigned ctor_length = 1;
static bool init_class(JSContext *cx, JS::HandleObject global);
static bool constructor(JSContext *cx, unsigned argc, JS::Value *vp);
static bool process_pending_kv_store_lookup(JSContext *cx, int32_t handle,
JS::HandleObject context, JS::HandleObject promise);
static bool process_pending_kv_store_delete(JSContext *cx, int32_t handle,
JS::HandleObject context, JS::HandleObject promise);
};
} // namespace builtins
#endif