1 package httpreaderat 2 3 import "vimagination.zapto.org/cache" 4 5 // Option is an option that can be parsed to NewRequest. 6 type Option func(*Request) 7 8 // SetLength sets the maximum length of the remote object, bypassing the 9 // automatic detection. 10 func SetLength(length int64) Option { 11 return func(r *Request) { 12 r.length = length 13 } 14 } 15 16 // BlockSize changes the store block size from the default 4KB. 17 func BlockSize(size int64) Option { 18 return func(r *Request) { 19 r.blockSize = size 20 } 21 } 22 23 // CacheCount changes the number of cached blocks from 256. 24 func CacheCount(count uint64) Option { 25 return func(r *Request) { 26 r.cache = cache.NewLRU[int64, string](count) 27 } 28 } 29