本文整理匯總了Golang中github.com/pachyderm/pachyderm/src/pfs.APIClient.StartCommit方法的典型用法代碼示例。如果您正苦於以下問題:Golang APIClient.StartCommit方法的具體用法?Golang APIClient.StartCommit怎麽用?Golang APIClient.StartCommit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/pachyderm/pachyderm/src/pfs.APIClient
的用法示例。
在下文中一共展示了APIClient.StartCommit方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: StartCommit
func StartCommit(apiClient pfs.APIClient, repoName string, parentCommit string) (*pfs.Commit, error) {
commit, err := apiClient.StartCommit(
context.Background(),
&pfs.StartCommitRequest{
Parent: NewCommit(repoName, parentCommit),
},
)
if err != nil {
return nil, err
}
return commit, nil
}
示例2: setupPFSInputCommit
// TODO: handle directories in filePathToContent
func setupPFSInputCommit(t *testing.T, pfsAPIClient pfs.APIClient, repo *pfs.Repo, filePathToContent map[string][]byte) *pfs.Commit {
commit, err := pfsAPIClient.StartCommit(
context.Background(),
&pfs.StartCommitRequest{
Parent: &pfs.Commit{
Repo: repo,
Id: pfs.InitialCommitID,
},
},
)
require.NoError(t, err)
for filePath, content := range filePathToContent {
apiPutFileClient, err := pfsAPIClient.PutFile(
context.Background(),
)
require.NoError(t, err)
err = apiPutFileClient.Send(
&pfs.PutFileRequest{
File: &pfs.File{
Commit: commit,
Path: filePath,
},
FileType: pfs.FileType_FILE_TYPE_REGULAR,
Value: content,
},
)
require.NoError(t, err)
_, _ = apiPutFileClient.CloseAndRecv()
}
_, err = pfsAPIClient.FinishCommit(
context.Background(),
&pfs.FinishCommitRequest{
Commit: commit,
},
)
require.NoError(t, err)
return commit
}