Schema loading from the wire
Cap'n Proto provides a schema loader, which can be used to dynamically load schemas during runtime. To port this functionality to pycapnp, a new class is provided `C_SchemaLoader`, which exposes the Cap'n Proto C++ interface, and `SchemaLoader`, which is part of the pycapnp library. The specific use case for this is when a capnp message contains a Node.Reader: The schema for a yet unseen message can be loaded dynamically, allowing the future message to be properly processed. If the message is a struct containing other structs, all the schemas for every struct must be loaded to correctly parse the message. See https://github.com/DaneSlattery/capnp_generic_poc for a proof-of-concept. Add docs and cleanup Add more docs Reduce changes Fix flake8 formatting Fix get datatype
This commit is contained in:
committed by
DaneSlattery
parent
b439993b1f
commit
a5c29a74d2
@@ -446,6 +446,12 @@ cdef extern from "capnp/dynamic.h" namespace " ::capnp":
|
||||
DynamicStruct.Pipeline asStruct"releaseAs< ::capnp::DynamicStruct>"()
|
||||
Type getType()
|
||||
|
||||
cdef extern from "capnp/schema-loader.h" namespace " ::capnp":
|
||||
cdef cppclass SchemaLoader:
|
||||
SchemaLoader()
|
||||
Schema load(Node.Reader reader) except +reraise_kj_exception
|
||||
Schema get(uint64_t id_) except +reraise_kj_exception
|
||||
|
||||
cdef extern from "capnp/schema-parser.h" namespace " ::capnp":
|
||||
cdef cppclass ParsedSchema(Schema) nogil:
|
||||
ParsedSchema getNested(char * name) except +reraise_kj_exception
|
||||
|
||||
Reference in New Issue
Block a user