github.com/pachyderm/pachyderm@v1.13.4/src/server/pkg/storage/fileset/index/option.go (about) 1 package index 2 3 // Option configures an index reader. 4 type Option func(r *Reader) 5 6 // PathRange is a range of paths. 7 // The range is inclusive: [Lower, Upper]. 8 type PathRange struct { 9 Lower, Upper string 10 } 11 12 // WithRange sets a range filter for the read. 13 func WithRange(pathRange *PathRange) Option { 14 return func(r *Reader) { 15 r.filter = &pathFilter{pathRange: pathRange} 16 } 17 } 18 19 // WithPrefix sets a prefix filter for the read. 20 func WithPrefix(prefix string) Option { 21 return func(r *Reader) { 22 r.filter = &pathFilter{prefix: prefix} 23 } 24 } 25 26 // WithExact adds a path filter that matches a single path 27 func WithExact(key string) Option { 28 return WithRange(&PathRange{Upper: key, Lower: key}) 29 }