1: <?php
2: 3: 4: 5: 6:
7: include_once $GLOBALS['THRIFT_ROOT'].'/Thrift.php';
8:
9: include_once $GLOBALS['THRIFT_ROOT'].'/packages/fb303/fb303_types.php';
10:
11: $GLOBALS['E_ResultCode'] = array(
12: 'OK' => 0,
13: 'TRY_LATER' => 1,
14: );
15:
16: final class ResultCode {
17: const OK = 0;
18: const TRY_LATER = 1;
19: static public $__names = array(
20: 0 => 'OK',
21: 1 => 'TRY_LATER',
22: );
23: }
24:
25: class LogEntry {
26: static $_TSPEC;
27:
28: public $category = null;
29: public $message = null;
30:
31: public function __construct($vals=null) {
32: if (!isset(self::$_TSPEC)) {
33: self::$_TSPEC = array(
34: 1 => array(
35: 'var' => 'category',
36: 'type' => TType::STRING,
37: ),
38: 2 => array(
39: 'var' => 'message',
40: 'type' => TType::STRING,
41: ),
42: );
43: }
44: if (is_array($vals)) {
45: if (isset($vals['category'])) {
46: $this->category = $vals['category'];
47: }
48: if (isset($vals['message'])) {
49: $this->message = $vals['message'];
50: }
51: }
52: }
53:
54: public function getName() {
55: return 'LogEntry';
56: }
57:
58: public function read($input)
59: {
60: $xfer = 0;
61: $fname = null;
62: $ftype = 0;
63: $fid = 0;
64: $xfer += $input->readStructBegin($fname);
65: while (true)
66: {
67: $xfer += $input->readFieldBegin($fname, $ftype, $fid);
68: if ($ftype == TType::STOP) {
69: break;
70: }
71: switch ($fid)
72: {
73: case 1:
74: if ($ftype == TType::STRING) {
75: $xfer += $input->readString($this->category);
76: } else {
77: $xfer += $input->skip($ftype);
78: }
79: break;
80: case 2:
81: if ($ftype == TType::STRING) {
82: $xfer += $input->readString($this->message);
83: } else {
84: $xfer += $input->skip($ftype);
85: }
86: break;
87: default:
88: $xfer += $input->skip($ftype);
89: break;
90: }
91: $xfer += $input->readFieldEnd();
92: }
93: $xfer += $input->readStructEnd();
94: return $xfer;
95: }
96:
97: public function write($output) {
98: $xfer = 0;
99: $xfer += $output->writeStructBegin('LogEntry');
100: if ($this->category !== null) {
101: $xfer += $output->writeFieldBegin('category', TType::STRING, 1);
102: $xfer += $output->writeString($this->category);
103: $xfer += $output->writeFieldEnd();
104: }
105: if ($this->message !== null) {
106: $xfer += $output->writeFieldBegin('message', TType::STRING, 2);
107: $xfer += $output->writeString($this->message);
108: $xfer += $output->writeFieldEnd();
109: }
110: $xfer += $output->writeFieldStop();
111: $xfer += $output->writeStructEnd();
112: return $xfer;
113: }
114:
115: }
116:
117: ?>
118: