Documentation ¶
Index ¶
Constants ¶
View Source
const ( // ModeSnapshot represents a snapshot iterator mode. ModeSnapshot = "snapshot" // ModeCDC represents a CDC iterator mode. ModeCDC = "cdc" )
Variables ¶
View Source
var ( // ErrNoInitializedIterator occurs when the Combined iterator has no any initialized underlying iterators. ErrNoInitializedIterator = errors.New("no initialized iterator") // ErrFindAllShardsInKeyspaceReturnedNothing occurs when the vtctl's FindAllShardsInKeyspace command returned nothing. ErrFindAllShardsInKeyspaceReturnedNothing = errors.New("FindAllShardsInKeyspace returned nothing") // ErrNoIterator occurs when the [Combined] iterator doesn't have any underlying iterators ([Snapshot] or [CDC]). ErrNoIterator = errors.New("combined doesn't have an iterator") )
Functions ¶
This section is empty.
Types ¶
type Combined ¶
type Combined struct {
// contains filtered or unexported fields
}
Combined is a combined iterator that contains both snapshot and cdc iterators.
func NewCombined ¶
func NewCombined(ctx context.Context, params CombinedParams) (*Combined, error)
NewCombined creates new instance of the Combined.
func (*Combined) HasNext ¶
HasNext returns a bool indicating whether the iterator has the next record to return or not. If the underlying snapshot iterator returns false, the combined iterator will try to switch to the cdc iterator.
type CombinedParams ¶
type CombinedParams struct { Address string Table string KeyColumn string Keyspace string TabletType string OrderingColumn string Columns []string BatchSize int Snapshot bool Username string Password string MaxRetries int RetryTimeout time.Duration Position *Position }
CombinedParams is an incoming params for the NewCombined function.
type Position ¶
type Position struct { Mode Mode `json:"mode"` // Keyspace holds a name of a VTGate keyspace that the connector interact with. // Mode: snapshot, cdc. Keyspace string `json:"keyspace"` // LastProcessedElementValue is a value of the element // at which the iterator stopped reading rows. // The iterator will continue reading from the element if it's not empty. // Mode: snapshot, cdc. LastProcessedElementValue any `json:"last_processed_element_value,omitempty"` // ShardGtids holds a list of shards which the connector will read events from. // Mode: cdc. ShardGtids []*binlogdata.ShardGtid `json:"shard_gtids,omitempty"` }
Position is a combined iterator's position.
func ParsePosition ¶
ParsePosition converts an sdk.Position into a Position.
Click to show internal directories.
Click to hide internal directories.