зеркало из https://github.com/github/vitess-gh.git
Fixing various typos and comments.
This commit is contained in:
Родитель
d66ae6486d
Коммит
20c28a24de
|
@ -6,8 +6,8 @@ from net import bsonrpc
|
|||
from vtctl import vtctl_client
|
||||
|
||||
|
||||
class GoRpcVtctlClient(vtctl_client.VctlClient):
|
||||
"""GoRpcVtctlClient is the go rpc implementation of VctlClient.
|
||||
class GoRpcVtctlClient(vtctl_client.VtctlClient):
|
||||
"""GoRpcVtctlClient is the go rpc implementation of VtctlClient.
|
||||
It is registered as 'gorpc' protocol.
|
||||
"""
|
||||
|
||||
|
@ -38,8 +38,8 @@ class GoRpcVtctlClient(vtctl_client.VctlClient):
|
|||
def execute_vtctl_command(self, args, action_timeout=30.0, lock_timeout=5.0):
|
||||
req = {
|
||||
'Args': args,
|
||||
'ActionTimeout': long(action_timeout * 1000000000),
|
||||
'LockTimeout': long(lock_timeout * 1000000000),
|
||||
'ActionTimeout': long(action_timeout * 1e9),
|
||||
'LockTimeout': long(lock_timeout * 1e9),
|
||||
}
|
||||
self.client.stream_call('VtctlServer.ExecuteVtctlCommand', req)
|
||||
while True:
|
||||
|
|
|
@ -13,8 +13,8 @@ import vtctl_client
|
|||
from vtproto import vtctldata_pb2
|
||||
from vtproto import vtctlservice_pb2
|
||||
|
||||
class GRPCVtctlClient(vtctl_client.VctlClient):
|
||||
"""GoRpcVtctlClient is the gRPC implementation of VctlClient.
|
||||
class GRPCVtctlClient(vtctl_client.VtctlClient):
|
||||
"""GoRpcVtctlClient is the gRPC implementation of VtctlClient.
|
||||
It is registered as 'grpc' protocol.
|
||||
"""
|
||||
|
||||
|
@ -44,8 +44,8 @@ class GRPCVtctlClient(vtctl_client.VctlClient):
|
|||
def execute_vtctl_command(self, args, action_timeout=30.0, lock_timeout=5.0):
|
||||
req = vtctldata_pb2.ExecuteVtctlCommandRequest(
|
||||
args=args,
|
||||
action_timeout=long(action_timeout * 1000000000),
|
||||
lock_timeout=long(lock_timeout * 1000000000))
|
||||
action_timeout=long(action_timeout * 1e9),
|
||||
lock_timeout=long(lock_timeout * 1e9))
|
||||
with self.stub as stub:
|
||||
it = stub.ExecuteVtctlCommand(req, action_timeout)
|
||||
for response in it:
|
||||
|
|
|
@ -38,7 +38,7 @@ def connect(protocol, *pargs, **kargs):
|
|||
|
||||
|
||||
class Event(object):
|
||||
"""Event is streamed by VctlClient.
|
||||
"""Event is streamed by VtctlClient.
|
||||
Eventually, we will just use the proto3 definition for logutil.proto/Event.
|
||||
"""
|
||||
|
||||
|
@ -55,8 +55,8 @@ class Event(object):
|
|||
self.value = value
|
||||
|
||||
|
||||
class VctlClient(object):
|
||||
"""VctlClient is the interface for the vtctl client implementations.
|
||||
class VtctlClient(object):
|
||||
"""VtctlClient is the interface for the vtctl client implementations.
|
||||
All implementations must implement all these methods.
|
||||
If something goes wrong with the connection, this object will be thrown out.
|
||||
"""
|
||||
|
|
|
@ -92,10 +92,13 @@ class GoRpcUpdateStreamConnection(update_stream.UpdateStreamConnection):
|
|||
row = tuple(_make_row(pk_list, conversions))
|
||||
rows.append(row)
|
||||
|
||||
yield update_stream.StreamEvent(category, reply['TableName'],
|
||||
fields, rows, reply['Sql'],
|
||||
reply['Timestamp'],
|
||||
reply['GTIDField'])
|
||||
yield update_stream.StreamEvent(category=category,
|
||||
table_name=reply['TableName'],
|
||||
fields=fields,
|
||||
rows=rows,
|
||||
sql=reply['Sql'],
|
||||
timestamp=reply['Timestamp'],
|
||||
position=reply['GTIDField'])
|
||||
except gorpc.AppError as e:
|
||||
raise dbexceptions.DatabaseError(*e.args)
|
||||
except gorpc.GoRpcError as e:
|
||||
|
|
|
@ -86,12 +86,13 @@ class GRPCUpdateStreamConnection(update_stream.UpdateStreamConnection):
|
|||
rows.append(row)
|
||||
|
||||
try:
|
||||
yield update_stream.StreamEvent(int(stream_event.category),
|
||||
stream_event.table_name,
|
||||
fields, rows,
|
||||
stream_event.sql,
|
||||
stream_event.timestamp,
|
||||
stream_event.gtid)
|
||||
yield update_stream.StreamEvent(category=int(stream_event.category),
|
||||
table_name=stream_event.table_name,
|
||||
fields=fields,
|
||||
rows=rows,
|
||||
sql=stream_event.sql,
|
||||
timestamp=stream_event.timestamp,
|
||||
position=stream_event.gtid)
|
||||
except GeneratorExit:
|
||||
# if the loop is interrupted for any reason, we need to
|
||||
# cancel the iterator, so we close the RPC connection,
|
||||
|
|
|
@ -23,7 +23,7 @@ def connect(protocol, *pargs, **kargs):
|
|||
|
||||
Args:
|
||||
protocol: the registered protocol to use.
|
||||
arsg: passed to the registered protocol __init__ method.
|
||||
args: passed to the registered protocol __init__ method.
|
||||
|
||||
Returns:
|
||||
A dialed UpdateStreamConnection.
|
||||
|
|
Загрузка…
Ссылка в новой задаче