本文整理匯總了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
}
示例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
}
示例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)
}