Documentation ¶
Index ¶
Constants ¶
const ( MAGIC_IMAGEDB = 0x496d616765444204 MAGIC_INDEXDB = 0x496e646578444204 SIZE_BUFFER = 8192 SIZE_HASH = 64 SIZE_INDEXDB_ENTRY = 81 SIZE_LENGTH_FIELD = 4 SIZE_MAGIC = 8 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ImageDatabase ¶
type ImageDatabase interface { Cleanup(keep func(ImageHandle) bool) error Close() error Insert(buf []byte) (ImageHandle, error) Open(handle ImageHandle) (tile.Image, error) }
* A database storing images and allowing lookup by image handles.
func CreateImageDatabase ¶
func CreateImageDatabase(fd Storage) (ImageDatabase, error)
* Creates an image database backed by Storage.
type ImageHandle ¶
* A handle to an image stored in an image database. * * An image handle is similar to a file name. However, it is computed from the * contents of the image.
type IndexDatabase ¶
type IndexDatabase interface { Close() error Entry(idx uint64) (tile.Id, TileMetadata, error) Insert(id tile.Id, metadata TileMetadata) error Length() (uint64, error) Search(id tile.Id) (uint64, bool) }
* A database mapping OSM tile IDs to image handles.
func CreateIndexDatabase ¶
func CreateIndexDatabase(fd Storage) (IndexDatabase, error)
* Creates an index database backed by Storage.
type Storage ¶
type Storage interface { ReadAt(buf []byte, offset int64) (int, error) Seek(offset int64, whence int) (int64, error) Truncate(size int64) error WriteAt(buf []byte, offset int64) (int, error) }
* Interface that a storage backing a database will have to implement. * * Typically, this storage will be a file.
type TileMetadata ¶
type TileMetadata struct {
// contains filtered or unexported fields
}
* Data structure representing metadata of a tile.
func CreateTileMetadata ¶
func CreateTileMetadata(timestampMs int64, handle ImageHandle) TileMetadata
* Create tile metadata structure. * * The timestamp is expected in milliseconds since the Epoch and will represent * the time when the entry was created (or last updated).
func (*TileMetadata) Handle ¶
func (this *TileMetadata) Handle() ImageHandle
* Returns the ImageHandle associated with this tile for lookup in * ImageDatabase.
func (*TileMetadata) TimestampMs ¶
func (this *TileMetadata) TimestampMs() int64
* Returns the timestamp in milliseconds since the Epoch associated with this * entry in the IndexDatabase. * * This will usually be the time of the last update to this entry.