Discover Packages
github.com/raintank/tsdb-gw
publish
kafka
keycache
package
Version:
v0.0.0-...-7fa8e96
Opens a new window with list of versions in this module.
Published: Feb 7, 2020
License: Apache-2.0
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
Documentation
Documentation
¶
Cache is a single-tenant keycache
it is sharded for 2 reasons:
* more granular GC (eg. less latency perceived by caller)
* mild space savings cause keys are 1 byte shorter
We shard on the first byte of the metric key, which we assume
is evenly distributed.
NewCache creates a new cache
Clear resets the given shard
Len returns the length of the cache
Touch marks the key as seen and returns whether it was seen before
KeyCache tracks for all orgs, which keys have been seen, and when was the last time
NewKeyCache creates a new KeyCache
each clearInterval, all shards will be wiped
(one at a time, spread out over the interval)
Len returns the size across all orgs
Touch marks the key as seen and returns whether it was seen before
callers should assure that t >= ref and t-ref <= 42 hours
Shard tracks which SubKey's have been seen since the last prune
NewShard creates a new shard
Len returns the length of the shard
Reset resets the shard, making it empty
Touch marks the key as seen and returns whether it was seen before
SubKey is the last 15 bytes of a 16 byte Key
We can track Key-identified metrics with a SubKey because
we shard by the first byte of the Key.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.