// CompressBeforeSize compresses all segments prior to the given size
CompressBeforeSize compresses all segments prior to the given size
// CompressBeforeSize compresses all segments prior to the given size
func (wal *WAL) CompressBeforeSize(limit int64) error {
	seen := int64(0)
	return wal.forEachSegmentInReverse(func(file os.FileInfo, first bool, last bool) (bool, error) {
		if last {
			return true, nil
		}
		next := file.Size()
		seen += next
		if seen > limit {
			return wal.compress(file)
		}
		return true, nil
	})
}
func ( wal * WAL ) CompressBeforeSize ( limit int64 ) error { seen := int64 ( 0 ) return wal . forEachSegmentInReverse ( func ( file os . FileInfo , first bool , last bool ) ( bool , error ) { if last { return true , nil } next := file . Size ( ) seen += next if seen > limit { return wal . compress ( file ) } return true , nil } ) }
CompressBeforeSize compresses all segments prior to the given size
CompressBeforeSize compresses all segments prior to the given size
// Don't compress the last (active) file