var DefaultSink … type Sink … type noopSink … func (ns *noopSink) Write(*binlogpb.GrpcLogEntry) error { … } func (ns *noopSink) Close() error { … } // newWriterSink creates a binary log sink with the given writer. // // Write() marshals the proto message and writes it to the given writer. Each // message is prefixed with a 4 byte big endian unsigned integer as the length. // // No buffer is done, Close() doesn't try to close the writer. func newWriterSink(w io.Writer) Sink { … } type writerSink … func (ws *writerSink) Write(e *binlogpb.GrpcLogEntry) error { … } func (ws *writerSink) Close() error { … } type bufferedSink … func (fs *bufferedSink) Write(e *binlogpb.GrpcLogEntry) error { … } const bufFlushDuration … func (fs *bufferedSink) startFlushGoroutine() { … } func (fs *bufferedSink) Close() error { … } // NewBufferedSink creates a binary log sink with the given WriteCloser. // // Write() marshals the proto message and writes it to the given writer. Each // message is prefixed with a 4 byte big endian unsigned integer as the length. // // Content is kept in a buffer, and is flushed every 60 seconds. // // Close closes the WriteCloser. func NewBufferedSink(o io.WriteCloser) Sink { … }