db interface
This commit is contained in:
parent
a311c7c2e3
commit
ab660ca622
18
db/accessor.go
Normal file
18
db/accessor.go
Normal file
@ -0,0 +1,18 @@
|
||||
package db
|
||||
|
||||
type Block struct {
|
||||
posx, posy, posz int
|
||||
data []byte
|
||||
mtime int64
|
||||
}
|
||||
|
||||
type DBAccessor interface {
|
||||
IsMigrated() (bool, error)
|
||||
Migrate() error
|
||||
FindLatestBlocks(time int64, limit int) []Block
|
||||
|
||||
//Block range lookup
|
||||
FindBlocks(posx int, posz int, posystart int, posyend int) []Block
|
||||
GetXRange(posystart int, posyend int) (int, int)
|
||||
GetZRange(posystart int, posyend int) (int, int)
|
||||
}
|
32
db/sqlite.go
Normal file
32
db/sqlite.go
Normal file
@ -0,0 +1,32 @@
|
||||
package db
|
||||
|
||||
type Sqlite3Accessor struct {
|
||||
}
|
||||
|
||||
func (db *Sqlite3Accessor) IsMigrated() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func (db *Sqlite3Accessor) Migrate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (db *Sqlite3Accessor) FindLatestBlocks(time int64, limit int) []Block {
|
||||
return make([]Block, 0)
|
||||
}
|
||||
|
||||
func (db *Sqlite3Accessor) FindBlocks(posx int, posz int, posystart int, posyend int) []Block {
|
||||
return make([]Block, 0)
|
||||
}
|
||||
|
||||
func (db *Sqlite3Accessor) GetXRange(posystart int, posyend int) (int, int) {
|
||||
return 0, 0
|
||||
}
|
||||
|
||||
func (db *Sqlite3Accessor) GetZRange(posystart int, posyend int) (int, int) {
|
||||
return 0, 0
|
||||
}
|
||||
|
||||
func NewSqliteAccessor(filename string) {
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user