+type GetCollectionsParams struct {
+ Client arvadosclient.ArvadosClient
+ Limit int
+ LogEveryNthCollectionProcessed int // 0 means don't report any
+}
+
+// TODO(misha): Move this method somewhere more central
+func SdkListResponseContainsAllAvailableItems(response map[string]interface{}) (containsAll bool, numContained int, numAvailable int) {
+ if value, ok := response["items"]; ok {
+ items := value.([]interface{})
+ {
+ var itemsAvailable interface{}
+ if itemsAvailable, ok = response["items_available"]; !ok {
+ // TODO(misha): Consider returning an error here (and above if
+ // we can't find items) so that callers can recover.
+ log.Fatalf("API server did not return the number of items available")
+ }
+ numContained = len(items)
+ numAvailable = int(itemsAvailable.(float64))
+ // If we never entered this block, allAvailable would be false by
+ // default, which is what we want
+ containsAll = numContained == numAvailable
+ }
+ }
+ return
+}
+
+func GetCollections(params GetCollectionsParams) (results ReadCollections) {
+ if ¶ms.Client == nil {
+ log.Fatalf("Received params.Client passed to GetCollections() should " +
+ "contain a valid ArvadosClient, but instead it is nil.")
+ }
+