run

package
v0.0.0-...-7cef974 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyValue

func KeyValue(v interface{}) (key, value []byte, err error)

KeyValue returns key and value for a levelDB record.

func Run

func Run(c *Command) error

Run executes main logic.

Types

type Command

type Command struct {
	PBFDecoder  *osmpbf.Decoder
	LevelDB     *leveldb.DB
	TagsMatcher tags.Matcher
	Stdout      io.Writer
}

Command represents an environment and settings for a command to run.

func (*Command) Collect

func (c *Command) Collect(v interface{}) error

Collect stores value in a key-value store indicating it as collected.

func (*Command) CollectRelated

func (c *Command) CollectRelated() error

CollectRelated marks related values of previously collected items as collected.

func (*Command) OutputJSON

func (c *Command) OutputJSON() error

OutputJSON outputs collected entries as JSON.

func (*Command) Put

func (c *Command) Put(v interface{}) error

Put stores value in a key-value store.

func (*Command) PutData

func (c *Command) PutData() error

PutData reads data from PBF and saves it in levelDB. If data item matches tags, it is saved as collected.

func (*Command) TagsMatch

func (c *Command) TagsMatch(v interface{}) bool

TagsMatch checks if Tags match the tags matching rules.

func (*Command) TraverseCollected

func (c *Command) TraverseCollected(fn TraverseCollectedFunc) error

TraverseCollected loops through the collected items and executes function on every item.

func (*Command) TraverseCollectedRaw

func (c *Command) TraverseCollectedRaw(fn TraverseCollectedRawFunc) error

TraverseCollectedRaw loops through the collected items and executes function on every item.

func (*Command) TraverseData

func (c *Command) TraverseData(fn TraverseDataFunc) error

TraverseData loops through the data and executes function on every data item.

type DBKey

type DBKey struct {
	Type osmpbf.MemberType `json:"t"`
	ID   int64             `json:"i"`
}

DBKey represents a key for a levelDB record.

func (*DBKey) Bytes

func (key *DBKey) Bytes() ([]byte, error)

Bytes returns byte slice representation of a key.

type TraverseCollectedFunc

type TraverseCollectedFunc func(k []byte, v interface{}) error

TraverseCollectedFunc is a function to use with TraverseCollected Command method.

type TraverseCollectedRawFunc

type TraverseCollectedRawFunc func(k, v []byte) error

TraverseCollectedRawFunc is a function to use with TraverseCollectedRaw Command method.

type TraverseDataFunc

type TraverseDataFunc func(interface{}) error

TraverseDataFunc is a function to use with TraverseData Command method.

Jump to

Keyboard shortcuts

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