Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions internal/difc/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func (a *AgentLabels) DropIntegrityTag(tag Tag) {

// DropIntegrityTags removes multiple integrity tags from the agent
func (a *AgentLabels) DropIntegrityTags(tags []Tag) {
logAgent.Printf("Agent %s dropping %d integrity tags", a.AgentID, len(tags))
a.mu.Lock()
defer a.mu.Unlock()
a.Integrity.Label.RemoveAll(tags)
Expand All @@ -89,6 +90,7 @@ func (a *AgentLabels) DropIntegrityTags(tags []Tag) {

// AddSecrecyTags adds multiple secrecy tags to the agent
func (a *AgentLabels) AddSecrecyTags(tags []Tag) {
logAgent.Printf("Agent %s adding %d secrecy tags", a.AgentID, len(tags))
a.mu.Lock()
defer a.mu.Unlock()
a.Secrecy.Label.AddAll(tags)
Expand All @@ -99,6 +101,7 @@ func (a *AgentLabels) AddSecrecyTags(tags []Tag) {

// AddIntegrityTags adds multiple integrity tags to the agent
func (a *AgentLabels) AddIntegrityTags(tags []Tag) {
logAgent.Printf("Agent %s adding %d integrity tags", a.AgentID, len(tags))
a.mu.Lock()
defer a.mu.Unlock()
a.Integrity.Label.AddAll(tags)
Expand Down Expand Up @@ -169,6 +172,7 @@ func (a *AgentLabels) AccumulateFromRead(resource *LabeledResource) {

// Clone creates a copy of the agent labels
func (a *AgentLabels) Clone() *AgentLabels {
logAgent.Printf("Cloning agent labels: agentID=%s", a.AgentID)
a.mu.RLock()
defer a.mu.RUnlock()

Expand Down Expand Up @@ -215,6 +219,7 @@ func NewAgentRegistry() *AgentRegistry {

// NewAgentRegistryWithDefaults creates a registry with default labels for new agents
func NewAgentRegistryWithDefaults(defaultSecrecy []Tag, defaultIntegrity []Tag) *AgentRegistry {
logAgent.Printf("Creating agent registry with defaults: secrecyTags=%d, integrityTags=%d", len(defaultSecrecy), len(defaultIntegrity))
return &AgentRegistry{
agents: make(map[string]*AgentLabels),
defaultSecrecy: defaultSecrecy,
Expand Down Expand Up @@ -309,6 +314,7 @@ func (r *AgentRegistry) GetAllAgentIDs() []string {

// SetDefaultLabels sets the default labels for new agents
func (r *AgentRegistry) SetDefaultLabels(secrecy []Tag, integrity []Tag) {
logAgent.Printf("Setting default labels: secrecyTags=%v, integrityTags=%v", secrecy, integrity)
r.mu.Lock()
defer r.mu.Unlock()
r.defaultSecrecy = secrecy
Expand Down
Loading