zeroshade commented on code in PR #290:
URL: https://github.com/apache/iceberg-go/pull/290#discussion_r1951420833


##########
catalog/rest/rest.go:
##########
@@ -989,3 +990,66 @@ func (r *Catalog) CheckTableExists(ctx context.Context, 
identifier table.Identif
        }
        return true, nil
 }
+
+func (r *Catalog) ListViews(ctx context.Context, namespace table.Identifier, 
pageToken *string, pageSize *int) ([]table.Identifier, *string, error) {

Review Comment:
   I wouldn't use `*string`s or a pointer to `pageSize` here. There's no real 
good reason for using pointers in this scenario. We could use an empty string 
and a size <= 0 to indicate they are unset.



##########
catalog/rest/rest.go:
##########
@@ -989,3 +989,54 @@ func (r *Catalog) CheckTableExists(ctx context.Context, 
identifier table.Identif
        }
        return true, nil
 }
+
+func (r *Catalog) ListViews(ctx context.Context, namespace table.Identifier) 
([]table.Identifier, error) {
+       if err := checkValidNamespace(namespace); err != nil {
+               return nil, err
+       }
+
+       ns := strings.Join(namespace, namespaceSeparator)
+       path := []string{"namespaces", ns, "views"}
+
+       type resp struct {
+               Identifiers []identifier `json:"identifiers"`
+       }

Review Comment:
   While I like the idea of the application managing it, I don't like having to 
pass the token + size. It might make more sense to instead have the method 
return an `iter.Seq2[Identifier, error]` or `iter.Seq2[[]Identifier, error]` 
and have a default page size that is configurable via catalog properties / 
catalog config / context value.
   
   That way the interface is still simple (`for err, id := range 
cat.ListViews(ctx, namespace)`) while still allowing the application to control 
the iteration.
   
   What do you think?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to