Documentation
¶
Overview ¶
Package store is the data-access seam: a DataStore interface and its parquet-go implementation, reading Parquet tables from a directory or from any io.ReaderAt (for example an HTTP range reader).
Index ¶
- Variables
- func EntranceUnverified(r Row) bool
- func EntranceXY(r Row) (x, y float64, ok bool)
- func ReadManifest(dir string) (map[string]any, error)
- type DataStore
- type DirSource
- type HTTPRangeReader
- type HTTPSource
- type ParquetStore
- func (s *ParquetStore) Column(table, column string) ([]any, error)
- func (s *ParquetStore) Filter(table string, ranges ...Range) ([]Row, error)
- func (s *ParquetStore) Get(table string, id int64) (Row, error)
- func (s *ParquetStore) OpenFile(table string) (*parquet.File, error)
- func (s *ParquetStore) SearchName(table, text string, limit int) ([]Row, error)
- type Range
- type ReaderSource
- type Row
- type SizedReaderAt
- type Source
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned by Get when no row has the id, and by table lookups for a missing table.
Functions ¶
func EntranceUnverified ¶ added in v0.7.125
EntranceUnverified is true when an instances row names an entrance zone that is only a guess: the zone source is "observed" or "observed-unverified" and the row has no coordinates. A row with coordinates, or with a client source (or no source column), is verified.
func EntranceXY ¶ added in v0.7.125
EntranceXY is a dungeon row's entrance position in map percent (entrance_x, entrance_y); ok is false without both.
Types ¶
type DataStore ¶
type DataStore interface {
// Get returns the row whose id column equals id, or an error wrapping ErrNotFound.
Get(table string, id int64) (Row, error)
// Filter returns the rows where every range holds, in file order.
Filter(table string, ranges ...Range) ([]Row, error)
// SearchName returns up to limit rows whose name contains text, case-insensitively.
SearchName(table, text string, limit int) ([]Row, error)
}
DataStore is read access to game data tables. Every table has a numeric `id` column; text search uses the `name` column.
type HTTPRangeReader ¶
type HTTPRangeReader struct {
URL string
Client *http.Client
// contains filtered or unexported fields
}
HTTPRangeReader is an io.ReaderAt over one URL, using HTTP Range requests.
func NewHTTPRangeReader ¶
func NewHTTPRangeReader(client *http.Client, url string) (*HTTPRangeReader, error)
NewHTTPRangeReader finds the object's size with a HEAD request.
func (*HTTPRangeReader) Requests ¶
func (r *HTTPRangeReader) Requests() int64
Requests is the number of range requests made so far.
func (*HTTPRangeReader) Size ¶
func (r *HTTPRangeReader) Size() int64
type HTTPSource ¶
HTTPSource serves `<base>/<table>.parquet` over HTTP range requests.
type ParquetStore ¶
type ParquetStore struct {
// contains filtered or unexported fields
}
ParquetStore is a DataStore over a Source.
func New ¶
func New(src Source) *ParquetStore
func Shared ¶ added in v0.7.117
func Shared(dir string) *ParquetStore
Shared is NewDir for a long-running caller: the same store, with its opened tables, is returned while the directory is unchanged, so repeated rebuilds do not reopen the dataset.
func (*ParquetStore) Column ¶
func (s *ParquetStore) Column(table, column string) ([]any, error)
Column returns every value of one column in file order, reading only that column's pages.
func (*ParquetStore) Filter ¶
func (s *ParquetStore) Filter(table string, ranges ...Range) ([]Row, error)
func (*ParquetStore) OpenFile ¶
func (s *ParquetStore) OpenFile(table string) (*parquet.File, error)
OpenFile returns the table's Parquet file, opened once and kept.
func (*ParquetStore) SearchName ¶
func (s *ParquetStore) SearchName(table, text string, limit int) ([]Row, error)
type Range ¶
Range keeps rows whose Column lies in [Min, Max]; a nil bound is open. Bounds are numbers or strings, matching the column's type.
type ReaderSource ¶
type ReaderSource map[string]SizedReaderAt
ReaderSource serves tables from memory or any other io.ReaderAt, by table name.
type Row ¶
Row is one table row by column name. Integers are int64, floats float64, text string, booleans bool, nulls nil; a list column is a []any of those (empty for an empty list).
type SizedReaderAt ¶
SizedReaderAt is an io.ReaderAt that knows its length.