本文整理汇总了Golang中github.com/youtube/vitess/go/vt/tabletmanager/tmclient.TabletManagerClient类的典型用法代码示例。如果您正苦于以下问题:Golang TabletManagerClient类的具体用法?Golang TabletManagerClient怎么用?Golang TabletManagerClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TabletManagerClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
}
示例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)
}
示例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)
}
示例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)
}
示例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")
}
}
示例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")
}
}
示例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)
}
示例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)
}
示例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")
}
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
}
示例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)
}
}