Documentation ¶
Overview ¶
Package attribute is focused on enabling efficient handling and tracking of attribute usage within Mixer.
Index ¶
- func GetBagFromProto(attrs *mixerpb.CompressedAttributes, globalWordList []string) (*attr.MutableBag, error)
- func GetProtoForTesting(v map[string]interface{}) *mixerpb.CompressedAttributes
- func GlobalList() []string
- func ToProto(mb *attr.MutableBag, output *mixerpb.CompressedAttributes, ...)
- func UpdateBagFromProto(mb *attr.MutableBag, attrs *mixerpb.CompressedAttributes, ...) error
- type Bag
- type MutableBag
- type ProtoBag
- func (pb *ProtoBag) Clear()
- func (pb *ProtoBag) Contains(key string) bool
- func (pb *ProtoBag) Done()
- func (pb *ProtoBag) Get(name string) (interface{}, bool)
- func (pb *ProtoBag) GetReferencedAttributes(globalDict map[string]int32, globalWordCount int) *mixerpb.ReferencedAttributes
- func (pb *ProtoBag) MapReference(name string, key string, condition attr.Presence)
- func (pb *ProtoBag) Names() []string
- func (pb *ProtoBag) Reference(name string, condition attr.Presence)
- func (pb *ProtoBag) ReferenceTracker() attr.ReferenceTracker
- func (pb *ProtoBag) Reset()
- func (pb *ProtoBag) Restore(snap attr.ReferencedAttributeSnapshot)
- func (pb *ProtoBag) Snapshot() attr.ReferencedAttributeSnapshot
- func (pb *ProtoBag) String() string
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 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) 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 (*ProtoBag) ReferenceTracker ¶
func (pb *ProtoBag) ReferenceTracker() attr.ReferenceTracker
ReferenceTracker for a proto bag
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