mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 17:52:32 +00:00
Added storage limits (#28270)
This commit is contained in:
@@ -153,10 +153,19 @@ func (s *singleMonthActivityClients) populateSegments() (map[int][]*activity.Ent
|
||||
return segments, nil
|
||||
}
|
||||
|
||||
totalSegmentCount := 1
|
||||
// determine how many segments are necessary to store the clients for this month
|
||||
// using the default storage limits
|
||||
numNecessarySegments := len(s.clients) / ActivitySegmentClientCapacity
|
||||
if len(s.clients)%ActivitySegmentClientCapacity != 0 {
|
||||
numNecessarySegments++
|
||||
}
|
||||
totalSegmentCount := numNecessarySegments
|
||||
|
||||
// override the segment count if set by client
|
||||
if s.generationParameters.GetNumSegments() > 0 {
|
||||
totalSegmentCount = int(s.generationParameters.GetNumSegments())
|
||||
}
|
||||
|
||||
numNonUsable := len(skipIndexes) + len(emptyIndexes)
|
||||
usableSegmentCount := totalSegmentCount - numNonUsable
|
||||
if usableSegmentCount <= 0 {
|
||||
@@ -169,6 +178,10 @@ func (s *singleMonthActivityClients) populateSegments() (map[int][]*activity.Ent
|
||||
segmentSizes++
|
||||
}
|
||||
|
||||
if segmentSizes > ActivitySegmentClientCapacity {
|
||||
return nil, fmt.Errorf("the number of segments is too low, it must be greater than %d in order to meet storage limits", numNecessarySegments)
|
||||
}
|
||||
|
||||
clientIndex := 0
|
||||
for i := 0; i < totalSegmentCount; i++ {
|
||||
if clientIndex >= len(s.clients) {
|
||||
|
||||
Reference in New Issue
Block a user