util

package
v1.20.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyExportLocation added in v1.19.0

func AnyExportLocation(int) (bool, error)

Predicate matching any export location

func FindExportLocation added in v1.19.0

func FindExportLocation(locs []shares.ExportLocation, pred ExportLocationPredicate) (index int, err error)

Searches for an export location. Returns index of an export location from the `locs` slice that satisfies following rules: 1. Location is not admin-only and is not empty 2. Location satisfies ExportLocationPredicate Search is biased: 1. Location.Preferred == true is preferred over Location.Preferred == false 2. Locations with lower index are preferred over those with higher index

Types

type ExportLocationPredicate added in v1.19.0

type ExportLocationPredicate func(index int) (match bool, err error)

Predicate type for filtering out export locations. It's supplied with the index into the export location slice that's being scanned. Should return (true, nil) when search conditions are satisfied, and (false, nil) when they are not.

Jump to

Keyboard shortcuts

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