Skip to content

Commit 249cfd1

Browse files
authored
Added local file buffer for replication service. (#1004)
This allows the service to store events to a local file while the master node is down.
1 parent 029913e commit 249cfd1

File tree

9 files changed

+720
-25
lines changed

9 files changed

+720
-25
lines changed

api/mock/api_mock.go

Lines changed: 147 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/mock/gen.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
//go:generate mockgen -destination api_mock.go www.velocidex.com/golang/velociraptor/api/proto APIClient
1+
//go:generate mockgen -destination api_mock.go www.velocidex.com/golang/velociraptor/api/proto APIClient,API_WatchEventClient
22

33
package mock_proto

api/replication.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ func streamEvents(
3737
return err
3838
}
3939

40+
// The API service is running on the master only! This means
41+
// the journal service is local.
4042
output_chan, cancel := journal.Watch(ctx, in.Queue)
4143
defer cancel()
4244

services/hunt_manager/hunt_manager.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,15 @@ func (self *HuntManager) ProcessParticipation(
272272
participation_row.ClientId, err)
273273
}
274274

275+
// If the hunt ran on the client already we just ignore
276+
// it. This is possible because the client may not have
277+
// updated its last hunt number in time to have a number of
278+
// hunt participation messages sent for it from different
279+
// frontends.
275280
err = checkHuntRanOnClient(config_obj, participation_row.ClientId,
276281
participation_row.HuntId)
277282
if err != nil {
278-
return err
283+
return nil
279284
}
280285

281286
// Get hunt information about this hunt.

0 commit comments

Comments
 (0)