MCPcopy Create free account
hub / github.com/apache/mesos / encode

Method encode

src/python/lib/mesos/recordio.py:66–83  ·  view source on GitHub ↗

Encode a message into 'RecordIO' format. :param message: a message to serialize and then wrap in a 'RecordIO' frame. :type message: object :returns: a serialized message wrapped in a 'RecordIO' frame :rtype: bytes

(self, message)

Source from the content-addressed store, hash-verified

64 self.serialize = serialize
65
66 def encode(self, message):
67 """
68 Encode a message into 'RecordIO' format.
69
70 :param message: a message to serialize and then wrap in
71 a 'RecordIO' frame.
72 :type message: object
73 :returns: a serialized message wrapped in a 'RecordIO' frame
74 :rtype: bytes
75 """
76
77 s = self.serialize(message)
78
79 if not isinstance(s, bytes):
80 raise MesosException("Calling 'serialize(message)' must"
81 " return a 'bytes' object")
82
83 return bytes(str(len(s)) + "\n", "UTF-8") + s
84
85
86class Decoder():

Callers 13

test_encodeFunction · 0.95
test_encode_decodeFunction · 0.95
_input_threadMethod · 0.45
_output_threadMethod · 0.45
_heartbeat_threadMethod · 0.45
_window_resizeMethod · 0.45
apiFunction · 0.45
verify_reviewFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
apiMethod · 0.45

Calls 2

MesosExceptionClass · 0.90
serializeMethod · 0.80

Tested by 2

test_encodeFunction · 0.76
test_encode_decodeFunction · 0.76