Skip to content

Commit

Permalink
Replace headers with annotations in Parse/Execute
Browse files Browse the repository at this point in the history
  • Loading branch information
fantix committed Nov 25, 2024
1 parent 2a9ebc3 commit 0836003
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
2 changes: 2 additions & 0 deletions edb/server/protocol/binary.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ cdef class EdgeConnection(frontend.FrontendConnection):
cdef inline reject_headers(self)
cdef inline ignore_headers(self)
cdef dict parse_headers(self)
cdef dict parse_annotations(self)
cdef inline ignore_annotations(self)

cdef write_status(self, bytes name, bytes value)
cdef write_edgedb_error(self, exc)
Expand Down
35 changes: 33 additions & 2 deletions edb/server/protocol/binary.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,31 @@ cdef class EdgeConnection(frontend.FrontendConnection):
self.buffer.read_len_prefixed_bytes()
num_fields -= 1

cdef dict parse_annotations(self):
cdef:
dict annos
uint16_t num_annos
str name, value

annos = {}
num_annos = <uint16_t>self.buffer.read_int16()
while num_annos:
name = self.buffer.read_len_prefixed_utf8()
value = self.buffer.read_len_prefixed_utf8()
annos[name] = value
num_annos -= 1
return annos

cdef inline ignore_annotations(self):
cdef:
uint16_t num_annos

num_annos = <uint16_t>self.buffer.read_int16()
while num_annos:
self.buffer.read_len_prefixed_bytes()
self.buffer.read_len_prefixed_bytes()
num_annos -= 1

#############

cdef WriteBuffer make_negotiate_protocol_version_msg(
Expand Down Expand Up @@ -883,7 +908,10 @@ cdef class EdgeConnection(frontend.FrontendConnection):

self._last_anon_compiled = None

self.ignore_headers()
if self.protocol_version >= (3, 0):
self.ignore_annotations()
else:
self.ignore_headers()

_dbview = self.get_dbview()
if _dbview.get_state_serializer() is None:
Expand Down Expand Up @@ -913,7 +941,10 @@ cdef class EdgeConnection(frontend.FrontendConnection):
bytes args
uint64_t allow_capabilities

self.ignore_headers()
if self.protocol_version >= (3, 0):
self.ignore_annotations()
else:
self.ignore_headers()

_dbview = self.get_dbview()
if _dbview.get_state_serializer() is None:
Expand Down

0 comments on commit 0836003

Please sign in to comment.