feat(lsm): store pointer to store in entry handle
This commit is contained in:
parent
d4b21fb84d
commit
eb0ce16f78
7 changed files with 23 additions and 59 deletions
|
|
@ -93,8 +93,6 @@ bool lander_get_entry_lsm(event_loop_conn *conn) {
|
|||
bool lander_stream_body_to_client(event_loop_conn *conn) {
|
||||
http_loop_ctx *ctx = conn->ctx;
|
||||
lander_ctx *c_ctx = ctx->c;
|
||||
http_loop_gctx *gctx = ctx->g;
|
||||
lander_gctx *c_gctx = gctx->c;
|
||||
|
||||
if ((c_ctx->entry == NULL) ||
|
||||
(ctx->res.body.expected_len == ctx->res.body.len)) {
|
||||
|
|
@ -105,8 +103,8 @@ bool lander_stream_body_to_client(event_loop_conn *conn) {
|
|||
ctx->res.body.expected_len - ctx->res.body.len);
|
||||
|
||||
uint64_t read = 0;
|
||||
lsm_entry_data_read(&read, (char *)&conn->wbuf[conn->wbuf_size],
|
||||
c_gctx->store, c_ctx->entry, to_write);
|
||||
lsm_entry_data_read(&read, (char *)&conn->wbuf[conn->wbuf_size], c_ctx->entry,
|
||||
to_write);
|
||||
|
||||
ctx->res.body.len += read;
|
||||
conn->wbuf_size += read;
|
||||
|
|
|
|||
|
|
@ -151,11 +151,9 @@ bool lander_post_redirect_body_to_attr(event_loop_conn *conn) {
|
|||
|
||||
bool lander_entry_sync(event_loop_conn *conn) {
|
||||
http_loop_ctx *ctx = conn->ctx;
|
||||
http_loop_gctx *gctx = ctx->g;
|
||||
lander_gctx *c_gctx = gctx->c;
|
||||
lander_ctx *c_ctx = ctx->c;
|
||||
|
||||
if (lsm_entry_sync(c_gctx->store, c_ctx->entry) != lsm_error_ok) {
|
||||
if (lsm_entry_sync(c_ctx->entry) != lsm_error_ok) {
|
||||
ctx->res.status = http_internal_server_error;
|
||||
}
|
||||
|
||||
|
|
@ -180,8 +178,6 @@ bool lander_post_paste_lsm(event_loop_conn *conn) {
|
|||
bool lander_stream_body_to_entry(event_loop_conn *conn) {
|
||||
http_loop_ctx *ctx = conn->ctx;
|
||||
lander_ctx *c_ctx = ctx->c;
|
||||
http_loop_gctx *gctx = ctx->g;
|
||||
lander_gctx *c_gctx = gctx->c;
|
||||
|
||||
uint64_t to_append =
|
||||
MIN(conn->rbuf_size - conn->rbuf_read,
|
||||
|
|
@ -189,7 +185,7 @@ bool lander_stream_body_to_entry(event_loop_conn *conn) {
|
|||
|
||||
lsm_str *data;
|
||||
lsm_str_init_copy_n(&data, (char *)&conn->rbuf[conn->rbuf_read], to_append);
|
||||
lsm_entry_data_append(c_gctx->store, c_ctx->entry, data);
|
||||
lsm_entry_data_append(c_ctx->entry, data);
|
||||
|
||||
conn->rbuf_read += to_append;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue