Documentation ¶
Index ¶
- Constants
- Variables
- func Changesets(ctx context.Context, n ChangesetSeqNum) (osm.Changesets, error)
- func CurrentChangesetState(ctx context.Context) (ChangesetSeqNum, *State, error)
- func CurrentDayState(ctx context.Context) (DaySeqNum, *State, error)
- func CurrentHourState(ctx context.Context) (HourSeqNum, *State, error)
- func CurrentMinuteState(ctx context.Context) (MinuteSeqNum, *State, error)
- func Day(ctx context.Context, n DaySeqNum) (*osm.Change, error)
- func Hour(ctx context.Context, n HourSeqNum) (*osm.Change, error)
- func Minute(ctx context.Context, n MinuteSeqNum) (*osm.Change, error)
- type ChangesetSeqNum
- type Datasource
- func (ds *Datasource) Changesets(ctx context.Context, n ChangesetSeqNum) (osm.Changesets, error)
- func (ds *Datasource) CurrentChangesetState(ctx context.Context) (ChangesetSeqNum, *State, error)
- func (ds *Datasource) CurrentDayState(ctx context.Context) (DaySeqNum, *State, error)
- func (ds *Datasource) CurrentHourState(ctx context.Context) (HourSeqNum, *State, error)
- func (ds *Datasource) CurrentMinuteState(ctx context.Context) (MinuteSeqNum, *State, error)
- func (ds *Datasource) Day(ctx context.Context, n DaySeqNum) (*osm.Change, error)
- func (ds *Datasource) DayState(ctx context.Context, n DaySeqNum) (*State, error)
- func (ds *Datasource) Hour(ctx context.Context, n HourSeqNum) (*osm.Change, error)
- func (ds *Datasource) HourState(ctx context.Context, n HourSeqNum) (*State, error)
- func (ds *Datasource) Minute(ctx context.Context, n MinuteSeqNum) (*osm.Change, error)
- func (ds *Datasource) MinuteState(ctx context.Context, n MinuteSeqNum) (*State, error)
- type DaySeqNum
- type HourSeqNum
- type MinuteSeqNum
- type SeqNum
- type State
- type UnexpectedStatusCodeError
Constants ¶
const BaseURL = "http://planet.osm.org"
BaseURL defines the planet server to hit.
const DaySeqStart = DaySeqNum(1)
DaySeqStart is the beginning of valid day sequence data.
const HourSeqStart = HourSeqNum(11)
HourSeqStart is the beginning of valid hour sequence data. Without deep inspection it looks like 1-10 are from July 2013.
const MinuteSeqStart = MinuteSeqNum(4)
MinuteSeqStart is the beginning of valid minutely sequence data. The few before look to be way more than a minute. A quick looks says about 75, 57, 17 for 1, 2, 3 respectively.
Variables ¶
var DefaultDatasource = &Datasource{ Client: &http.Client{ Timeout: 30 * time.Minute, }, }
DefaultDatasource is the Datasource used by the package level convenience functions.
Functions ¶
func Changesets ¶
func Changesets(ctx context.Context, n ChangesetSeqNum) (osm.Changesets, error)
Changesets returns the complete list of changesets for the given replication sequence. Delegates to the DefaultDatasource and uses its http.Client to make the request.
func CurrentChangesetState ¶
func CurrentChangesetState(ctx context.Context) (ChangesetSeqNum, *State, error)
CurrentChangesetState returns the current state of the changeset replication. Delegates to the DefaultDatasource and uses its http.Client to make the request.
func CurrentDayState ¶
CurrentDayState returns the current state of the daily replication. Delegates to the DefaultDatasource and uses its http.Client to make the request.
func CurrentHourState ¶
func CurrentHourState(ctx context.Context) (HourSeqNum, *State, error)
CurrentHourState returns the current state of the hourly replication. Delegates to the DefaultDatasource and uses its http.Client to make the request.
func CurrentMinuteState ¶
func CurrentMinuteState(ctx context.Context) (MinuteSeqNum, *State, error)
CurrentMinuteState returns the current state of the minutely replication. Delegates to the DefaultDatasource and uses its http.Client to make the request.
func Day ¶
Day returns the change diff for a given day. Delegates to the DefaultDatasource and uses its http.Client to make the request.
Types ¶
type ChangesetSeqNum ¶
type ChangesetSeqNum uint64
ChangesetSeqNum indicates the sequence of the changeset replication found here: http://planet.osm.org/replication/changesets/
func (ChangesetSeqNum) Dir ¶
func (n ChangesetSeqNum) Dir() string
Dir returns the directory of this data on planet osm.
func (ChangesetSeqNum) String ¶
func (n ChangesetSeqNum) String() string
String returns 'changeset/%d'.
func (ChangesetSeqNum) Uint64 ¶
func (n ChangesetSeqNum) Uint64() uint64
Uint64 returns the seq num as a uint64 type.
type Datasource ¶
type Datasource struct { BaseURL string // will use package level BaseURL if empty Client *http.Client }
Datasource defines context around replication data requests.
func NewDatasource ¶
func NewDatasource(client *http.Client) *Datasource
NewDatasource creates a Datasource using the given client.
func (*Datasource) Changesets ¶
func (ds *Datasource) Changesets(ctx context.Context, n ChangesetSeqNum) (osm.Changesets, error)
Changesets returns the complete list of changesets in for the given replication sequence.
func (*Datasource) CurrentChangesetState ¶
func (ds *Datasource) CurrentChangesetState(ctx context.Context) (ChangesetSeqNum, *State, error)
CurrentChangesetState returns the current state of the changeset replication.
func (*Datasource) CurrentDayState ¶
CurrentDayState returns the current state of the daily replication.
func (*Datasource) CurrentHourState ¶
func (ds *Datasource) CurrentHourState(ctx context.Context) (HourSeqNum, *State, error)
CurrentHourState returns the current state of the hourly replication.
func (*Datasource) CurrentMinuteState ¶
func (ds *Datasource) CurrentMinuteState(ctx context.Context) (MinuteSeqNum, *State, error)
CurrentMinuteState returns the current state of the minutely replication.
func (*Datasource) Hour ¶
func (ds *Datasource) Hour(ctx context.Context, n HourSeqNum) (*osm.Change, error)
Hour returns the change diff for a given hour.
func (*Datasource) HourState ¶
func (ds *Datasource) HourState(ctx context.Context, n HourSeqNum) (*State, error)
HourState returns the state of the given hourly replication.
func (*Datasource) Minute ¶
func (ds *Datasource) Minute(ctx context.Context, n MinuteSeqNum) (*osm.Change, error)
Minute returns the change diff for a given minute.
func (*Datasource) MinuteState ¶
func (ds *Datasource) MinuteState(ctx context.Context, n MinuteSeqNum) (*State, error)
MinuteState returns the state of the given minutely replication.
type DaySeqNum ¶
type DaySeqNum uint64
DaySeqNum indicates the sequence of the daily diff replication found here: http://planet.osm.org/replication/day
type HourSeqNum ¶
type HourSeqNum uint64
HourSeqNum indicates the sequence of the hourly diff replication found here: http://planet.osm.org/replication/hour
func (HourSeqNum) Dir ¶
func (n HourSeqNum) Dir() string
Dir returns the directory of this data on planet osm.
func (HourSeqNum) Uint64 ¶
func (n HourSeqNum) Uint64() uint64
Uint64 returns the seq num as a uint64 type.
type MinuteSeqNum ¶
type MinuteSeqNum uint64
MinuteSeqNum indicates the sequence of the minutely diff replication found here: http://planet.osm.org/replication/minute
func (MinuteSeqNum) Dir ¶
func (n MinuteSeqNum) Dir() string
Dir returns the directory of this data on planet osm.
func (MinuteSeqNum) Uint64 ¶
func (n MinuteSeqNum) Uint64() uint64
Uint64 returns the seq num as a uint64 type.
type SeqNum ¶
type SeqNum interface { fmt.Stringer Dir() string Uint64() uint64 // contains filtered or unexported methods }
SeqNum is an interface type that includes MinuteSeqNum, HourSeqNum and DaySeqNum. This is an experiment to implement a sum type, a type that can be one of several things only.
type State ¶
type State struct { SeqNum uint64 `json:"seq_num"` Timestamp time.Time `json:"timestamp"` TxnMax int `json:"txn_max,omitempty"` TxnMaxQueried int `json:"txn_max_queries,omitempty"` }
State returns information about the current replication state.
func DayState ¶
DayState returns the state of the given daily replication. Delegates to the DefaultDatasource and uses its http.Client to make the request.
func HourState ¶
func HourState(ctx context.Context, n HourSeqNum) (*State, error)
HourState returns the state of the given hourly replication. Delegates to the DefaultDatasource and uses its http.Client to make the request.
func MinuteState ¶
func MinuteState(ctx context.Context, n MinuteSeqNum) (*State, error)
MinuteState returns the state of the given minutely replication. Delegates to the DefaultDatasource and uses its http.Client to make the request.
type UnexpectedStatusCodeError ¶
UnexpectedStatusCodeError is return for a non 200 or 404 status code.
func (*UnexpectedStatusCodeError) Error ¶
func (e *UnexpectedStatusCodeError) Error() string
Error returns an error message with some information.