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