Skip to content

Commit

Permalink
Factored out all requests in separate files in the iproto/requests
Browse files Browse the repository at this point in the history
  • Loading branch information
igorcoding committed Jun 19, 2022
1 parent a35883d commit 4880686
Show file tree
Hide file tree
Showing 40 changed files with 1,216 additions and 1,081 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ ENV/
*.xlog
*.xctl
protocol.c
protocol.cpp
protocol.h
asynctnt/iproto/*.html
asynctnt/**/*.html
__tnt*
!third_party/**/*
vinyl.meta
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ all: build


clean:
rm -rf asynctnt/*.c asynctnt/*.h
rm -rf asynctnt/*.c asynctnt/*.h asynctnt/*.cpp
rm -rf asynctnt/*.so asynctnt/*.html
rm -rf asynctnt/iproto/*.c asynctnt/iproto/*.h
rm -rf asynctnt/iproto/*.so asynctnt/iproto/*.html
rm -rf asynctnt/iproto/*.so asynctnt/iproto/*.html asynctnt/iproto/requests/*.html
rm -rf build *.egg-info .eggs dist
find . -name '__pycache__' | xargs rm -rf
rm -rf htmlcov
Expand Down
75 changes: 23 additions & 52 deletions asynctnt/iproto/buffer.pxd
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from libc.stdint cimport uint32_t, uint64_t, int64_t


cdef class WriteBuffer:
cdef:
# Preallocated small buffer
Expand All @@ -14,61 +13,33 @@ cdef class WriteBuffer:

bytes _encoding

ssize_t __op_offset
ssize_t __sync_offset
ssize_t __schema_id_offset

@staticmethod
cdef WriteBuffer new(bytes encoding)
cdef WriteBuffer create(bytes encoding)

cdef inline _check_readonly(self)
cdef inline len(self)
cdef void ensure_allocated(self, ssize_t extra_length) except *
cdef int ensure_allocated(self, ssize_t extra_length) except -1
cdef char *_ensure_allocated(self, char *p,
ssize_t extra_length) except NULL
cdef void _reallocate(self, ssize_t new_size) except *
cdef void write_buffer(self, WriteBuffer buf) except *
cdef void write_header(self, uint64_t sync,
tarantool.iproto_type op,
int64_t schema_id) except *
cdef void change_schema_id(self, int64_t new_schema_id)
ssize_t extra_length) except NULL
cdef int _reallocate(self, ssize_t new_size) except -1
cdef int write_buffer(self, WriteBuffer buf) except -1
cdef int write_header(self, uint64_t sync,
tarantool.iproto_type op,
int64_t schema_id) except -1
cdef void write_length(self)

cdef char *_encode_nil(self, char *p) except NULL
cdef char *_encode_bool(self, char *p, bint value) except NULL
cdef char *_encode_double(self, char *p, double value) except NULL
cdef char *_encode_uint(self, char *p, uint64_t value) except NULL
cdef char *_encode_int(self, char *p, int64_t value) except NULL
cdef char *_encode_str(self, char *p,
const char *str, uint32_t len) except NULL
cdef char *_encode_bin(self, char *p,
const char *data, uint32_t len) except NULL
cdef char *_encode_array(self, char *p, uint32_t len) except NULL
cdef char *_encode_map(self, char *p, uint32_t len) except NULL
cdef char *_encode_list(self, char *p, list arr) except NULL
cdef char *_encode_tuple(self, char *p, tuple t) except NULL
cdef char *_encode_dict(self, char *p, dict d) except NULL
cdef char *_encode_key_sequence(self, char *p, t,
TntFields fields=*,
bint default_none=*) except NULL
cdef char *_encode_obj(self, char *p, object o) except NULL
cdef char *_encode_update_ops(self, char *p, list operations,
SchemaSpace space) except NULL

cdef void encode_request_call(self, str func_name, args) except *
cdef void encode_request_eval(self, str expression, args) except *
cdef void encode_request_select(self, SchemaSpace space, SchemaIndex index,
key, uint64_t offset, uint64_t limit,
uint32_t iterator) except *
cdef void encode_request_insert(self, SchemaSpace space, t) except *
cdef void encode_request_delete(self, SchemaSpace space, SchemaIndex index,
key) except *
cdef void encode_request_update(self, SchemaSpace space, SchemaIndex index,
key_tuple, list operations,
bint is_upsert=*) except *
cdef void encode_request_upsert(self, SchemaSpace space,
t, list operations) except *
cdef void encode_request_sql(self, str query, args) except *
cdef void encode_request_auth(self,
bytes username,
bytes scramble) except *
cdef char *mp_encode_nil(self, char *p) except NULL
cdef char *mp_encode_bool(self, char *p, bint value) except NULL
cdef char *mp_encode_double(self, char *p, double value) except NULL
cdef char *mp_encode_uint(self, char *p, uint64_t value) except NULL
cdef char *mp_encode_int(self, char *p, int64_t value) except NULL
cdef char *mp_encode_str(self, char *p,
const char *str, uint32_t len) except NULL
cdef char *mp_encode_bin(self, char *p,
const char *data, uint32_t len) except NULL
cdef char *mp_encode_array(self, char *p, uint32_t len) except NULL
cdef char *mp_encode_map(self, char *p, uint32_t len) except NULL
cdef char *mp_encode_list(self, char *p, list arr) except NULL
cdef char *mp_encode_tuple(self, char *p, tuple t) except NULL
cdef char *mp_encode_dict(self, char *p, dict d) except NULL
cdef char *mp_encode_obj(self, char *p, object o) except NULL
Loading

0 comments on commit 4880686

Please sign in to comment.