pager

package
v9.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListPageFunc

type ListPageFunc func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error)

ListPageFunc returns a list object for the given list options.

func SimplePageFunc

func SimplePageFunc(fn func(opts metav1.ListOptions) (runtime.Object, error)) ListPageFunc

SimplePageFunc adapts a context-less list function into one that accepts a context.

type ListPager

type ListPager struct {
	PageSize int64
	PageFn   ListPageFunc

	FullListIfExpired bool
}

ListPager assists client code in breaking large list queries into multiple smaller chunks of PageSize or smaller. PageFn is expected to accept a metav1.ListOptions that supports paging and return a list. The pager does not alter the field or label selectors on the initial options list.

func New

func New(fn ListPageFunc) *ListPager

New creates a new pager from the provided pager function using the default options. It will fall back to a full list if an expiration error is encountered as a last resort.

func (*ListPager) List

func (p *ListPager) List(ctx context.Context, options metav1.ListOptions) (runtime.Object, error)

List returns a single list object, but attempts to retrieve smaller chunks from the server to reduce the impact on the server. If the chunk attempt fails, it will load the full list instead. The Limit field on options, if unset, will default to the page size.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL