Skip to content

Commit

Permalink
VAULT-27563 CE changes
Browse files Browse the repository at this point in the history
  • Loading branch information
VioletHynes committed Jul 23, 2024
1 parent 74d15e3 commit 92224ae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
25 changes: 4 additions & 21 deletions vault/activity_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ type ActivityLog struct {

// nodeID is the ID to use for all fragments that
// are generated.
// TODO: use secondary ID when available?
// This uses the primary ID as of right now, but
// could be adapted to use a secondary in the future.
nodeID string

// current log fragment (may be nil)
Expand Down Expand Up @@ -187,14 +188,6 @@ type ActivityLog struct {

inprocessExport *atomic.Bool

// CensusReportDone is a channel used to signal tests upon successful calls
// to (CensusReporter).Write() in CensusReport.
CensusReportDone chan bool

// CensusReportInterval is the testing configuration for time between
// Write() calls initiated in CensusReport.
CensusReportInterval time.Duration

// clock is used to support manipulating time in unit and integration tests
clock timeutil.Clock
// precomputedQueryWritten receives an element whenever a precomputed query
Expand All @@ -214,9 +207,6 @@ type ActivityLogCoreConfig struct {
// Do not start timers to send or persist fragments.
DisableTimers bool

// CensusReportInterval is the testing configuration for time
CensusReportInterval time.Duration

// MinimumRetentionMonths defines the minimum value for retention
MinimumRetentionMonths int

Expand Down Expand Up @@ -249,7 +239,6 @@ func NewActivityLog(core *Core, logger log.Logger, view *BarrierView, metrics me
sendCh: make(chan struct{}, 1), // buffered so it can be triggered by fragment size
doneCh: make(chan struct{}, 1),
partialMonthClientTracker: make(map[string]*activity.EntityRecord),
CensusReportInterval: time.Hour * 1,
clock: clock,
currentSegment: segmentInfo{
startTimestamp: 0,
Expand Down Expand Up @@ -998,7 +987,7 @@ func (a *ActivityLog) refreshFromStoredLog(ctx context.Context, wg *sync.WaitGro
return nil
}

// This version is used during construction
// SetConfigInit is used during construction
func (a *ActivityLog) SetConfigInit(config activityConfig) {
switch config.Enabled {
case "enable":
Expand All @@ -1020,13 +1009,9 @@ func (a *ActivityLog) SetConfigInit(config activityConfig) {
if a.configOverrides.MinimumRetentionMonths > 0 {
a.retentionMonths = a.configOverrides.MinimumRetentionMonths
}

if a.configOverrides.CensusReportInterval > 0 {
a.CensusReportInterval = a.configOverrides.CensusReportInterval
}
}

// This version reacts to user changes
// SetConfig reacts to user changes
func (a *ActivityLog) SetConfig(ctx context.Context, config activityConfig) {
a.l.Lock()
defer a.l.Unlock()
Expand Down Expand Up @@ -1948,8 +1933,6 @@ type activityConfig struct {

// Enabled is one of enable, disable, default.
Enabled string `json:"enabled"`

CensusReportInterval time.Duration `json:"census_report_interval"`
}

func defaultActivityConfig() activityConfig {
Expand Down
6 changes: 6 additions & 0 deletions vault/census_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,9 @@ func (c *Core) setupCensusManager(ctx context.Context) error {
func (cm *CensusManager) BillingStart() time.Time {
return time.Time{}
}
<<<<<<< ours
=======

// StartManualReportingSnapshots is a stub for CE.
func (cm *CensusManager) StartManualReportingSnapshots() {}
>>>>>>> theirs
4 changes: 0 additions & 4 deletions vault/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -2467,10 +2467,6 @@ func (s standardUnsealStrategy) unseal(ctx context.Context, logger log.Logger, c
if err := c.setupCensusManager(ctx); err != nil {
return err
}

c.StartCensusReports(ctx)
c.StartManualCensusSnapshots()

} else {
brokerLogger := logger.Named("audit")
broker, err := audit.NewBroker(brokerLogger)
Expand Down

0 comments on commit 92224ae

Please sign in to comment.