MCPcopy
hub / github.com/klauspost/compress / Flush

Method Flush

zstd/encoder.go:547–570  ·  view source on GitHub ↗

Flush will send the currently written data to output and block until everything has been written. This should only be used on rare occasions where pushing the currently queued data is critical.

()

Source from the content-addressed store, hash-verified

545// and block until everything has been written.
546// This should only be used on rare occasions where pushing the currently queued data is critical.
547func (e *Encoder) Flush() error {
548 s := &e.state
549 if e.o.concurrentBlocks {
550 return e.flushJobs()
551 }
552 if len(s.filling) > 0 {
553 err := e.nextBlock(false)
554 if err != nil {
555 if errors.Is(s.err, ErrEncoderClosed) {
556 return nil
557 }
558 return err
559 }
560 }
561 s.wg.Wait()
562 s.wWg.Wait()
563 if s.err != nil {
564 if errors.Is(s.err, ErrEncoderClosed) {
565 return nil
566 }
567 return s.err
568 }
569 return s.writeErr
570}
571
572func (e *Encoder) flushJobs() error {
573 js := &e.state.jobs

Callers

nothing calls this directly

Calls 2

flushJobsMethod · 0.95
nextBlockMethod · 0.95

Tested by

no test coverage detected