本文整理汇总了Golang中github.com/youtube/vitess/go/vt/tabletmanager/tmclient.TabletManagerClient类的典型用法代码示例。如果您正苦于以下问题:Golang TabletManagerClient类的具体用法?Golang TabletManagerClient怎么用?Golang TabletManagerClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TabletManagerClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: agentRPCTestHealthStream
func agentRPCTestHealthStream(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
c, errFunc, err := client.HealthStream(ctx, ti)
if err != nil {
t.Fatalf("HealthStream failed: %v", err)
}
// channel should have one response, then closed
hsr, ok := <-c
if !ok {
t.Fatalf("HealthStream got no response")
}
// close HealthStreamSynchronization so server side knows we
// got the response, and it can send the error
close(HealthStreamSynchronization)
_, ok = <-c
if ok {
t.Fatalf("HealthStream wasn't closed")
}
err = errFunc()
if !strings.Contains(err.Error(), testRegisterHealthStreamError) {
t.Fatalf("HealthStream failed with the wrong error: %v", err)
}
compareError(t, "HealthStream", nil, *hsr, *testHealthStreamHealthStreamReply)
}
开发者ID:pengmingde,项目名称:vitess,代码行数:25,代码来源:test_agent_rpc.go
示例2: agentRPCTestExecuteFetchPanic
func agentRPCTestExecuteFetchPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
_, err := client.ExecuteFetchAsDba(ctx, ti, testExecuteFetchQuery, testExecuteFetchMaxRows, true, true, false)
expectRPCWrapPanic(t, err)
_, err = client.ExecuteFetchAsApp(ctx, ti, testExecuteFetchQuery, testExecuteFetchMaxRows, true)
expectRPCWrapPanic(t, err)
}
开发者ID:BobbWu,项目名称:vitess,代码行数:7,代码来源:test_agent_rpc.go
示例3: agentRPCTestBackup
func agentRPCTestBackup(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
stream, err := client.Backup(ctx, ti, testBackupConcurrency)
if err != nil {
t.Fatalf("Backup failed: %v", err)
}
err = compareLoggedStuff(t, "Backup", stream, 10)
compareError(t, "Backup", err, true, testBackupCalled)
}
开发者ID:aaijazi,项目名称:vitess,代码行数:8,代码来源:test_agent_rpc.go
示例4: agentRPCTestRestoreFromBackup
func agentRPCTestRestoreFromBackup(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) {
stream, err := client.RestoreFromBackup(ctx, tablet)
if err != nil {
t.Fatalf("RestoreFromBackup failed: %v", err)
}
err = compareLoggedStuff(t, "RestoreFromBackup", stream, 10)
compareError(t, "RestoreFromBackup", err, true, testRestoreFromBackupCalled)
}
开发者ID:yuer2008,项目名称:vitess,代码行数:8,代码来源:test_agent_rpc.go
示例5: agentRPCTestRefreshState
func agentRPCTestRefreshState(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) {
err := client.RefreshState(ctx, tablet)
if err != nil {
t.Errorf("RefreshState failed: %v", err)
}
if !testRefreshStateCalled {
t.Errorf("RefreshState didn't call the server side")
}
}
开发者ID:yuer2008,项目名称:vitess,代码行数:9,代码来源:test_agent_rpc.go
示例6: agentRPCTestReloadSchema
func agentRPCTestReloadSchema(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) {
err := client.ReloadSchema(ctx, tablet, "")
if err != nil {
t.Errorf("ReloadSchema failed: %v", err)
}
if !testReloadSchemaCalled {
t.Errorf("ReloadSchema didn't call the server side")
}
}
开发者ID:yuer2008,项目名称:vitess,代码行数:9,代码来源:test_agent_rpc.go
示例7: agentRpcTestMultiRestore
func agentRpcTestMultiRestore(t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
logChannel, errFunc, err := client.MultiRestore(ti, testMultiRestoreArgs, time.Minute)
if err != nil {
t.Fatalf("MultiRestore failed: %v", err)
}
compareLoggedStuff(t, "MultiRestore", logChannel, 1000)
err = errFunc()
compareError(t, "MultiRestore", err, true, testMultiRestoreCalled)
}
开发者ID:nangong92t,项目名称:go_src,代码行数:9,代码来源:test_agent_rpc.go
示例8: agentRpcTestMultiSnapshot
func agentRpcTestMultiSnapshot(t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
logChannel, errFunc, err := client.MultiSnapshot(ti, testMultiSnapshotArgs, time.Minute)
if err != nil {
t.Fatalf("MultiSnapshot failed: %v", err)
}
compareLoggedStuff(t, "MultiSnapshot", logChannel, 100)
sr, err := errFunc()
compareError(t, "MultiSnapshot", err, sr, testMultiSnapshotReply)
}
开发者ID:nangong92t,项目名称:go_src,代码行数:9,代码来源:test_agent_rpc.go
示例9: agentRpcTestReloadSchema
func agentRpcTestReloadSchema(t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
err := client.ReloadSchema(ti, time.Minute)
if err != nil {
t.Errorf("ReloadSchema failed: %v", err)
}
if !testReloadSchemaCalled {
t.Errorf("ReloadSchema didn't call the server side")
}
}
开发者ID:nangong92t,项目名称:go_src,代码行数:9,代码来源:test_agent_rpc.go
示例10: agentRPCTestBackupPanic
func agentRPCTestBackupPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
stream, err := client.Backup(ctx, ti, testBackupConcurrency)
if err != nil {
t.Fatalf("Backup failed: %v", err)
}
e, err := stream.Recv()
if err == nil {
t.Fatalf("Unexpected Backup logs: %v", e)
}
expectRPCWrapLockActionPanic(t, err)
}
开发者ID:aaijazi,项目名称:vitess,代码行数:11,代码来源:test_agent_rpc.go
示例11: agentRPCTestBackupPanic
func agentRPCTestBackupPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
logChannel, errFunc, err := client.Backup(ctx, ti, testBackupConcurrency)
if err != nil {
t.Fatalf("Backup failed: %v", err)
}
if e, ok := <-logChannel; ok {
t.Fatalf("Unexpected Backup logs: %v", e)
}
err = errFunc()
expectRPCWrapLockActionPanic(t, err)
}
开发者ID:BobbWu,项目名称:vitess,代码行数:11,代码来源:test_agent_rpc.go
示例12: agentRPCTestBackupPanic
func agentRPCTestBackupPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) {
stream, err := client.Backup(ctx, tablet, testBackupConcurrency)
if err != nil {
t.Fatalf("Backup failed: %v", err)
}
e, err := stream.Recv()
if err == nil {
t.Fatalf("Unexpected Backup logs: %v", e)
}
expectHandleRPCPanic(t, "Backup", true /*verbose*/, err)
}
开发者ID:erzel,项目名称:vitess,代码行数:11,代码来源:test_agent_rpc.go
示例13: agentRPCTestRestoreFromBackupPanic
func agentRPCTestRestoreFromBackupPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) {
stream, err := client.RestoreFromBackup(ctx, tablet)
if err != nil {
t.Fatalf("RestoreFromBackup failed: %v", err)
}
e, err := stream.Recv()
if err == nil {
t.Fatalf("Unexpected RestoreFromBackup logs: %v", e)
}
expectRPCWrapLockActionPanic(t, err)
}
开发者ID:yuer2008,项目名称:vitess,代码行数:11,代码来源:test_agent_rpc.go
示例14: agentRpcTestSetReadOnly
func agentRpcTestSetReadOnly(t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
testSetReadOnlyExpectedValue = true
err := client.SetReadOnly(ti, time.Minute)
if err != nil {
t.Errorf("SetReadOnly failed: %v", err)
}
testSetReadOnlyExpectedValue = false
err = client.SetReadWrite(ti, time.Minute)
if err != nil {
t.Errorf("SetReadWrite failed: %v", err)
}
}
开发者ID:nangong92t,项目名称:go_src,代码行数:12,代码来源:test_agent_rpc.go
示例15: agentRPCTestSetReadOnly
func agentRPCTestSetReadOnly(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) {
testSetReadOnlyExpectedValue = true
err := client.SetReadOnly(ctx, tablet)
if err != nil {
t.Errorf("SetReadOnly failed: %v", err)
}
testSetReadOnlyExpectedValue = false
err = client.SetReadWrite(ctx, tablet)
if err != nil {
t.Errorf("SetReadWrite failed: %v", err)
}
}
开发者ID:yuer2008,项目名称:vitess,代码行数:12,代码来源:test_agent_rpc.go
示例16: agentRPCTestIsTimeoutErrorDialExpiredContext
// agentRPCTestIsTimeoutErrorDialExpiredContext verifies that
// client.IsTimeoutError() returns true for RPCs failed due to an expired
// context before .Dial().
func agentRPCTestIsTimeoutErrorDialExpiredContext(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
// Using a timeout of 0 here such that .Dial() will fail immediately.
expiredCtx, cancel := context.WithTimeout(ctx, 0)
defer cancel()
err := client.Ping(expiredCtx, ti)
if err == nil {
t.Fatal("agentRPCTestIsTimeoutErrorDialExpiredContext: RPC with expired context did not fail")
}
if !client.IsTimeoutError(err) {
t.Errorf("agentRPCTestIsTimeoutErrorDialExpiredContext: want: IsTimeoutError() = true. error: %v", err)
}
}
开发者ID:BobbWu,项目名称:vitess,代码行数:15,代码来源:test_agent_rpc.go
示例17: agentRPCTestHealthStreamPanic
func agentRPCTestHealthStreamPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
c, errFunc, err := client.HealthStream(ctx, ti)
if err != nil {
t.Fatalf("HealthStream failed: %v", err)
}
// channel should have no response, just closed
_, ok := <-c
if ok {
t.Fatalf("HealthStream wasn't closed")
}
err = errFunc()
expectRPCWrapPanic(t, err)
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:13,代码来源:test_agent_rpc.go
示例18: agentRPCTestExecuteFetchPanic
func agentRPCTestExecuteFetchPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) {
// using pool
_, err := client.ExecuteFetchAsDba(ctx, tablet, true, testExecuteFetchQuery, testExecuteFetchMaxRows, true, false)
expectHandleRPCPanic(t, "ExecuteFetchAsDba", false /*verbose*/, err)
_, err = client.ExecuteFetchAsApp(ctx, tablet, true, testExecuteFetchQuery, testExecuteFetchMaxRows)
expectHandleRPCPanic(t, "ExecuteFetchAsApp", false /*verbose*/, err)
// not using pool
_, err = client.ExecuteFetchAsDba(ctx, tablet, false, testExecuteFetchQuery, testExecuteFetchMaxRows, true, false)
expectHandleRPCPanic(t, "ExecuteFetchAsDba", false /*verbose*/, err)
_, err = client.ExecuteFetchAsApp(ctx, tablet, false, testExecuteFetchQuery, testExecuteFetchMaxRows)
expectHandleRPCPanic(t, "ExecuteFetchAsApp", false /*verbose*/, err)
_, err = client.ExecuteFetchAsAllPrivs(ctx, tablet, testExecuteFetchQuery, testExecuteFetchMaxRows, false)
expectHandleRPCPanic(t, "ExecuteFetchAsAllPrivs", false /*verbose*/, err)
}
开发者ID:dumbunny,项目名称:vitess,代码行数:15,代码来源:test_agent_rpc.go
示例19: agentRPCTestExecuteFetch
func agentRPCTestExecuteFetch(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) {
// using pool
qr, err := client.ExecuteFetchAsDba(ctx, tablet, true, testExecuteFetchQuery, testExecuteFetchMaxRows, true, true)
compareError(t, "ExecuteFetchAsDba", err, qr, testExecuteFetchResult)
qr, err = client.ExecuteFetchAsApp(ctx, tablet, true, testExecuteFetchQuery, testExecuteFetchMaxRows)
compareError(t, "ExecuteFetchAsApp", err, qr, testExecuteFetchResult)
// not using pool
qr, err = client.ExecuteFetchAsDba(ctx, tablet, false, testExecuteFetchQuery, testExecuteFetchMaxRows, true, true)
compareError(t, "ExecuteFetchAsDba", err, qr, testExecuteFetchResult)
qr, err = client.ExecuteFetchAsApp(ctx, tablet, false, testExecuteFetchQuery, testExecuteFetchMaxRows)
compareError(t, "ExecuteFetchAsApp", err, qr, testExecuteFetchResult)
qr, err = client.ExecuteFetchAsAllPrivs(ctx, tablet, testExecuteFetchQuery, testExecuteFetchMaxRows, true)
compareError(t, "ExecuteFetchAsAllPrivs", err, qr, testExecuteFetchResult)
}
开发者ID:dumbunny,项目名称:vitess,代码行数:16,代码来源:test_agent_rpc.go
示例20: agentRPCTestIsTimeoutErrorDialTimeout
// agentRPCTestIsTimeoutErrorDialTimeout verifies that client.IsTimeoutError()
// returns true for RPCs failed due to a connect timeout during .Dial().
func agentRPCTestIsTimeoutErrorDialTimeout(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
// Connect to a non-existing tablet.
// For example, this provokes gRPC to return error grpc.ErrClientConnTimeout.
invalidTi := topo.NewTabletInfo(ti.Tablet, ti.Version())
invalidTi.Tablet = proto.Clone(invalidTi.Tablet).(*topodatapb.Tablet)
invalidTi.Tablet.Hostname = "Non-Existent.Server"
shortCtx, cancel := context.WithTimeout(ctx, time.Millisecond)
defer cancel()
err := client.Ping(shortCtx, invalidTi)
if err == nil {
t.Fatal("agentRPCTestIsTimeoutErrorDialTimeout: connect to non-existant tablet did not fail")
}
if !client.IsTimeoutError(err) {
t.Errorf("agentRPCTestIsTimeoutErrorDialTimeout: want: IsTimeoutError() = true. error: %v", err)
}
}
开发者ID:BobbWu,项目名称:vitess,代码行数:19,代码来源:test_agent_rpc.go
注:本文中的github.com/youtube/vitess/go/vt/tabletmanager/tmclient.TabletManagerClient类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论