MCPcopy Create free account

hub / github.com/cloudflare/golibs / functions

Functions305 in github.com/cloudflare/golibs

↓ 101 callersMethodError
()
kt/kt.go:52
↓ 40 callersMethodNBPush
Nonblocking push. If the Evict callback is not set returns the evicted item (if any), otherwise nil.
circularbuffer/circularbuffer.go:70
↓ 28 callersMethodSet
Set adds an item to the cache overwriting existing one if it exists. O(log(n)) if expiry is set, O(1) when clear.
lrucache/lrucache.go:162
↓ 27 callersMethodGet
Get a key from the cache, possibly stale. Update its LRU score. O(1)
lrucache/lrucache.go:167
↓ 16 callersMethodTouch
Mark an event happening, using given timestamp. The implementation assumes time is monotonic, the behaviour is undefined in the case of time going ba
spacesaving/rate.go:118
↓ 15 callersFunctionNewConn
NewConn creates a connection to an Kyoto Tycoon endpoint.
kt/kt.go:238
↓ 14 callersFunctionhaltServer
(cmd *exec.Cmd, t testing.TB)
kt/kt_base_test.go:85
↓ 13 callersFunctionstartServer
(t testing.TB)
kt/kt_base_test.go:58
↓ 12 callersMethodGet
Get selects an arbitrary item from the Pool, removes it from the Pool, and returns it to the caller. Get may choose to ignore the pool and treat it as
pool/pool.go:80
↓ 12 callersFunctionbenchmark
(bb *testing.B, n int, hitrate float64)
spacesaving/rate_test.go:207
↓ 11 callersMethodPut
Put the byte slice back in pool.
bytepool/bytepool.go:48
↓ 11 callersMethodSet
(key string, value interface{}, expire time.Time)
lrucache/multilru.go:44
↓ 11 callersMethodset
Set stores the data at key
kt/kt.go:464
↓ 10 callersMethodSet
Methods use time.Now() when neccessary to determine expiry. Add an item to the cache overwriting existing one if it exists.
lrucache/cache.go:50
↓ 10 callersMethodentries
Get number of entries, for debugging
bytepool/bytepool.go:103
↓ 10 callersFunctionrandomString
(l int)
lrucache/lrucache_test.go:272
↓ 9 callersMethodLen
Number of entries used in the LRU
lrucache/cache.go:42
↓ 9 callersMethodbucketNo
(key string)
lrucache/multilru.go:39
↓ 8 callersMethodLen
Number of entries used in the LRU
lrucache/lrucache.go:301
↓ 8 callersFunctionNewCircularBuffer
Create CircularBuffer object with a prealocated buffer of a given size.
circularbuffer/circularbuffer.go:60
↓ 8 callersFunctionNewLRUCache
Create new LRU cache instance. Allocate all the needed memory. O(capacity)
lrucache/lrucache.go:53
↓ 7 callersMethodGet
Methods not needing to know current time. Get a key from the cache, possibly stale. Update its LRU score.
lrucache/cache.go:34
↓ 7 callersMethodGetBulkBytes
GetBulkBytes retrieves the keys in the map. The results will be filled in on function return. If a key was not found in the database, it will be remov
kt/kt.go:483
↓ 7 callersMethodInit
Initialize already allocated Rate structure. Size stands for number of items to track in the stream. HalfLife determines the time required half-charg
spacesaving/rate.go:97
↓ 7 callersMethodPut
Put adds x to the pool.
pool/pool.go:53
↓ 7 callersMethodUpdate
Update moving average with the value, using given time as weight Returns updated moving avarage.
ewma/ewma.go:61
↓ 7 callersMethodinsert
insert inserts e after at, increments l.len, and returns e.
lrucache/list.go:118
↓ 6 callersFunctioncmp
(a, b []int)
circularbuffer/circularbuffer_test.go:173
↓ 6 callersMethoddoRPC
Do an RPC call against the KT endpoint.
kt/kt.go:628
↓ 6 callersFunctiondrain
(c *CircularBuffer)
circularbuffer/circularbuffer_test.go:165
↓ 6 callersMethodinsertValue
insertValue is a convenience wrapper for insert(&Element{Value: v}, at).
lrucache/list.go:130
↓ 6 callersFunctionlog2Ceil
Equivalent to: uint(math.Ceil(math.Log2(float64(n))))
bytepool/bytepool.go:128
↓ 6 callersMethodremoveEntry
Move entry from used/lru list to a free list. Clear the entry as well.
lrucache/lrucache.go:99
↓ 6 callersMethodverifyIsEmpty
()
circularbuffer/circularbuffer_test.go:9
↓ 5 callersMethodGet
Get a byte slice from the pool.
bytepool/bytepool.go:61
↓ 5 callersMethodGetAll
GetAll gets the lower and upper bounds of a range for all tracked elements The items are sorted by decreasing upper bound. Complexity is O(k*log(k))
spacesaving/rate.go:174
↓ 5 callersMethodRemove
Remove removes e from l if e is an element of list l. It returns the element value e.Value.
lrucache/list.go:147
↓ 5 callersFunctioncreateFilledBucket
(expire time.Time)
lrucache/lrucache_test.go:280
↓ 5 callersFunctionmakeError
TODO: make this return errors that can be introspected more easily and make it trim components of the error to filter out unused information.
kt/kt.go:893
↓ 5 callersMethodrecount
(rate float64, lastTs, now int64)
spacesaving/rate.go:154
↓ 5 callersMethodremove
remove removes e from its list, decrements l.len, and returns e.
lrucache/list.go:135
↓ 4 callersMethodClear
Evict all items from the cache. O(n*log(n))
lrucache/lrucache.go:259
↓ 4 callersMethodClose
()
pool/pool.go:101
↓ 4 callersMethodCurrent
Current reads the rate of events per second, with specified current time.
ewma/rate.go:58
↓ 4 callersMethodFront
Front returns the first element of list l or nil
lrucache/list.go:102
↓ 4 callersMethodGet
(key string)
lrucache/benchmark/main.go:23
↓ 4 callersMethodGet
Get an item from the beginning of the queue (oldest), blocking.
circularbuffer/circularbuffer.go:137
↓ 4 callersMethodInit
Initialize BytePool structure. Starts draining regularly if drainPeriod is non zero. MaxSize specifies the maximum length of a byte slice that should
bytepool/bytepool.go:28
↓ 4 callersMethodLen
()
lrucache/multilru.go:88
↓ 4 callersMethodMatchPrefix
MatchPrefix performs the match_prefix operation against the server It returns a sorted list of strings. The error may be ErrSuccess in the case that n
kt/kt.go:576
↓ 4 callersMethodSet
(key string, value string)
lrucache/benchmark/main.go:22
↓ 4 callersFunctionfindRec
(kvs []KV, key string)
kt/kt.go:901
↓ 4 callersFunctionlog2Floor
Equivalent to: uint(math.Floor(math.Log2(float64(n)))) via: http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn
bytepool/bytepool.go:118
↓ 4 callersMethodremove
(ctx context.Context, key string)
kt/kt.go:369
↓ 3 callersMethodCheckConn
CheckConn can be used to check connection to Kyoto Tycoon endpoint is working as expected.
kt/kt.go:286
↓ 3 callersMethodDel
Del gets and remove a key from the cache. O(log(n)) if the item is using expiry, O(1) otherwise.
lrucache/lrucache.go:244
↓ 3 callersMethodDial
(network, address string)
kt/kt.go:298
↓ 3 callersMethodDrain
()
pool/pool.go:95
↓ 3 callersMethodDrain
Drain removes all items from the pool and make them availabe for garbage collection.
bytepool/bytepool.go:84
↓ 3 callersMethodGet
Get retrieves the data stored at key. ErrNotFound is returned if no such data exists
kt/kt.go:418
↓ 3 callersMethodGetBulk
GetBulk retrieves the keys in the map. The results will be filled in on function return. If a key was not found in the database, it will be removed fr
kt/kt.go:392
↓ 3 callersMethodGetBytes
GetBytes retrieves the data stored at key in the format of a byte slice ErrNotFound is returned if no such data is found.
kt/kt.go:456
↓ 3 callersMethodGetNotStale
GetNotStale gets a key from the cache, make sure it's not stale. Update its LRU score. O(log(n)) if the item is expired.
lrucache/lrucache.go:195
↓ 3 callersMethodNBOptionalPush
Nonblocking push. Push only if there is space. Otherwise evict v.
circularbuffer/circularbuffer.go:105
↓ 3 callersMethodNext
Next returns the next list element or nil.
lrucache/list.go:64
↓ 3 callersMethodSetNow
(key string, value interface{}, expire time.Time, now time.Time)
lrucache/multilru.go:48
↓ 3 callersMethodTouch
Touch finds the token bucket for d, takes a token out of it and reports if there are still tokens left in the bucket.
tokenbucket/bucket.go:63
↓ 3 callersMethoddoREST
(ctx context.Context, op string, key string, val []byte)
kt/kt.go:913
↓ 3 callersFunctionfilledMultiLRU
(expire time.Time)
lrucache/multilru_test.go:97
↓ 3 callersMethodtouchEntry
(e *entry)
lrucache/lrucache.go:127
↓ 2 callersMethodBack
Back returns the last element of list l or nil.
lrucache/list.go:110
↓ 2 callersMethodClear
()
lrucache/multilru.go:80
↓ 2 callersMethodClose
Stop the drain ticker.
bytepool/bytepool.go:94
↓ 2 callersMethodCount
Count returns the number of records in the database
kt/kt.go:350
↓ 2 callersMethodCurrentNow
CurrentNow reads the rate of events per second. Uses system clock to determine current time.
ewma/rate.go:53
↓ 2 callersMethodDel
Get and remove a key from the cache.
lrucache/cache.go:38
↓ 2 callersMethodDel
(key string)
lrucache/multilru.go:76
↓ 2 callersMethodExpire
Evict all the expired items. O(n*log(n))
lrucache/lrucache.go:279
↓ 2 callersMethodGetQuiet
(key string)
lrucache/multilru.go:56
↓ 2 callersMethodGetQuiet
GetQuiet gets a key from the cache, possibly stale. Don't modify its LRU score. O(1)
lrucache/lrucache.go:181
↓ 2 callersFunctionNewEwma
Allocate a new NewEwma structure halfLife it the time takes for a half charge or half discharge
ewma/ewma.go:30
↓ 2 callersFunctionNewEwmaRate
Allocate a new NewEwmaRate structure halfLife it the time takes for a half charge or half discharge
ewma/rate.go:23
↓ 2 callersFunctionNewMCache
(capacity uint64, newCache makeCache)
lrucache/benchmark/mcache.go:26
↓ 2 callersFunctionNewMultiLRUCache
(buckets, bucket_capacity uint)
lrucache/multilru.go:33
↓ 2 callersMethodPop
Blocking pop an item from the end of the queue (newest), blocking.
circularbuffer/circularbuffer.go:155
↓ 2 callersMethodPushElementFront
(e *element)
lrucache/list_extension.go:7
↓ 2 callersMethodSetNow
SetNow adds an item to the cache overwriting existing one if it exists. Allows specifing current time required to expire an item when no more slots ar
lrucache/lrucache.go:135
↓ 2 callersMethodUpdate
Notify of an event happening, with specified current time. Returns current rate.
ewma/rate.go:45
↓ 2 callersMethodcount
(next float64, timeDelta time.Duration)
ewma/ewma.go:44
↓ 2 callersMethoddoGet
doGet perform http request to retrieve the value associated with key
kt/kt.go:430
↓ 2 callersMethoddoGetBulkBytes
doGetBulkBytes retrieves the keys in the map. The results will be filled in on function return. If a key was not found in the database, it will be rem
kt/kt.go:495
↓ 2 callersMethodexpiredEntry
Give me the entry with lowest expiry field if it's before now.
lrucache/lrucache.go:60
↓ 2 callersFunctionexpiryCertMetric
(certFile string)
kt/kt.go:74
↓ 2 callersMethodleastUsedEntry
Give me the least used entry.
lrucache/lrucache.go:77
↓ 2 callersMethodmakeRequest
(ctx context.Context, method string, url *url.URL, headers http.Header, body []byte)
kt/kt.go:680
↓ 2 callersFunctionnewConn
KT has 2 interfaces, A restful one and an RPC one. The RESTful interface is usually much faster than the RPC one, but not all methods are implemented.
kt/kt.go:189
↓ 2 callersFunctionnewTLSClientConfig
(rootPath string, certPath string, keyPath string)
kt/kt.go:165
↓ 2 callersFunctionrec
(foo func())
lrucache/lrucache_test.go:187
↓ 2 callersMethodrecount
(rate float64, lastTs, now int64)
spacesaving/srate.go:81
↓ 2 callersMethodremoveBulk
(ctx context.Context, keys []string)
kt/kt.go:551
next →1–100 of 305, ranked by callers