internal

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidToken = errors.New("invalid page token")
	ErrOutOfRange   = errors.New("out of range")
)

Functions

func ListNodeStatuses

func ListNodeStatuses(pageSize int, pageToken string, listFn ListNodeStatusFn) (stats []types.NodeStatus, nextPageToken string, total int, err error)

func ValidatePageToken

func ValidatePageToken(pageSize int, token string) (page int, err error)

Types

type ListNodeStatusFn

type ListNodeStatusFn = func(start, end int) (stats []types.NodeStatus, total int, err error)

if start is out of range, must return ErrOutOfRange

type PageToken

type PageToken struct {
	Page int
	Size int
}

PageToken is simple internal representation for coordination requests and responses in a paginated API It is inspired by the Google API Design patterns https://cloud.google.com/apis/design/design_patterns#list_pagination https://google.aip.dev/158

func NewPageToken

func NewPageToken(b64enc string) (*PageToken, error)

b64enc must be the base64 encoded token string, corresponding to [PageToken.Encode()]

func (*PageToken) Encode

func (pr *PageToken) Encode() string

Encode the token in base64 for transmission for the wire

Jump to

Keyboard shortcuts

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