Skip to content

Commit

Permalink
Refactor of agents: new snapshot sore client, task manager, and agent…
Browse files Browse the repository at this point in the history
… api
  • Loading branch information
gdiazlo committed Apr 10, 2019
1 parent ac07447 commit eb4da9b
Show file tree
Hide file tree
Showing 10 changed files with 628 additions and 780 deletions.
394 changes: 322 additions & 72 deletions gossip/agent.go

Large diffs are not rendered by default.

280 changes: 0 additions & 280 deletions gossip/auditor/auditor.go

This file was deleted.

13 changes: 11 additions & 2 deletions gossip/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,23 @@ type Config struct {
MemberlistConfig *memberlist.Config

// Comma-delimited list of Alert servers ([host]:port), through which an agent can post alerts
AlertsUrls []string
AlertsServiceUrls []string

// QED API Key
APIKey string

// QED endpoint list
QEDUrls []string

// SnapshotStoreUrls contains the http endpoints of the snapshot store
SnapshotStoreUrls []string

// Timeout enqueuing elements on a channel
TimeoutQueues time.Duration

// Interval to send out messages to other agents
ProcessInterval time.Duration

// Address to bind the metrics endpoint
MetricsAddr string
}
Expand Down
10 changes: 5 additions & 5 deletions gossip/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ type eventDelegate struct {
func (e *eventDelegate) NotifyJoin(n *memberlist.Node) {
peer := member.ParsePeer(n)
peer.Status = member.Alive
e.agent.Topology.Update(peer)
e.agent.topology.Update(peer)
log.Debugf("member joined: %+v ", peer)
}

// NotifyLeave is invoked when a node is detected to have left.
func (e *eventDelegate) NotifyLeave(n *memberlist.Node) {
peer := member.ParsePeer(n)
e.agent.Topology.Delete(peer)
e.agent.topology.Delete(peer)
log.Debugf("member left: %+v", peer)
}

Expand All @@ -53,7 +53,7 @@ func (e *eventDelegate) NotifyLeave(n *memberlist.Node) {
func (e *eventDelegate) NotifyUpdate(n *memberlist.Node) {
// ignore
peer := member.ParsePeer(n)
e.agent.Topology.Update(peer)
e.agent.topology.Update(peer)
log.Debugf("member updated: %+v ", peer)
}

Expand All @@ -71,7 +71,7 @@ func newAgentDelegate(agent *Agent) *agentDelegate {
// when broadcasting an alive message. It's length is limited to
// the given byte size. This metadata is available in the Node structure.
func (d *agentDelegate) NodeMeta(limit int) []byte {
meta, err := d.agent.Self.Meta.Encode()
meta, err := d.agent.self.Meta.Encode()
if err != nil {
log.Fatalf("Unable to encode node metadata: %v", err)
}
Expand Down Expand Up @@ -101,7 +101,7 @@ func (d *agentDelegate) NotifyMsg(msg []byte) {
// hashs the snaapshots to deduplicate processing inside the agent
hash := hashing.NewSha256Hasher().Do(*tmp["Snapshots"])
log.Debugf("Notifying batch %v\n", hash)
d.agent.In <- &hashedBatch{&batch, hash}
d.agent.inCh <- &hashedBatch{&batch, hash}
}

// GetBroadcasts is called when user data messages can be broadcast.
Expand Down
20 changes: 20 additions & 0 deletions gossip/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
Copyright 2018-2019 Banco Bilbao Vizcaya Argentaria, S.A.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package gossip

import "errors"

var ChTimedOut error = errors.New("Timeout sending data to channel")
Loading

0 comments on commit eb4da9b

Please sign in to comment.