tags

package
v0.0.0-...-5487082 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	// contains filtered or unexported fields
}

Entry is used to keep track of tag slices shared by the contexts.

func (*Entry) DataSizeInBytes

func (e *Entry) DataSizeInBytes() int

DataSizeInBytes returns the size of the Entry data in bytes.

func (*Entry) Release

func (e *Entry) Release()

Release decrements internal reference counter, potentially marking the entry as unused.

Can be called concurrently with other store operations.

func (*Entry) SizeInBytes

func (e *Entry) SizeInBytes() int

SizeInBytes returns the size of the Entry in bytes.

func (*Entry) Tags

func (e *Entry) Tags() []string

Tags returns the strings stored in the Entry. The slice may be shared with other users and should not be modified. Users can keep the slice after the entry was removed from the store; it is not recycled or otherwise modified by the store.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is a reference counted container of tags slices, to be shared between contexts.

Store is generally not thread-safe, except Release may be called concurrently with other methods.

func NewStore

func NewStore(enabled bool, name string) *Store

NewStore returns new empty Store.

func (*Store) Insert

func (tc *Store) Insert(key ckey.TagsKey, tagsBuffer *tagset.HashingTagsAccumulator) *Entry

Insert returns an Entry that corresponds to the key. If the key is not in the cache, a new entry is stored in the Store with the tags retrieved from the tagsBuffer. Insert increments reference count for the returned entry; callers should call Entry.Release() when the returned pointer is no longer in use.

Store is generally not thread-safe, except Release may be called concurrently with other methods.

func (*Store) Shrink

func (tc *Store) Shrink()

Shrink will try to release memory if cache usage drops low enough.

Store is generally not thread-safe, except Release may be called concurrently with other methods.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL