當前位置: 首頁>>代碼示例>>Golang>>正文


Golang APIClient.ListCommit方法代碼示例

本文整理匯總了Golang中github.com/pachyderm/pachyderm/src/pfs.APIClient.ListCommit方法的典型用法代碼示例。如果您正苦於以下問題:Golang APIClient.ListCommit方法的具體用法?Golang APIClient.ListCommit怎麽用?Golang APIClient.ListCommit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/pachyderm/pachyderm/src/pfs.APIClient的用法示例。


在下文中一共展示了APIClient.ListCommit方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: ListCommit

func ListCommit(apiClient pfs.APIClient, repoName string) ([]*pfs.CommitInfo, error) {
	commitInfos, err := apiClient.ListCommit(
		context.Background(),
		&pfs.ListCommitRequest{
			Repo: &pfs.Repo{
				Name: repoName,
			},
		},
	)
	if err != nil {
		return nil, err
	}
	return commitInfos.CommitInfo, nil
}
開發者ID:klucar,項目名稱:pachyderm,代碼行數:14,代碼來源:pfsutil.go

示例2: ListCommit

func ListCommit(apiClient pfs.APIClient, repoNames []string) ([]*pfs.CommitInfo, error) {
	var repos []*pfs.Repo
	for _, repoName := range repoNames {
		repos = append(repos, &pfs.Repo{Name: repoName})
	}
	commitInfos, err := apiClient.ListCommit(
		context.Background(),
		&pfs.ListCommitRequest{
			Repo: repos,
		},
	)
	if err != nil {
		return nil, err
	}
	return commitInfos.CommitInfo, nil
}
開發者ID:Manikandan-Selvaganesh,項目名稱:pachyderm,代碼行數:16,代碼來源:pfsutil.go

示例3: testBlockListCommits

func testBlockListCommits(t *testing.T, apiClient pfs.APIClient, cluster Cluster) {
	repoName := "testBlockListCommitsRepo"

	err := pfsutil.CreateRepo(apiClient, repoName)
	require.NoError(t, err)

	baseCommit, err := pfsutil.StartCommit(apiClient, repoName, "")
	require.NoError(t, err)
	err = pfsutil.FinishCommit(apiClient, repoName, baseCommit.Id)
	require.NoError(t, err)

	repo := &pfs.Repo{
		Name: repoName,
	}
	listCommitRequest := &pfs.ListCommitRequest{
		Repo: repo,
		From: baseCommit,
	}
	commitInfos, err := apiClient.ListCommit(
		context.Background(),
		listCommitRequest,
	)
	require.NoError(t, err)
	require.Equal(t, len(commitInfos.CommitInfo), 0)

	var newCommit *pfs.Commit
	var wg sync.WaitGroup
	wg.Add(1)
	go func() {
		defer wg.Done()
		time.Sleep(1)
		commit, err := pfsutil.StartCommit(apiClient, repoName, baseCommit.Id)
		require.NoError(t, err)
		require.NotNil(t, commit)
		newCommit = commit
	}()
	listCommitRequest.Block = true
	listCommitRequest.CommitType = pfs.CommitType_COMMIT_TYPE_WRITE
	commitInfos, err = apiClient.ListCommit(
		context.Background(),
		listCommitRequest,
	)
	wg.Wait()
	require.NoError(t, err)
	require.Equal(t, len(commitInfos.CommitInfo), 1)
	require.Equal(t, newCommit, commitInfos.CommitInfo[0].Commit)

	wg = sync.WaitGroup{}
	wg.Add(1)
	go func() {
		defer wg.Done()
		time.Sleep(1)
		err := pfsutil.FinishCommit(apiClient, repoName, newCommit.Id)
		require.NoError(t, err)
	}()
	listCommitRequest.Block = true
	listCommitRequest.CommitType = pfs.CommitType_COMMIT_TYPE_READ
	commitInfos, err = apiClient.ListCommit(
		context.Background(),
		listCommitRequest,
	)
	wg.Wait()
	require.NoError(t, err)
	require.Equal(t, len(commitInfos.CommitInfo), 1)
	require.Equal(t, newCommit, commitInfos.CommitInfo[0].Commit)
}
開發者ID:Antobiotics,項目名稱:pachyderm,代碼行數:66,代碼來源:testing_test.go


注:本文中的github.com/pachyderm/pachyderm/src/pfs.APIClient.ListCommit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。