elasticstream/source/interface.go

23 lines
430 B
Go
Raw Normal View History

2024-10-07 16:26:41 +05:30
package source
2024-10-07 15:25:13 +05:30
import (
"context"
2024-10-07 16:26:41 +05:30
"elasticstream/config"
"elasticstream/opencdc"
2024-10-07 15:25:13 +05:30
)
type Position struct {
2024-10-07 22:41:59 +05:30
ID string `json:"id"`
Index string `json:"index"`
Pos int `json:"pos"`
2024-10-07 15:25:13 +05:30
}
type Source interface {
2024-10-07 16:26:41 +05:30
Configure(context.Context, config.Config) error
2024-10-07 15:25:13 +05:30
Open(context.Context, []Position) error
2024-10-07 16:26:41 +05:30
Read(context.Context) (*opencdc.Data, error)
2024-10-07 15:25:13 +05:30
Ack(context.Context, Position) error
Teardown(context.Context) error
}