github.com/yandex/pandora@v0.5.32/components/providers/grpc/ammo.go (about)

     1  package ammo
     2  
     3  type Ammo struct {
     4  	Tag       string                 `json:"tag"`
     5  	Call      string                 `json:"call"`
     6  	Metadata  map[string]string      `json:"metadata"`
     7  	Payload   map[string]interface{} `json:"payload"`
     8  	id        uint64
     9  	isInvalid bool
    10  }
    11  
    12  func (a *Ammo) Reset(tag string, call string, metadata map[string]string, payload map[string]interface{}) {
    13  	*a = Ammo{tag, call, metadata, payload, 0, false}
    14  }
    15  
    16  func (a *Ammo) SetID(id uint64) {
    17  	a.id = id
    18  }
    19  
    20  func (a *Ammo) ID() uint64 {
    21  	return a.id
    22  }
    23  
    24  func (a *Ammo) Invalidate() {
    25  	a.isInvalid = true
    26  }
    27  
    28  func (a *Ammo) IsInvalid() bool {
    29  	return a.isInvalid
    30  }
    31  
    32  func (a *Ammo) IsValid() bool {
    33  	return !a.isInvalid
    34  }