cache

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package cache implements caches for coords, nodes, ways and relations data.

Index

Constants

View Source
const SKIP int64 = -1

Variables

View Source
var (
	NotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type CoordsRefIndex

type CoordsRefIndex struct {
	// contains filtered or unexported fields
}

func (CoordsRefIndex) Add

func (index CoordsRefIndex) Add(id, ref int64) error

func (*CoordsRefIndex) AddFromWay

func (index *CoordsRefIndex) AddFromWay(way *osm.Way)

func (CoordsRefIndex) Close

func (index CoordsRefIndex) Close()

func (CoordsRefIndex) Delete

func (index CoordsRefIndex) Delete(id int64) error

func (*CoordsRefIndex) DeleteFromWay

func (index *CoordsRefIndex) DeleteFromWay(way *osm.Way)

func (CoordsRefIndex) DeleteRef

func (index CoordsRefIndex) DeleteRef(id, ref int64) error

func (CoordsRefIndex) Flush

func (index CoordsRefIndex) Flush()

func (CoordsRefIndex) Get

func (index CoordsRefIndex) Get(id int64) []int64

func (CoordsRefIndex) SetLinearImport

func (index CoordsRefIndex) SetLinearImport(val bool)

SetLinearImport optimizes the cache for write operations. Get/Delete operations will panic during linear import.

type CoordsRelRefIndex

type CoordsRelRefIndex struct {
	// contains filtered or unexported fields
}

func (CoordsRelRefIndex) Add

func (index CoordsRelRefIndex) Add(id, ref int64) error

func (*CoordsRelRefIndex) AddFromMembers

func (index *CoordsRelRefIndex) AddFromMembers(relID int64, members []osm.Member)

func (CoordsRelRefIndex) Close

func (index CoordsRelRefIndex) Close()

func (CoordsRelRefIndex) Delete

func (index CoordsRelRefIndex) Delete(id int64) error

func (CoordsRelRefIndex) DeleteRef

func (index CoordsRelRefIndex) DeleteRef(id, ref int64) error

func (CoordsRelRefIndex) Flush

func (index CoordsRelRefIndex) Flush()

func (CoordsRelRefIndex) Get

func (index CoordsRelRefIndex) Get(id int64) []int64

func (CoordsRelRefIndex) SetLinearImport

func (index CoordsRelRefIndex) SetLinearImport(val bool)

SetLinearImport optimizes the cache for write operations. Get/Delete operations will panic during linear import.

type DeltaCoordsCache

type DeltaCoordsCache struct {
	// contains filtered or unexported fields
}

func (*DeltaCoordsCache) CheckCapacity

func (c *DeltaCoordsCache) CheckCapacity() error

func (*DeltaCoordsCache) Close

func (c *DeltaCoordsCache) Close() error

func (*DeltaCoordsCache) DeleteCoord

func (c *DeltaCoordsCache) DeleteCoord(id int64) error

func (*DeltaCoordsCache) FillWay

func (c *DeltaCoordsCache) FillWay(way *osm.Way) error

func (*DeltaCoordsCache) FirstRefIsCached

func (c *DeltaCoordsCache) FirstRefIsCached(refs []int64) (bool, error)

func (*DeltaCoordsCache) Flush

func (c *DeltaCoordsCache) Flush() error

func (*DeltaCoordsCache) GetCoord

func (c *DeltaCoordsCache) GetCoord(id int64) (*osm.Node, error)

func (*DeltaCoordsCache) PutCoords

func (c *DeltaCoordsCache) PutCoords(nodes []osm.Node) error

PutCoords puts nodes into cache. nodes need to be sorted by ID.

func (*DeltaCoordsCache) SetLinearImport

func (c *DeltaCoordsCache) SetLinearImport(v bool)

func (*DeltaCoordsCache) SetReadOnly

func (c *DeltaCoordsCache) SetReadOnly(val bool)

type DiffCache

type DiffCache struct {
	Dir       string
	Coords    *CoordsRefIndex    // Stores which ways a coord references
	CoordsRel *CoordsRelRefIndex // Stores which relations a coord references
	Ways      *WaysRefIndex      // Stores which relations a way references
	// contains filtered or unexported fields
}

func NewDiffCache

func NewDiffCache(dir string) *DiffCache

func (*DiffCache) Close

func (c *DiffCache) Close()

func (*DiffCache) Exists

func (c *DiffCache) Exists() bool

func (*DiffCache) Flush

func (c *DiffCache) Flush()

func (*DiffCache) Open

func (c *DiffCache) Open() error

func (*DiffCache) Remove

func (c *DiffCache) Remove() error

type NodesCache

type NodesCache struct {
	// contains filtered or unexported fields
}

func (*NodesCache) Close

func (c *NodesCache) Close()

func (*NodesCache) DeleteNode

func (p *NodesCache) DeleteNode(id int64) error

func (*NodesCache) GetNode

func (p *NodesCache) GetNode(id int64) (*osm.Node, error)

func (*NodesCache) Iter

func (p *NodesCache) Iter() chan *osm.Node

func (*NodesCache) PutNode

func (p *NodesCache) PutNode(node *osm.Node) error

func (*NodesCache) PutNodes

func (p *NodesCache) PutNodes(nodes []osm.Node) (int, error)

type OSMCache

type OSMCache struct {
	Coords    *DeltaCoordsCache
	Ways      *WaysCache
	Nodes     *NodesCache
	Relations *RelationsCache
	// contains filtered or unexported fields
}

func NewOSMCache

func NewOSMCache(dir string) *OSMCache

func (*OSMCache) Close

func (c *OSMCache) Close()

func (*OSMCache) Exists

func (c *OSMCache) Exists() bool

func (*OSMCache) FirstMemberIsCached

func (c *OSMCache) FirstMemberIsCached(members []osm.Member) (bool, error)

FirstMemberIsCached checks whether the first way or node member is cached. Also returns true if there are no members of type WayMember or NodeMember.

func (*OSMCache) Open

func (c *OSMCache) Open() error

func (*OSMCache) Remove

func (c *OSMCache) Remove() error

type RelationsCache

type RelationsCache struct {
	// contains filtered or unexported fields
}

func (*RelationsCache) Close

func (c *RelationsCache) Close()

func (*RelationsCache) DeleteRelation

func (p *RelationsCache) DeleteRelation(id int64) error

func (*RelationsCache) GetRelation

func (p *RelationsCache) GetRelation(id int64) (*osm.Relation, error)

func (*RelationsCache) Iter

func (p *RelationsCache) Iter() chan *osm.Relation

func (*RelationsCache) PutRelation

func (p *RelationsCache) PutRelation(relation *osm.Relation) error

func (*RelationsCache) PutRelations

func (p *RelationsCache) PutRelations(rels []osm.Relation) error

type WaysCache

type WaysCache struct {
	// contains filtered or unexported fields
}

func (*WaysCache) Close

func (c *WaysCache) Close()

func (*WaysCache) DeleteWay

func (c *WaysCache) DeleteWay(id int64) error

func (*WaysCache) FillMembers

func (c *WaysCache) FillMembers(members []osm.Member) error

func (*WaysCache) GetWay

func (c *WaysCache) GetWay(id int64) (*osm.Way, error)

func (*WaysCache) Iter

func (c *WaysCache) Iter() chan *osm.Way

func (*WaysCache) PutWay

func (c *WaysCache) PutWay(way *osm.Way) error

func (*WaysCache) PutWays

func (c *WaysCache) PutWays(ways []osm.Way) error

type WaysRefIndex

type WaysRefIndex struct {
	// contains filtered or unexported fields
}

func (WaysRefIndex) Add

func (index WaysRefIndex) Add(id, ref int64) error

func (*WaysRefIndex) AddFromMembers

func (index *WaysRefIndex) AddFromMembers(relID int64, members []osm.Member)

func (WaysRefIndex) Close

func (index WaysRefIndex) Close()

func (WaysRefIndex) Delete

func (index WaysRefIndex) Delete(id int64) error

func (WaysRefIndex) DeleteRef

func (index WaysRefIndex) DeleteRef(id, ref int64) error

func (WaysRefIndex) Flush

func (index WaysRefIndex) Flush()

func (WaysRefIndex) Get

func (index WaysRefIndex) Get(id int64) []int64

func (WaysRefIndex) SetLinearImport

func (index WaysRefIndex) SetLinearImport(val bool)

SetLinearImport optimizes the cache for write operations. Get/Delete operations will panic during linear import.

Directories

Path Synopsis
Package binary provides functions for (un)marshaling cache data.
Package binary provides functions for (un)marshaling cache data.
Package query provides the query-cache sub command for debugging and testing.
Package query provides the query-cache sub command for debugging and testing.

Jump to

Keyboard shortcuts

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