Example #1
0
class OperationSetBinData(Operation):
    object_type = 'set_bindata'

    key = fields.String()
    start = fields.SmallUnsignedInteger(default=0)
    data = fields.Binary()
    truncate = fields.Boolean(default=False)
Example #2
0
class CheckBinData(Check):
    object_type = 'bindata'

    node = fields.NodeID()
    key = fields.String()
    start = fields.SmallUnsignedInteger()
    end = fields.SmallUnsignedInteger(optional=True)
    data = fields.Binary()
Example #3
0
class MsgGetBinDataReply(MsgpackMsg):
    """
    Sent by server in reply to MsgGetBinData.
    """

    object_type = 'get_bindata_reply'

    qid = fields.SmallUnsignedInteger()
    data = fields.Binary()
Example #4
0
class OperationCreate(Operation):
    object_type = 'create'

    parent = fields.NodeID(default=NodeID.root_id)
    pos_start = fields.Integer(optional=True)
    pos_end = fields.Integer(optional=True)
    tags = fields.Set(fields.String())
    attr = fields.Map(fields.String(), fields.Any())
    data = fields.Map(fields.String(), fields.Any())
    bindata = fields.Map(fields.String(), fields.Binary())
    triggers = fields.Set(fields.String())
Example #5
0
 def test_binary(self):
     a = fields.Binary()
     a.validate(b'abcd')
     with self.assertRaises(SchemaError):
         a.validate('abcd')
     with self.assertRaises(SchemaError):
         a.validate(1234)
     self.assertEqual(a.dump(b'abcd'), b'abcd')
     self.assertEqual(a.load(b'abcd'), b'abcd')
     with self.assertRaises(SchemaError):
         a.load('abcd')
     with self.assertRaises(SchemaError):
         a.load(1234)
Example #6
0
class MsgSetBinData(MsgpackMsg):
    """
    Sets a range of bindata on a given node.  Server replies with MsgRequestAck
    or MsgRequestError.  The bindata is modified starting from a given start
    position - it is an error if the position is after the current end of
    bindata (but not if it's equal).  The bindata is expanded if necessary
    to hold the new data.  If truncate is set, the bindata is truncated
    after the end of the new data.  If bindata would become 0-length,
    it is deleted.
    """

    object_type = 'set_bindata'

    rid = fields.SmallUnsignedInteger()
    id = fields.NodeID()
    key = fields.String()
    start = fields.SmallUnsignedInteger(default=0)
    data = fields.Binary()
    truncate = fields.Boolean(default=False)
Example #7
0
class MsgCreate(MsgpackMsg):
    """
    Creates a node on the server.  It is an error if a node with given id
    already exists.  Server replies with MsgRequestAck or MsgRequestError.
    Replies are matched to requests by ``rid``, which is assigned by the
    client.
    """

    object_type = 'create'

    rid = fields.SmallUnsignedInteger()
    id = fields.NodeID()
    parent = fields.NodeID(default=NodeID.root_id)
    pos_start = fields.Integer(optional=True)
    pos_end = fields.Integer(optional=True)
    tags = fields.Set(fields.String())
    attr = fields.Map(fields.String(), fields.Any())
    data = fields.Map(fields.String(), fields.Any())
    bindata = fields.Map(fields.String(), fields.Binary())
    triggers = fields.Set(fields.String())
Example #8
0
class BinaryOptional(model.Model):
    a = fields.Binary(optional=True)
Example #9
0
class Binary(model.Model):
    a = fields.Binary()
Example #10
0
class SubType2(BaseModel):
    object_type = 'sub2'

    b = fields.Binary()
Example #11
0
class TurboZlew(Zlew):
    object_type = 'turbozlew'
    dopalacz = fields.Binary()
Example #12
0
class TurboZlew(Zlew):
    c = fields.Set(fields.Binary())
    d = fields.Object(Piwo)
    e = fields.Integer(default=3)