forked from bitstrapped/airbyte
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource.go
18 lines (16 loc) · 1.03 KB
/
source.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package airbyte
import "encoding/json"
// Source is the only interface you need to define to create your source!
type Source interface {
// Spec returns the input "form" spec needed for your source
Spec(logTracker LogTracker) (*ConnectorSpecification, error)
// Check verifies the source - usually verify creds/connection etc.
Check(srcCfgPath string, logTracker LogTracker) error
// Discover returns the schema of the data you want to sync
Discover(srcConfigPath string, logTracker LogTracker) (json.RawMessage, error)
// Read will read the actual data from your source and use tracker.Record(), tracker.State() and tracker.Log() to sync data with airbyte/destinations
// MessageTracker is thread-safe and so it is completely find to spin off goroutines to sync your data (just don't forget your waitgroups :))
// returning an error from this will cancel the sync and returning a nil from this will successfully end the sync
Read(sourceCfgPath string, prevStatePath string, configuredCat *ConfiguredCatalog,
tracker MessageTracker) error
}