[skip ci] Add detail comment for SegmentsInfo (#9332)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/9337/head
congqixia 2021-10-06 17:20:07 +08:00 committed by GitHub
parent 751f2b05d1
commit 5031f09073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -121,6 +121,8 @@ func (s *SegmentsInfo) AddAllocation(segmentID UniqueID, allocation *Allocation)
}
// SetCurrentRows sets rows count for segment
// if the segment is not found, do nothing
// uses `ShadowClone` since internal SegmentInfo is not changed
func (s *SegmentsInfo) SetCurrentRows(segmentID UniqueID, rows int64) {
if segment, ok := s.segments[segmentID]; ok {
s.segments[segmentID] = segment.ShadowClone(SetCurrentRows(rows))
@ -128,6 +130,8 @@ func (s *SegmentsInfo) SetCurrentRows(segmentID UniqueID, rows int64) {
}
// SetBinlogs sets binlog paths for segment
// if the segment is not found, do nothing
// uses `Clone` since internal SegmentInfo's Binlogs is changed
func (s *SegmentsInfo) SetBinlogs(segmentID UniqueID, binlogs []*datapb.FieldBinlog) {
if segment, ok := s.segments[segmentID]; ok {
s.segments[segmentID] = segment.Clone(SetBinlogs(binlogs))
@ -135,6 +139,8 @@ func (s *SegmentsInfo) SetBinlogs(segmentID UniqueID, binlogs []*datapb.FieldBin
}
// SetFlushTime sets flush time for segment
// if the segment is not found, do nothing
// uses `ShadowClone` since internal SegmentInfo is not changed
func (s *SegmentsInfo) SetFlushTime(segmentID UniqueID, t time.Time) {
if segment, ok := s.segments[segmentID]; ok {
s.segments[segmentID] = segment.ShadowClone(SetFlushTime(t))