本文整理汇总了Golang中github.com/pachyderm/pachyderm/src/pfs/drive.APIClient类的典型用法代码示例。如果您正苦于以下问题:Golang APIClient类的具体用法?Golang APIClient怎么用?Golang APIClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了APIClient类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ListBlock
func ListBlock(apiClient drive.APIClient) ([]*drive.BlockInfo, error) {
blockInfos, err := apiClient.ListBlock(
context.Background(),
&drive.ListBlockRequest{},
)
if err != nil {
return nil, err
}
return blockInfos.BlockInfo, nil
}
示例2: PutBlock
func PutBlock(apiClient drive.APIClient, reader io.Reader) (*drive.BlockRefs, error) {
putBlockClient, err := apiClient.PutBlock(context.Background())
if err != nil {
return nil, err
}
if _, err := io.Copy(protostream.NewStreamingBytesWriter(putBlockClient), reader); err != nil {
return nil, err
}
return putBlockClient.CloseAndRecv()
}
示例3: InspectBlock
func InspectBlock(apiClient drive.APIClient, hash string) (*drive.BlockInfo, error) {
blockInfo, err := apiClient.InspectBlock(
context.Background(),
&drive.InspectBlockRequest{
Block: &drive.Block{
Hash: hash,
},
},
)
if err != nil {
return nil, err
}
return blockInfo, nil
}
示例4: GetBlock
func GetBlock(apiClient drive.APIClient, hash string, offsetBytes uint64) (io.Reader, error) {
apiGetBlockClient, err := apiClient.GetBlock(
context.Background(),
&drive.GetBlockRequest{
Block: &drive.Block{
Hash: hash,
},
OffsetBytes: offsetBytes,
},
)
if err != nil {
return nil, err
}
return protostream.NewStreamingBytesReader(apiGetBlockClient), nil
}