importer

package
v0.0.0-...-4b1b879 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2013 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package importer imports content from third-party websites.

TODO(bradfitz): Finish this. Barely started.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterParser

func RegisterParser(name string, p Parser)

Types

type Importer

type Importer struct {
	// Target is the blobserver to populate.
	Target blobserver.StatReceiver

	// ProgressChan optionally specifies a channel to receive
	// progress messages of various types.  The types sent may be:
	//   - *ProgressMessage
	//   - *NewPermanodeMessage
	ProgressChan chan<- interface{}

	// Client optionally specifies how to fetch external network
	// resources.  If nil, http.DefaultClient is used.
	Client *http.Client
}

An Importer imports content from third-party websites into a Camlistore repo.

func (*Importer) Fetch

func (im *Importer) Fetch(url string) error

func (*Importer) ImportResponse

func (im *Importer) ImportResponse(res *http.Response) error

type Parser

type Parser interface {
	CanHandleURL(url string) YesNoMaybe
	CanHandleResponse(res *http.Response) bool
	Import(im *Importer) error
}

A Parser

type ProgressMessage

type ProgressMessage struct {
	ItemsDone, ItemsTotal int
	BytesDone, BytesTotal int64
}

type YesNoMaybe

type YesNoMaybe int

YesNoMaybe is a tri-state of "yes", "no", and "maybe".

const (
	No YesNoMaybe = iota
	Yes
	Maybe
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL