# Path: zoonado/protocol/request.py
# class Request(Part):
#     """
#     Returns a bytesring representation of the request instance.
# 
#     # TODO(wglass): specify how xid and type preamble goes in
# 
#     Since this is a ``Part`` subclass the rest is a matter of
#     appending the result of a ``render()`` call.
#     """
#     opcode = None
#     special_xid = None
#     writes_data = False
# 
#     def serialize(self, xid=None):
#         buff = BytesIO()
# 
#         formats = []
#         data = []
# 
#         if xid is not None:
#             formats.append(Int.fmt)
#             data.append(xid)
# 
#         if self.opcode:
#             formats.append(Int.fmt)
#             data.append(self.opcode)
# 
#         payload_format, payload_data = self.render()
#         formats.append(payload_format)
#         data.extend(payload_data)
# 
#         buff.write(struct.pack("!" + "".join(formats), *data))
# 
#         return buff.getvalue()
# 
# Path: zoonado/protocol/response.py
# class Response(Part):
#     """
#     Base class for all operation response classes.
# 
#     A simple class, has only an ``opcode`` attribute expected to be defined by
#     subclasses, and a `deserialize()` classmethod.
#     """
#     opcode = None
# 
#     @classmethod
#     def deserialize(cls, raw_bytes):
#         """
#         Deserializes the given raw bytes into an instance.
# 
#         Since this is a subclass of ``Part`` but a top-level one (i.e. no other
#         subclass of ``Part`` would have a ``Response`` as a part) this merely
#         has to parse the raw bytes and discard the resulting offset.
#         """
#         instance, _ = cls.parse(raw_bytes, offset=0)
# 
#         return instance
# 
# Path: zoonado/protocol/stat.py
# class Stat(Part):
#     """
#     """
#     parts = (
#         ("created_zxid", Long),
#         ("last_modified_zxid", Long),
#         ("created", Long),
#         ("modified", Long),
#         ("version", Int),
#         ("child_version", Int),
#         ("acl_version", Int),
#         ("ephemeral_owner", Long),
#         ("data_length", Int),
#         ("num_children", Int),
#         ("last_modified_children", Long),
#     )
# 
# Path: zoonado/protocol/primitives.py
# class Bool(Primitive):
#     """
#     Represents a boolean (true or false) value.
# 
#     Renders as an unsigned char (1 byte).
#     """
#     fmt = "?"
# 
# class UString(VariablePrimitive):
#     """
#     Represents a unicode string value, length denoted by a 32-bit integer.
#     """
#     size_primitive = Int
# 
#     def render_value(self, value):
#         return value.encode("utf8")
# 
#     @classmethod
#     def parse_value(cls, value):
#         return value.decode("utf8")
# 
#     def __str__(self):
#         return self.value
# 
# class Buffer(VariablePrimitive):
#     """
#     Represents a bytestring value, length denoted by a 32-bit signed integer.
#     """
#     size_primitive = Int
# 
#     def render_value(self, value):
#         return value
# 
#     @classmethod
#     def parse_value(cls, value):
#         return value
# 
# class Int(Primitive):
#     """
#     Represents an 32-bit signed integer.
#     """
#     fmt = "i"


from .request import Request
from .response import Response
from .stat import Stat
from .primitives import Bool, UString, Buffer, Int
        ("path", UString),
        ("watch", Bool),
    )


class GetDataResponse(Response):
    """
    """
    opcode = 4

    parts = (
        ("data", Buffer),
        ("stat", Stat)
    )


class SetDataRequest(Request):
    """
    """
    opcode = 5

    writes_data = True

    parts = (
        ("path", UString),
        ("data", Buffer),
        ("version", Int),
    )



# Path: zoonado/protocol/request.py
# class Request(Part):
#     """
#     Returns a bytesring representation of the request instance.
# 
#     # TODO(wglass): specify how xid and type preamble goes in
# 
#     Since this is a ``Part`` subclass the rest is a matter of
#     appending the result of a ``render()`` call.
#     """
#     opcode = None
#     special_xid = None
#     writes_data = False
# 
#     def serialize(self, xid=None):
#         buff = BytesIO()
# 
#         formats = []
#         data = []
# 
#         if xid is not None:
#             formats.append(Int.fmt)
#             data.append(xid)
# 
#         if self.opcode:
#             formats.append(Int.fmt)
#             data.append(self.opcode)
# 
#         payload_format, payload_data = self.render()
#         formats.append(payload_format)
#         data.extend(payload_data)
# 
#         buff.write(struct.pack("!" + "".join(formats), *data))
# 
#         return buff.getvalue()
# 
# Path: zoonado/protocol/response.py
# class Response(Part):
#     """
#     Base class for all operation response classes.
# 
#     A simple class, has only an ``opcode`` attribute expected to be defined by
#     subclasses, and a `deserialize()` classmethod.
#     """
#     opcode = None
# 
#     @classmethod
#     def deserialize(cls, raw_bytes):
#         """
#         Deserializes the given raw bytes into an instance.
# 
#         Since this is a subclass of ``Part`` but a top-level one (i.e. no other
#         subclass of ``Part`` would have a ``Response`` as a part) this merely
#         has to parse the raw bytes and discard the resulting offset.
#         """
#         instance, _ = cls.parse(raw_bytes, offset=0)
# 
#         return instance
# 
# Path: zoonado/protocol/stat.py
# class Stat(Part):
#     """
#     """
#     parts = (
#         ("created_zxid", Long),
#         ("last_modified_zxid", Long),
#         ("created", Long),
#         ("modified", Long),
#         ("version", Int),
#         ("child_version", Int),
#         ("acl_version", Int),
#         ("ephemeral_owner", Long),
#         ("data_length", Int),
#         ("num_children", Int),
#         ("last_modified_children", Long),
#     )
# 
# Path: zoonado/protocol/primitives.py
# class Bool(Primitive):
#     """
#     Represents a boolean (true or false) value.
# 
#     Renders as an unsigned char (1 byte).
#     """
#     fmt = "?"
# 
# class UString(VariablePrimitive):
#     """
#     Represents a unicode string value, length denoted by a 32-bit integer.
#     """
#     size_primitive = Int
# 
#     def render_value(self, value):
#         return value.encode("utf8")
# 
#     @classmethod
#     def parse_value(cls, value):
#         return value.decode("utf8")
# 
#     def __str__(self):
#         return self.value
# 
# class Buffer(VariablePrimitive):
#     """
#     Represents a bytestring value, length denoted by a 32-bit signed integer.
#     """
#     size_primitive = Int
# 
#     def render_value(self, value):
#         return value
# 
#     @classmethod
#     def parse_value(cls, value):
#         return value
# 
# class Int(Primitive):
#     """
#     Represents an 32-bit signed integer.
#     """
#     fmt = "i"


# Path: zoonado/protocol/data.py
from .request import Request
from .response import Response
from .stat import Stat
from .primitives import Bool, UString, Buffer, Int

        ("path", UString),
        ("watch", Bool),
    )


class GetDataResponse(Response):
    """
    """
    opcode = 4

    parts = (
        ("data", Buffer),
        ("stat", Stat)
    )


class SetDataRequest(Request):
    """
    """
    opcode = 5

    writes_data = True

    parts = (
        ("path", UString),
        ("data", Buffer),
        ("version", Int),
    )



class SetDataResponse(Response):