Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
ic-msg-rpc
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5a087487
authored
Jun 13, 2019
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
rpc
parents
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
620 additions
and
0 deletions
Msg/Message.php
Msg/SendMsg.php
Msg/Types.php
Msg/Message.php
0 → 100644
View file @
5a087487
<?php
namespace
Rpc\Msg
;
/**
* Autogenerated by Thrift Compiler (0.11.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
use
Thrift\Base\TBase
;
use
Thrift\Type\TType
;
use
Thrift\Type\TMessageType
;
use
Thrift\Exception\TException
;
use
Thrift\Exception\TProtocolException
;
use
Thrift\Protocol\TProtocol
;
use
Thrift\Protocol\TBinaryProtocolAccelerated
;
use
Thrift\Exception\TApplicationException
;
interface
MessageIf
{
/**
* @param string $str
* @return string
*/
public
function
MessageApiAction
(
$str
);
}
class
MessageClient
implements
\Rpc\Msg\MessageIf
{
protected
$input_
=
null
;
protected
$output_
=
null
;
protected
$seqid_
=
0
;
public
function
__construct
(
$input
,
$output
=
null
)
{
$this
->
input_
=
$input
;
$this
->
output_
=
$output
?
$output
:
$input
;
}
public
function
MessageApiAction
(
$str
)
{
$this
->
send_MessageApiAction
(
$str
);
return
$this
->
recv_MessageApiAction
();
}
public
function
send_MessageApiAction
(
$str
)
{
$args
=
new
\Rpc\Msg\Message_MessageApiAction_args
();
$args
->
str
=
$str
;
$bin_accel
=
(
$this
->
output_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$this
->
output_
,
'MessageApiAction'
,
TMessageType
::
CALL
,
$args
,
$this
->
seqid_
,
$this
->
output_
->
isStrictWrite
());
}
else
{
$this
->
output_
->
writeMessageBegin
(
'MessageApiAction'
,
TMessageType
::
CALL
,
$this
->
seqid_
);
$args
->
write
(
$this
->
output_
);
$this
->
output_
->
writeMessageEnd
();
$this
->
output_
->
getTransport
()
->
flush
();
}
}
public
function
recv_MessageApiAction
()
{
$bin_accel
=
(
$this
->
input_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary'
);
if
(
$bin_accel
)
$result
=
thrift_protocol_read_binary
(
$this
->
input_
,
'\Rpc\Msg\Message_MessageApiAction_result'
,
$this
->
input_
->
isStrictRead
());
else
{
$rseqid
=
0
;
$fname
=
null
;
$mtype
=
0
;
$this
->
input_
->
readMessageBegin
(
$fname
,
$mtype
,
$rseqid
);
if
(
$mtype
==
TMessageType
::
EXCEPTION
)
{
$x
=
new
TApplicationException
();
$x
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
throw
$x
;
}
$result
=
new
\Rpc\Msg\Message_MessageApiAction_result
();
$result
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
}
if
(
$result
->
success
!==
null
)
{
return
$result
->
success
;
}
throw
new
\Exception
(
"MessageApiAction failed: unknown result"
);
}
}
// HELPER FUNCTIONS AND STRUCTURES
class
Message_MessageApiAction_args
{
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
1
=>
array
(
'var'
=>
'str'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
STRING
,
),
);
/**
* @var string
*/
public
$str
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'str'
]))
{
$this
->
str
=
$vals
[
'str'
];
}
}
}
public
function
getName
()
{
return
'Message_MessageApiAction_args'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
1
:
if
(
$ftype
==
TType
::
STRING
)
{
$xfer
+=
$input
->
readString
(
$this
->
str
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Message_MessageApiAction_args'
);
if
(
$this
->
str
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'str'
,
TType
::
STRING
,
1
);
$xfer
+=
$output
->
writeString
(
$this
->
str
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
}
class
Message_MessageApiAction_result
{
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
0
=>
array
(
'var'
=>
'success'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
STRING
,
),
);
/**
* @var string
*/
public
$success
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'success'
]))
{
$this
->
success
=
$vals
[
'success'
];
}
}
}
public
function
getName
()
{
return
'Message_MessageApiAction_result'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
0
:
if
(
$ftype
==
TType
::
STRING
)
{
$xfer
+=
$input
->
readString
(
$this
->
success
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Message_MessageApiAction_result'
);
if
(
$this
->
success
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'success'
,
TType
::
STRING
,
0
);
$xfer
+=
$output
->
writeString
(
$this
->
success
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
}
class
MessageProcessor
{
protected
$handler_
=
null
;
public
function
__construct
(
$handler
)
{
$this
->
handler_
=
$handler
;
}
public
function
process
(
$input
,
$output
)
{
$rseqid
=
0
;
$fname
=
null
;
$mtype
=
0
;
$input
->
readMessageBegin
(
$fname
,
$mtype
,
$rseqid
);
$methodname
=
'process_'
.
$fname
;
if
(
!
method_exists
(
$this
,
$methodname
))
{
$input
->
skip
(
TType
::
STRUCT
);
$input
->
readMessageEnd
();
$x
=
new
TApplicationException
(
'Function '
.
$fname
.
' not implemented.'
,
TApplicationException
::
UNKNOWN_METHOD
);
$output
->
writeMessageBegin
(
$fname
,
TMessageType
::
EXCEPTION
,
$rseqid
);
$x
->
write
(
$output
);
$output
->
writeMessageEnd
();
$output
->
getTransport
()
->
flush
();
return
;
}
$this
->
$methodname
(
$rseqid
,
$input
,
$output
);
return
true
;
}
protected
function
process_MessageApiAction
(
$seqid
,
$input
,
$output
)
{
$bin_accel
=
(
$input
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary_after_message_begin'
);
if
(
$bin_accel
)
{
$args
=
thrift_protocol_read_binary_after_message_begin
(
$input
,
'\Rpc\Msg\Message_MessageApiAction_args'
,
$input
->
isStrictRead
());
}
else
{
$args
=
new
\Rpc\Msg\Message_MessageApiAction_args
();
$args
->
read
(
$input
);
$input
->
readMessageEnd
();
}
$result
=
new
\Rpc\Msg\Message_MessageApiAction_result
();
$result
->
success
=
$this
->
handler_
->
MessageApiAction
(
$args
->
str
);
$bin_accel
=
(
$output
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$output
,
'MessageApiAction'
,
TMessageType
::
REPLY
,
$result
,
$seqid
,
$output
->
isStrictWrite
());
}
else
{
$output
->
writeMessageBegin
(
'MessageApiAction'
,
TMessageType
::
REPLY
,
$seqid
);
$result
->
write
(
$output
);
$output
->
writeMessageEnd
();
$output
->
getTransport
()
->
flush
();
}
}
}
Msg/SendMsg.php
0 → 100644
View file @
5a087487
<?php
namespace
Rpc\Msg
;
/**
* Autogenerated by Thrift Compiler (0.11.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
use
Thrift\Base\TBase
;
use
Thrift\Type\TType
;
use
Thrift\Type\TMessageType
;
use
Thrift\Exception\TException
;
use
Thrift\Exception\TProtocolException
;
use
Thrift\Protocol\TProtocol
;
use
Thrift\Protocol\TBinaryProtocolAccelerated
;
use
Thrift\Exception\TApplicationException
;
interface
SendMsgIf
{
/**
* @param string $str
* @return string
*/
public
function
sendMsg
(
$str
);
}
class
SendMsgClient
implements
\Rpc\Msg\SendMsgIf
{
protected
$input_
=
null
;
protected
$output_
=
null
;
protected
$seqid_
=
0
;
public
function
__construct
(
$input
,
$output
=
null
)
{
$this
->
input_
=
$input
;
$this
->
output_
=
$output
?
$output
:
$input
;
}
public
function
sendMsg
(
$str
)
{
$this
->
send_sendMsg
(
$str
);
return
$this
->
recv_sendMsg
();
}
public
function
send_sendMsg
(
$str
)
{
$args
=
new
\Rpc\Msg\SendMsg_sendMsg_args
();
$args
->
str
=
$str
;
$bin_accel
=
(
$this
->
output_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$this
->
output_
,
'sendMsg'
,
TMessageType
::
CALL
,
$args
,
$this
->
seqid_
,
$this
->
output_
->
isStrictWrite
());
}
else
{
$this
->
output_
->
writeMessageBegin
(
'sendMsg'
,
TMessageType
::
CALL
,
$this
->
seqid_
);
$args
->
write
(
$this
->
output_
);
$this
->
output_
->
writeMessageEnd
();
$this
->
output_
->
getTransport
()
->
flush
();
}
}
public
function
recv_sendMsg
()
{
$bin_accel
=
(
$this
->
input_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary'
);
if
(
$bin_accel
)
$result
=
thrift_protocol_read_binary
(
$this
->
input_
,
'\Rpc\Msg\SendMsg_sendMsg_result'
,
$this
->
input_
->
isStrictRead
());
else
{
$rseqid
=
0
;
$fname
=
null
;
$mtype
=
0
;
$this
->
input_
->
readMessageBegin
(
$fname
,
$mtype
,
$rseqid
);
if
(
$mtype
==
TMessageType
::
EXCEPTION
)
{
$x
=
new
TApplicationException
();
$x
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
throw
$x
;
}
$result
=
new
\Rpc\Msg\SendMsg_sendMsg_result
();
$result
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
}
if
(
$result
->
success
!==
null
)
{
return
$result
->
success
;
}
throw
new
\Exception
(
"sendMsg failed: unknown result"
);
}
}
// HELPER FUNCTIONS AND STRUCTURES
class
SendMsg_sendMsg_args
{
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
1
=>
array
(
'var'
=>
'str'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
STRING
,
),
);
/**
* @var string
*/
public
$str
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'str'
]))
{
$this
->
str
=
$vals
[
'str'
];
}
}
}
public
function
getName
()
{
return
'SendMsg_sendMsg_args'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
1
:
if
(
$ftype
==
TType
::
STRING
)
{
$xfer
+=
$input
->
readString
(
$this
->
str
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'SendMsg_sendMsg_args'
);
if
(
$this
->
str
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'str'
,
TType
::
STRING
,
1
);
$xfer
+=
$output
->
writeString
(
$this
->
str
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
}
class
SendMsg_sendMsg_result
{
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
0
=>
array
(
'var'
=>
'success'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
STRING
,
),
);
/**
* @var string
*/
public
$success
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'success'
]))
{
$this
->
success
=
$vals
[
'success'
];
}
}
}
public
function
getName
()
{
return
'SendMsg_sendMsg_result'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
0
:
if
(
$ftype
==
TType
::
STRING
)
{
$xfer
+=
$input
->
readString
(
$this
->
success
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'SendMsg_sendMsg_result'
);
if
(
$this
->
success
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'success'
,
TType
::
STRING
,
0
);
$xfer
+=
$output
->
writeString
(
$this
->
success
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
}
class
SendMsgProcessor
{
protected
$handler_
=
null
;
public
function
__construct
(
$handler
)
{
$this
->
handler_
=
$handler
;
}
public
function
process
(
$input
,
$output
)
{
$rseqid
=
0
;
$fname
=
null
;
$mtype
=
0
;
$input
->
readMessageBegin
(
$fname
,
$mtype
,
$rseqid
);
$methodname
=
'process_'
.
$fname
;
if
(
!
method_exists
(
$this
,
$methodname
))
{
$input
->
skip
(
TType
::
STRUCT
);
$input
->
readMessageEnd
();
$x
=
new
TApplicationException
(
'Function '
.
$fname
.
' not implemented.'
,
TApplicationException
::
UNKNOWN_METHOD
);
$output
->
writeMessageBegin
(
$fname
,
TMessageType
::
EXCEPTION
,
$rseqid
);
$x
->
write
(
$output
);
$output
->
writeMessageEnd
();
$output
->
getTransport
()
->
flush
();
return
;
}
$this
->
$methodname
(
$rseqid
,
$input
,
$output
);
return
true
;
}
protected
function
process_sendMsg
(
$seqid
,
$input
,
$output
)
{
$bin_accel
=
(
$input
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary_after_message_begin'
);
if
(
$bin_accel
)
{
$args
=
thrift_protocol_read_binary_after_message_begin
(
$input
,
'\Rpc\Msg\SendMsg_sendMsg_args'
,
$input
->
isStrictRead
());
}
else
{
$args
=
new
\Rpc\Msg\SendMsg_sendMsg_args
();
$args
->
read
(
$input
);
$input
->
readMessageEnd
();
}
$result
=
new
\Rpc\Msg\SendMsg_sendMsg_result
();
$result
->
success
=
$this
->
handler_
->
sendMsg
(
$args
->
str
);
$bin_accel
=
(
$output
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$output
,
'sendMsg'
,
TMessageType
::
REPLY
,
$result
,
$seqid
,
$output
->
isStrictWrite
());
}
else
{
$output
->
writeMessageBegin
(
'sendMsg'
,
TMessageType
::
REPLY
,
$seqid
);
$result
->
write
(
$output
);
$output
->
writeMessageEnd
();
$output
->
getTransport
()
->
flush
();
}
}
}
Msg/Types.php
0 → 100644
View file @
5a087487
<?php
namespace
Rpc\Msg
;
/**
* Autogenerated by Thrift Compiler (0.11.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
use
Thrift\Base\TBase
;
use
Thrift\Type\TType
;
use
Thrift\Type\TMessageType
;
use
Thrift\Exception\TException
;
use
Thrift\Exception\TProtocolException
;
use
Thrift\Protocol\TProtocol
;
use
Thrift\Protocol\TBinaryProtocolAccelerated
;
use
Thrift\Exception\TApplicationException
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment