Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
214 changes: 0 additions & 214 deletions replication/changesets.go

This file was deleted.

69 changes: 0 additions & 69 deletions replication/changesets_test.go

This file was deleted.

26 changes: 8 additions & 18 deletions replication/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"time"
)

// BaseURL defines the default planet server to hit.
const BaseURL = "https://planet.osm.org"
// BaseURL defines the default replication server to hit.
const BaseURL = "https://planet.osm.org/replication/minute"

// Datasource defines context around replication data requests.
type Datasource struct {
Expand All @@ -17,36 +17,26 @@ type Datasource struct {

// DefaultDatasource is the Datasource used by the package level convenience functions.
var DefaultDatasource = &Datasource{
BaseURL: BaseURL,
Client: &http.Client{
Timeout: 30 * time.Minute,
},
}

// NewDatasource creates a Datasource using the given client.
func NewDatasource(client *http.Client) *Datasource {
func NewDatasource(baseURL string, client *http.Client) *Datasource {
return &Datasource{
Client: client,
BaseURL: baseURL,
Client: client,
}
}

func (ds Datasource) baseURL() string {
if ds.BaseURL != "" {
return ds.BaseURL
}

return BaseURL
return ds.BaseURL
}

func (ds Datasource) client() *http.Client {
if ds.Client != nil {
return ds.Client
}

if DefaultDatasource.Client != nil {
return DefaultDatasource.Client
}

return http.DefaultClient
return ds.Client
}

// UnexpectedStatusCodeError is return for a non 200 or 404 status code.
Expand Down
Loading