cache

package
v0.6.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2018 License: Apache-2.0 Imports: 15 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 *element.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 *element.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 []element.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 (self *DeltaCoordsCache) CheckCapacity() error

func (*DeltaCoordsCache) Close

func (self *DeltaCoordsCache) Close() error

func (*DeltaCoordsCache) DeleteCoord

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

func (*DeltaCoordsCache) FillWay

func (self *DeltaCoordsCache) FillWay(way *element.Way) error

func (*DeltaCoordsCache) FirstRefIsCached

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

func (*DeltaCoordsCache) Flush

func (self *DeltaCoordsCache) Flush() error

func (*DeltaCoordsCache) GetCoord

func (self *DeltaCoordsCache) GetCoord(id int64) (*element.Node, error)

func (*DeltaCoordsCache) PutCoords

func (self *DeltaCoordsCache) PutCoords(nodes []element.Node) error

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

func (*DeltaCoordsCache) SetLinearImport

func (self *DeltaCoordsCache) SetLinearImport(v bool)

func (*DeltaCoordsCache) SetReadOnly

func (self *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) (*element.Node, error)

func (*NodesCache) Iter

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

func (*NodesCache) PutNode

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

func (*NodesCache) PutNodes

func (p *NodesCache) PutNodes(nodes []element.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 []element.Member) (bool, error)

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

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) (*element.Relation, error)

func (*RelationsCache) Iter

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

func (*RelationsCache) PutRelation

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

func (*RelationsCache) PutRelations

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

type WaysCache

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

func (*WaysCache) Close

func (c *WaysCache) Close()

func (*WaysCache) DeleteWay

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

func (*WaysCache) FillMembers

func (self *WaysCache) FillMembers(members []element.Member) error

func (*WaysCache) GetWay

func (p *WaysCache) GetWay(id int64) (*element.Way, error)

func (*WaysCache) Iter

func (p *WaysCache) Iter() chan *element.Way

func (*WaysCache) PutWay

func (p *WaysCache) PutWay(way *element.Way) error

func (*WaysCache) PutWays

func (p *WaysCache) PutWays(ways []element.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 []element.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