Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/cloudflare/golibs
/ functions
Functions
305 in github.com/cloudflare/golibs
⨍
Functions
305
◇
Types & classes
46
↓ 101 callers
Method
Error
()
kt/kt.go:52
↓ 40 callers
Method
NBPush
Nonblocking push. If the Evict callback is not set returns the evicted item (if any), otherwise nil.
circularbuffer/circularbuffer.go:70
↓ 28 callers
Method
Set
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 callers
Method
Get
Get a key from the cache, possibly stale. Update its LRU score. O(1)
lrucache/lrucache.go:167
↓ 16 callers
Method
Touch
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 callers
Function
NewConn
NewConn creates a connection to an Kyoto Tycoon endpoint.
kt/kt.go:238
↓ 14 callers
Function
haltServer
(cmd *exec.Cmd, t testing.TB)
kt/kt_base_test.go:85
↓ 13 callers
Function
startServer
(t testing.TB)
kt/kt_base_test.go:58
↓ 12 callers
Method
Get
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 callers
Function
benchmark
(bb *testing.B, n int, hitrate float64)
spacesaving/rate_test.go:207
↓ 11 callers
Method
Put
Put the byte slice back in pool.
bytepool/bytepool.go:48
↓ 11 callers
Method
Set
(key string, value interface{}, expire time.Time)
lrucache/multilru.go:44
↓ 11 callers
Method
set
Set stores the data at key
kt/kt.go:464
↓ 10 callers
Method
Set
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 callers
Method
entries
Get number of entries, for debugging
bytepool/bytepool.go:103
↓ 10 callers
Function
randomString
(l int)
lrucache/lrucache_test.go:272
↓ 9 callers
Method
Len
Number of entries used in the LRU
lrucache/cache.go:42
↓ 9 callers
Method
bucketNo
(key string)
lrucache/multilru.go:39
↓ 8 callers
Method
Len
Number of entries used in the LRU
lrucache/lrucache.go:301
↓ 8 callers
Function
NewCircularBuffer
Create CircularBuffer object with a prealocated buffer of a given size.
circularbuffer/circularbuffer.go:60
↓ 8 callers
Function
NewLRUCache
Create new LRU cache instance. Allocate all the needed memory. O(capacity)
lrucache/lrucache.go:53
↓ 7 callers
Method
Get
Methods not needing to know current time. Get a key from the cache, possibly stale. Update its LRU score.
lrucache/cache.go:34
↓ 7 callers
Method
GetBulkBytes
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 callers
Method
Init
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 callers
Method
Put
Put adds x to the pool.
pool/pool.go:53
↓ 7 callers
Method
Update
Update moving average with the value, using given time as weight Returns updated moving avarage.
ewma/ewma.go:61
↓ 7 callers
Method
insert
insert inserts e after at, increments l.len, and returns e.
lrucache/list.go:118
↓ 6 callers
Function
cmp
(a, b []int)
circularbuffer/circularbuffer_test.go:173
↓ 6 callers
Method
doRPC
Do an RPC call against the KT endpoint.
kt/kt.go:628
↓ 6 callers
Function
drain
(c *CircularBuffer)
circularbuffer/circularbuffer_test.go:165
↓ 6 callers
Method
insertValue
insertValue is a convenience wrapper for insert(&Element{Value: v}, at).
lrucache/list.go:130
↓ 6 callers
Function
log2Ceil
Equivalent to: uint(math.Ceil(math.Log2(float64(n))))
bytepool/bytepool.go:128
↓ 6 callers
Method
removeEntry
Move entry from used/lru list to a free list. Clear the entry as well.
lrucache/lrucache.go:99
↓ 6 callers
Method
verifyIsEmpty
()
circularbuffer/circularbuffer_test.go:9
↓ 5 callers
Method
Get
Get a byte slice from the pool.
bytepool/bytepool.go:61
↓ 5 callers
Method
GetAll
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 callers
Method
Remove
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 callers
Function
createFilledBucket
(expire time.Time)
lrucache/lrucache_test.go:280
↓ 5 callers
Function
makeError
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 callers
Method
recount
(rate float64, lastTs, now int64)
spacesaving/rate.go:154
↓ 5 callers
Method
remove
remove removes e from its list, decrements l.len, and returns e.
lrucache/list.go:135
↓ 4 callers
Method
Clear
Evict all items from the cache. O(n*log(n))
lrucache/lrucache.go:259
↓ 4 callers
Method
Close
()
pool/pool.go:101
↓ 4 callers
Method
Current
Current reads the rate of events per second, with specified current time.
ewma/rate.go:58
↓ 4 callers
Method
Front
Front returns the first element of list l or nil
lrucache/list.go:102
↓ 4 callers
Method
Get
(key string)
lrucache/benchmark/main.go:23
↓ 4 callers
Method
Get
Get an item from the beginning of the queue (oldest), blocking.
circularbuffer/circularbuffer.go:137
↓ 4 callers
Method
Init
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 callers
Method
Len
()
lrucache/multilru.go:88
↓ 4 callers
Method
MatchPrefix
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 callers
Method
Set
(key string, value string)
lrucache/benchmark/main.go:22
↓ 4 callers
Function
findRec
(kvs []KV, key string)
kt/kt.go:901
↓ 4 callers
Function
log2Floor
Equivalent to: uint(math.Floor(math.Log2(float64(n)))) via: http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn
bytepool/bytepool.go:118
↓ 4 callers
Method
remove
(ctx context.Context, key string)
kt/kt.go:369
↓ 3 callers
Method
CheckConn
CheckConn can be used to check connection to Kyoto Tycoon endpoint is working as expected.
kt/kt.go:286
↓ 3 callers
Method
Del
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 callers
Method
Dial
(network, address string)
kt/kt.go:298
↓ 3 callers
Method
Drain
()
pool/pool.go:95
↓ 3 callers
Method
Drain
Drain removes all items from the pool and make them availabe for garbage collection.
bytepool/bytepool.go:84
↓ 3 callers
Method
Get
Get retrieves the data stored at key. ErrNotFound is returned if no such data exists
kt/kt.go:418
↓ 3 callers
Method
GetBulk
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 callers
Method
GetBytes
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 callers
Method
GetNotStale
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 callers
Method
NBOptionalPush
Nonblocking push. Push only if there is space. Otherwise evict v.
circularbuffer/circularbuffer.go:105
↓ 3 callers
Method
Next
Next returns the next list element or nil.
lrucache/list.go:64
↓ 3 callers
Method
SetNow
(key string, value interface{}, expire time.Time, now time.Time)
lrucache/multilru.go:48
↓ 3 callers
Method
Touch
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 callers
Method
doREST
(ctx context.Context, op string, key string, val []byte)
kt/kt.go:913
↓ 3 callers
Function
filledMultiLRU
(expire time.Time)
lrucache/multilru_test.go:97
↓ 3 callers
Method
touchEntry
(e *entry)
lrucache/lrucache.go:127
↓ 2 callers
Method
Back
Back returns the last element of list l or nil.
lrucache/list.go:110
↓ 2 callers
Method
Clear
()
lrucache/multilru.go:80
↓ 2 callers
Method
Close
Stop the drain ticker.
bytepool/bytepool.go:94
↓ 2 callers
Method
Count
Count returns the number of records in the database
kt/kt.go:350
↓ 2 callers
Method
CurrentNow
CurrentNow reads the rate of events per second. Uses system clock to determine current time.
ewma/rate.go:53
↓ 2 callers
Method
Del
Get and remove a key from the cache.
lrucache/cache.go:38
↓ 2 callers
Method
Del
(key string)
lrucache/multilru.go:76
↓ 2 callers
Method
Expire
Evict all the expired items. O(n*log(n))
lrucache/lrucache.go:279
↓ 2 callers
Method
GetQuiet
(key string)
lrucache/multilru.go:56
↓ 2 callers
Method
GetQuiet
GetQuiet gets a key from the cache, possibly stale. Don't modify its LRU score. O(1)
lrucache/lrucache.go:181
↓ 2 callers
Function
NewEwma
Allocate a new NewEwma structure halfLife it the time takes for a half charge or half discharge
ewma/ewma.go:30
↓ 2 callers
Function
NewEwmaRate
Allocate a new NewEwmaRate structure halfLife it the time takes for a half charge or half discharge
ewma/rate.go:23
↓ 2 callers
Function
NewMCache
(capacity uint64, newCache makeCache)
lrucache/benchmark/mcache.go:26
↓ 2 callers
Function
NewMultiLRUCache
(buckets, bucket_capacity uint)
lrucache/multilru.go:33
↓ 2 callers
Method
Pop
Blocking pop an item from the end of the queue (newest), blocking.
circularbuffer/circularbuffer.go:155
↓ 2 callers
Method
PushElementFront
(e *element)
lrucache/list_extension.go:7
↓ 2 callers
Method
SetNow
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 callers
Method
Update
Notify of an event happening, with specified current time. Returns current rate.
ewma/rate.go:45
↓ 2 callers
Method
count
(next float64, timeDelta time.Duration)
ewma/ewma.go:44
↓ 2 callers
Method
doGet
doGet perform http request to retrieve the value associated with key
kt/kt.go:430
↓ 2 callers
Method
doGetBulkBytes
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 callers
Method
expiredEntry
Give me the entry with lowest expiry field if it's before now.
lrucache/lrucache.go:60
↓ 2 callers
Function
expiryCertMetric
(certFile string)
kt/kt.go:74
↓ 2 callers
Method
leastUsedEntry
Give me the least used entry.
lrucache/lrucache.go:77
↓ 2 callers
Method
makeRequest
(ctx context.Context, method string, url *url.URL, headers http.Header, body []byte)
kt/kt.go:680
↓ 2 callers
Function
newConn
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 callers
Function
newTLSClientConfig
(rootPath string, certPath string, keyPath string)
kt/kt.go:165
↓ 2 callers
Function
rec
(foo func())
lrucache/lrucache_test.go:187
↓ 2 callers
Method
recount
(rate float64, lastTs, now int64)
spacesaving/srate.go:81
↓ 2 callers
Method
removeBulk
(ctx context.Context, keys []string)
kt/kt.go:551
next →
1–100 of 305, ranked by callers