EventReader is the common reader interface for all mysql binary log event streams. NOTE: The EventReader interface purposely does not support jumping to a specific log position offset because skipping is very error prone. WaitForEvent is threadsafe; none of the other methods are threadsafe.
| 17 | // jumping to a specific log position offset because skipping is very error |
| 18 | // prone. WaitForEvent is threadsafe; none of the other methods are threadsafe. |
| 19 | type EventReader interface { |
| 20 | // NextEvent returns the next available event from the event stream. |
| 21 | NextEvent() (Event, error) |
| 22 | |
| 23 | // Close closes the reader. Subsequent calls to NextEvent will return |
| 24 | // an error. |
| 25 | Close() error |
| 26 | |
| 27 | // peekHeaderBytes returns up to sizeOfBasicV4EventHeader number of bytes |
| 28 | // from the event header. This is used for checking binlog magic marker |
| 29 | // and format version at the beginning of the event stream. |
| 30 | peekHeaderBytes(numBytes int) ([]byte, error) |
| 31 | |
| 32 | // consumeHeaderBytes will discard up to sizeOfBasicV4EventHeader number |
| 33 | // of bytes from the event header. This is used for throwing away the |
| 34 | // binlog magic marker at the beginning of the event stream. |
| 35 | consumeHeaderBytes(numBytes int) error |
| 36 | |
| 37 | // nextEventEndPosition returns the next event's end position relative to |
| 38 | // the source io stream. Note the value is an underestimate when the |
| 39 | // next event's common header is not yet parsed. |
| 40 | nextEventEndPosition() int64 |
| 41 | } |
| 42 | |
| 43 | // When tailing logs on a mysql box, there's a potential race conditions where |
| 44 | // the rotate event is written, but a new log file is not created yet. It's |
no outgoing calls
no test coverage detected