NVIDIA / aistore

AIStore: scalable storage for AI applications
https://aistore.nvidia.com
MIT License
1.26k stars 172 forks source link

GO Api examples/tests #182

Closed chiefMarlin closed 2 months ago

chiefMarlin commented 2 months ago

Hi, Are there any examples/go tests or guides on how to use the Go API ?

Thanks in advance

gaikwadabhishek commented 2 months ago

Hey @chiefMarlin,

We utilize a lot of the Go API in our CLI and tests. You can perform a' grep' search to find occurrences of the API you're interested in.

You can find the CLI code at: AIStore CLI

For example, to locate all uses of the GetBucketInfo API, you can run the following command:

/go/src/github.com/NVIDIA/aistore$ git grep GetBucketInfo
ais/proxy.go:// with additional preparsing step to support api.GetBucketInfo prefix (as in: ais ls --summary)
ais/prxbsumm.go:// - bsummhead <= api.GetBucketInfo(bck, QparamBinfoWithOrWithoutRemote)
ais/test/bucket_test.go:func TestGetBucketInfo(t *testing.T) {
ais/test/bucket_test.go:                _, _, _, err := api.GetBucketInfo(baseParams, bck, &api.BinfoArgs{FltPresence: apc.FltPresent})
ais/test/bucket_test.go:                xid, props, info, err := api.GetBucketInfo(baseParams, bck, &args)
ais/test/bucket_test.go:                        // undo the side effect of calling api.GetBucketInfo
ais/test/bucket_test.go:                _, _, _, err := api.GetBucketInfo(baseParams, bck, &api.BinfoArgs{FltPresence: apc.FltPresent})
api/apc/query.go:       // (api.GetBucketInfo)
api/apc/query.go:       // NOTE: non-empty value indicates api.GetBucketInfo; "true" value further requires "with remote obj-s"
api/bsumm.go:// - is obtained via GetBucketInfo() API
api/bsumm.go:func GetBucketInfo(bp BaseParams, bck cmn.Bck, args *BinfoArgs) (string, *cmn.Bprops, *cmn.BsummResult, error) {
cmd/cli/cli/ls.go:              xid, props, info, err := api.GetBucketInfo(apiBP, bck, &args)
Nahemah1022 commented 2 months ago

Hi @chiefMarlin ,

For real examples, you can also explore the test cases in the ais/test directory, which contain numerous example use cases and expected outcomes for each API.

chiefMarlin commented 2 months ago

ais/tests Thats perfect! Thanks guys