Skip to content

Commit

Permalink
Added local file buffer for replication service. (#1004)
Browse files Browse the repository at this point in the history
This allows the service to store events to a local file while the
master node is down.
  • Loading branch information
scudette committed Apr 5, 2021
1 parent 029913e commit 249cfd1
Show file tree
Hide file tree
Showing 9 changed files with 720 additions and 25 deletions.
150 changes: 147 additions & 3 deletions api/mock/api_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/mock/gen.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//go:generate mockgen -destination api_mock.go www.velocidex.com/golang/velociraptor/api/proto APIClient
//go:generate mockgen -destination api_mock.go www.velocidex.com/golang/velociraptor/api/proto APIClient,API_WatchEventClient

package mock_proto
2 changes: 2 additions & 0 deletions api/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ func streamEvents(
return err
}

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

Expand Down
7 changes: 6 additions & 1 deletion services/hunt_manager/hunt_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,15 @@ func (self *HuntManager) ProcessParticipation(
participation_row.ClientId, err)
}

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

// Get hunt information about this hunt.
Expand Down

0 comments on commit 249cfd1

Please sign in to comment.