Documentation ¶
Index ¶
Constants ¶
View Source
const (
MinPlainCoord = -34351347711
)
Variables ¶
View Source
var IteratorBatchSize = 4096
IteratorBatchSize is a default value to be used while batching over Iterators.
Functions ¶
func AsBlockPos ¶ added in v1.1.45
AsBlockPos converts the coordinates from the given Node into the equivalent Block position. Each block contains 16x16x16 nodes.
func CoordToPlain ¶
func MigrateBlockDB ¶
func MigrateBlockDB(db *sql.DB, dbtype types.DatabaseType) error
func PlainToCoord ¶
Types ¶
type Block ¶
type BlockRepository ¶
type BlockRepository interface { types.Backup // GetByPost returns the map block at positions X,Y,Z. GetByPos(x, y, z int) (*Block, error) // Iterator returns a channel to fetch all data from the starting position // X,Y,Z (exclusive), with the map blocks sorted by position ascending. // Sorting is done by Z, Y, X to keep consistency with Sqlite map format. Iterator(x, y, z int) (chan *Block, types.Closer, error) // Update upserts the provided map block in the database, using the position // as key. Update(block *Block) error // Delete removes the map block from the database denoted by the x,y,z // coordinates. Delete(x, y, z int) error // Vacuum executes the storage layer vacuum command. Useful to reclaim // storage space if not done automatically by the backend. Vacuum() error // Count returns the total number of stored blocks in the map database. Count() (int64, error) // Close gracefully finishes the connection with the database backend. Close() error }
BlockRepository implementes data access layer for the Minetest map data. All positions are in mapblock coordinates, as described here: https://github.com/minetest/minetest/blob/master/doc/lua_api.md#mapblock-coordinates
func NewBlockRepository ¶
func NewBlockRepository(db *sql.DB, dbtype types.DatabaseType) BlockRepository
NewBlockRepository initializes the connection with the appropriate database backend and returns the BlockRepository implementation suited for it.
Click to show internal directories.
Click to hide internal directories.