attribute

package
v0.0.0-...-c2bd595 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package attribute is focused on enabling efficient handling and tracking of attribute usage within Mixer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBagFromProto

func GetBagFromProto(attrs *mixerpb.CompressedAttributes, globalWordList []string) (*attr.MutableBag, error)

GetBagFromProto returns an initialized bag from an Attribute proto.

func GetProtoForTesting

func GetProtoForTesting(v map[string]interface{}) *mixerpb.CompressedAttributes

GetProtoForTesting returns a CompressedAttributes struct based on the specified map Use this function only for testing purposes.

func GlobalList

func GlobalList() []string

func ToProto

func ToProto(mb *attr.MutableBag, output *mixerpb.CompressedAttributes, globalDict map[string]int32, globalWordCount int)

ToProto fills-in an Attributes proto based on the content of the bag.

func UpdateBagFromProto

func UpdateBagFromProto(mb *attr.MutableBag, attrs *mixerpb.CompressedAttributes, globalWordList []string) error

UpdateBagFromProto refreshes the bag based on the content of the attribute proto.

Note that in the case of semantic errors in the supplied proto which leads to an error return, it's likely that the bag will have been partially updated.

Types

type Bag

type Bag = attr.Bag

Exports of types for backwards compatibility

type MutableBag

type MutableBag = attr.MutableBag

Exports of types for backwards compatibility

type ProtoBag

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

ProtoBag implements the Bag interface on top of an Attributes proto.

func GetProtoBag

func GetProtoBag(proto *mixerpb.CompressedAttributes, globalDict map[string]int32, globalWordList []string) *ProtoBag

GetProtoBag returns a proto-based attribute bag. When you are done using the proto bag, call the Done method to recycle it.

func (*ProtoBag) Clear

func (pb *ProtoBag) Clear()

Clear the list of referenced attributes being tracked by this bag

func (*ProtoBag) Contains

func (pb *ProtoBag) Contains(key string) bool

Contains returns true if protobag contains this key.

func (*ProtoBag) Done

func (pb *ProtoBag) Done()

Done indicates the bag can be reclaimed.

func (*ProtoBag) Get

func (pb *ProtoBag) Get(name string) (interface{}, bool)

Get returns an attribute value.

func (*ProtoBag) GetReferencedAttributes

func (pb *ProtoBag) GetReferencedAttributes(globalDict map[string]int32, globalWordCount int) *mixerpb.ReferencedAttributes

GetReferencedAttributes returns the set of attributes that have been referenced through this bag.

func (*ProtoBag) MapReference

func (pb *ProtoBag) MapReference(name string, key string, condition attr.Presence)

func (*ProtoBag) Names

func (pb *ProtoBag) Names() []string

Names returns the names of all the attributes known to this bag.

func (*ProtoBag) Reference

func (pb *ProtoBag) Reference(name string, condition attr.Presence)

func (*ProtoBag) ReferenceTracker

func (pb *ProtoBag) ReferenceTracker() attr.ReferenceTracker

ReferenceTracker for a proto bag

func (*ProtoBag) Reset

func (pb *ProtoBag) Reset()

Reset removes all local state.

func (*ProtoBag) Restore

func (pb *ProtoBag) Restore(snap attr.ReferencedAttributeSnapshot)

Restore the list of referenced attributes being tracked by this bag

func (*ProtoBag) Snapshot

func (pb *ProtoBag) Snapshot() attr.ReferencedAttributeSnapshot

Snapshot grabs a snapshot of the currently referenced attributes

func (*ProtoBag) String

func (pb *ProtoBag) String() string

String runs through the named attributes, looks up their values, and prints them to a string.

Jump to

Keyboard shortcuts

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