Documentation
¶
Index ¶
- type Config
- type CoordinatesForID
- type Index
- func (i *Index) Add(ctx context.Context, id uint64, coordinates *models.GeoCoordinates) error
- func (i *Index) Delete(id uint64) error
- func (i *Index) Drop(ctx context.Context) error
- func (i *Index) PostStartup()
- func (i *Index) WithinRange(ctx context.Context, geoRange filters.GeoRange) ([]uint64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ID string CoordinatesForID CoordinatesForID DisablePersistence bool RootPath string Logger logrus.FieldLogger }
Config is passed to the GeoIndex when its created
type CoordinatesForID ¶
CoordinatesForID must provide the geo coordinates for the specified index id
func (CoordinatesForID) VectorForID ¶
VectorForID transforms the geo coordinates into a "vector" of fixed length two, where element 0 represents the latitude and element 1 represents the longitude. This way it is usable by a generic vector index such as HNSW
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index wraps another index to provide geo searches. This allows us to reuse the hnsw vector index, without making geo searches dependent on hnsw-specific features.
In the future we could use this level of abstraction to provide a better suited geo-index if we deem it necessary
func NewIndex ¶
func NewIndex(config Config, commitLogMaintenanceCallbacks, tombstoneCleanupCallbacks, compactionCallbacks, flushCallbacks cyclemanager.CycleCallbackGroup, ) (*Index, error)
func (*Index) Add ¶
Add extends the index with the specified GeoCoordinates. It is thread-safe and can be called concurrently.
func (*Index) PostStartup ¶
func (i *Index) PostStartup()