Documentation
¶
Overview ¶
package fetch provides methods for fetching Who's On First records and their ancestors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fetcher ¶
type Fetcher struct {
// contains filtered or unexported fields
}
type Fetcher is a struct for retrieving Who's On First documents.
func NewFetcher ¶
func NewFetcher(ctx context.Context, rdr reader.Reader, wr writer.Writer, opts *Options) (*Fetcher, error)
NewFetcher returns a new `Fecther` instance configured to read Who's On First documents using 'rdr' and to store them using 'wr'. Additional configuration options are defined by 'opts'
func (*Fetcher) FetchID ¶
func (f *Fetcher) FetchID(ctx context.Context, id int64, fetch_belongsto []string, done_ch chan bool, err_ch chan error)
FetchID will retrieve the Who's On First record for 'id'. If 'belongs_to' is non-empty it is assumed to be a list of valid Who's On First placetypes and used to determine additional ancestor records listed in each record retrieved that will subsequently be fetched. This method is designed to be run in a Go routine and signals the 'done_ch' and 'err_ch' channels with it is complete or an error is triggered.
type Options ¶
type Options struct { // Timings is a boolean flag to indicate whether timings should be recorded Timings bool // MaxClients is the number of simultaneous clients in use to fetch Who's On First records MaxClients int // Logger is a `log.Logger` instance for providing feedback Logger *log.Logger // Retries is the number of times to retry a failed attemp to fetch a Who's On First record Retries int }
Options is a struct containing configuration options for fetching Who's On First record
func DefaultOptions ¶
DefaultOptions returns a `Options` instance with: timings and retries disabled, the maximum number of simultaneous clients set to 10 and a `log.Default` logging instance.