2023-10-28 21:40:29 -07:00
|
|
|
package storage
|
|
|
|
|
2023-12-08 19:30:19 -08:00
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
2023-12-13 23:48:53 -08:00
|
|
|
"github.com/NickyBoy89/spatial-db/world"
|
2023-12-08 19:30:19 -08:00
|
|
|
)
|
2023-10-28 21:40:29 -07:00
|
|
|
|
|
|
|
type StorageServer interface {
|
2023-11-13 16:22:46 -08:00
|
|
|
// Individual operations
|
|
|
|
SetStorageRoot(path string)
|
|
|
|
|
2023-12-05 14:38:19 -08:00
|
|
|
// Block-level interactions
|
2023-12-10 21:27:05 -08:00
|
|
|
ChangeBlock(pos world.BlockPos, targetState world.BlockID) error
|
2023-12-05 14:38:19 -08:00
|
|
|
ReadBlockAt(pos world.BlockPos) (world.BlockID, error)
|
|
|
|
|
|
|
|
// Region-level interactions
|
2023-10-28 21:40:29 -07:00
|
|
|
ChangeBlockRange(targetState world.BlockID, start, end world.BlockPos) error
|
|
|
|
|
|
|
|
// Network-level operations
|
2023-12-10 21:27:05 -08:00
|
|
|
ReadChunkAt(pos world.ChunkPos) (world.ChunkData, error)
|
2023-10-28 21:40:29 -07:00
|
|
|
}
|
2023-12-08 19:30:19 -08:00
|
|
|
|
|
|
|
var (
|
|
|
|
ChunkNotFoundError = errors.New("chunk was not found in storage")
|
|
|
|
)
|