geodb

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAGIC_NUMBER         = 0x47656f44420a0004
	SIZE_DATABASE_ENTRY  = 14
	SIZE_DATABASE_HEADER = 10
	SIZE_TIMESTAMP       = 6
	VERSION_MAJOR        = 1
	VERSION_MINOR        = 0
)

* Constants for the geographical database.

View Source
const (
	JSON_STREAM_HEADER = iota
	JSON_STREAM_ENTRIES
	JSON_STREAM_TRAILER
	JSON_STREAM_EOF
	JSON_STREAM_ERROR
)

* States for JSON serializer.

View Source
const (
	JSON_INDENT_IN   = 1
	JSON_INDENT_NONE = 0
	JSON_INDENT_OUT  = -1
)

* Indentation direction.

View Source
const (
	XML_STREAM_HEADER = iota
	XML_STREAM_ENTRIES
	XML_STREAM_TRAILER
	XML_STREAM_EOF
	XML_STREAM_ERROR
)

* States for XML serializer.

View Source
const (
	XML_INDENT_IN   = 1
	XML_INDENT_NONE = 0
	XML_INDENT_OUT  = -1
)

* Indentation direction.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	Append(loc *Location) error
	Close()
	Deduplicate() (uint32, error)
	LocationCount() uint32
	ReadLocations(offset uint32, target []Location) (uint32, error)
	SerializeBinary() io.ReadSeekCloser
	SerializeCSV() io.ReadCloser
	SerializeJSON(pretty bool) io.ReadCloser
	SerializeXML(pretty bool) io.ReadCloser
	Sort() error
}

* A database storing geographic data.

func Create

func Create(fd Storage) (Database, error)

* Creates a new database for storing geographic data, backed by Storage, which * will usually be a file descriptor available for reading and writing.

type Location

type Location struct {
	Timestamp   uint64
	LatitudeE7  int32
	LongitudeE7 int32
}

* A geographic location stored in the geo database.

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.

Jump to

Keyboard shortcuts

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