Documentation
¶
Overview ¶
Package index provides the in-memory index implementation.
Index ¶
- func IndexKey(pattern, templateID string) string
- type Database
- func (d *Database) Clear()
- func (d *Database) DeleteIndex(pattern, templateID string)
- func (d *Database) GetIndex(pattern, templateID string) *Index
- func (d *Database) GetOrCreateIndex(pattern, templateID, rawPattern string) *Index
- func (d *Database) IndexCount() int
- func (d *Database) ListIndexes() []store.IndexInfo
- type DocRef
- type Index
- func (idx *Index) Clear()
- func (idx *Index) Delete(id string)
- func (idx *Index) Get(id string) []byte
- func (idx *Index) IsHealthy() bool
- func (idx *Index) Len() int
- func (idx *Index) Search(opts SearchOptions) []DocRef
- func (idx *Index) SetState(state State)
- func (idx *Index) State() State
- func (idx *Index) Upsert(id string, orderKey []byte)
- type SearchOptions
- type State
- type Store
- func (s *Store) ApplyDocumentProjection(replacements []store.Projection, progress string) error
- func (s *Store) Close() error
- func (s *Store) Delete(db, pattern, tmplID, docID string, progress string) error
- func (s *Store) DeleteDatabase(db string) error
- func (s *Store) DeleteIndex(db, pattern, tmplID string) error
- func (s *Store) DeleteQueryIndex(ref store.QueryIndexRef) error
- func (s *Store) Flush() error
- func (s *Store) Get(db, pattern, tmplID, docID string) ([]byte, bool)
- func (s *Store) GetState(db, pattern, tmplID string) (store.IndexState, error)
- func (s *Store) IsDatabaseRetired(db string) (bool, error)
- func (s *Store) ListBootstrapCatalogs() ([]store.BootstrapCatalog, error)
- func (s *Store) ListDatabases() ([]string, error)
- func (s *Store) ListIndexes(db string) ([]store.IndexInfo, error)
- func (s *Store) ListQueryIndexes() ([]store.QueryIndexRef, error)
- func (s *Store) LoadProgress() (string, error)
- func (s *Store) PublishBootstrapCatalog(catalog store.BootstrapCatalog) error
- func (s *Store) PublishBootstrapCatalogs(catalogs []store.BootstrapCatalog, progress string) error
- func (s *Store) PublishGeneration(ref store.QueryIndexRef, progress string) error
- func (s *Store) ReadBootstrapCatalog(database string) (store.BootstrapCatalog, bool, error)
- func (s *Store) ReadGeneration(db, collection, fingerprint string) (store.Generation, bool, error)
- func (s *Store) ReadView(ctx context.Context, ref store.QueryIndexRef, budget store.ReadBudget) (store.ReadView, error)
- func (s *Store) Search(db, pattern, tmplID string, opts store.SearchOptions) ([]store.DocRef, error)
- func (s *Store) SetFailure(ref store.QueryIndexRef, failure string) error
- func (s *Store) SetState(db, pattern, tmplID string, state store.IndexState) error
- func (s *Store) Upsert(db, pattern, tmplID, docID string, orderKey []byte, progress string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Database ¶
type Database struct {
Name string
// contains filtered or unexported fields
}
Database represents an isolated index namespace for a database. It contains multiple indexes keyed by (pattern|templateID).
func NewDatabase ¶
NewDatabase creates a new database index container.
func (*Database) DeleteIndex ¶
DeleteIndex removes an index from the database.
func (*Database) GetOrCreateIndex ¶
GetOrCreateIndex returns an existing index or creates a new one.
func (*Database) IndexCount ¶
IndexCount returns the number of indexes in the database.
func (*Database) ListIndexes ¶
ListIndexes returns metadata for all indexes in the database.
type DocRef ¶
type DocRef struct {
ID string // Document ID within the collection
OrderKey []byte // Encoded sort key
}
DocRef represents a document reference with its OrderKey.
type Index ¶
type Index struct {
Pattern string // Normalized pattern (e.g., "users/*/chats")
TemplateID string // Template identity (name or fields signature)
RawPattern string // Original pattern (e.g., "users/{uid}/chats")
// contains filtered or unexported fields
}
Index represents an index for a specific (pattern, templateID) pair. It maintains a btree for ordered iteration and a ByID map for O(1) lookups.
func (*Index) Get ¶
Get returns the OrderKey for a document by ID. Returns nil if the document is not indexed.
func (*Index) Search ¶
func (idx *Index) Search(opts SearchOptions) []DocRef
Search returns documents within the specified bounds. Results are returned in OrderKey order.
type SearchOptions ¶
type SearchOptions struct {
Lower []byte // Lower bound (inclusive)
Upper []byte // Upper bound (exclusive, nil means no upper bound)
StartAfter []byte // Cursor for pagination (exclusive)
Limit int // Max results to return
}
SearchOptions configures a search operation.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements store.Store interface using in-memory data structures.
func (*Store) ApplyDocumentProjection ¶
func (s *Store) ApplyDocumentProjection(replacements []store.Projection, progress string) error
func (*Store) DeleteDatabase ¶
DeleteDatabase removes all indexes for a database.
func (*Store) DeleteIndex ¶
DeleteIndex removes all data for an index.
func (*Store) DeleteQueryIndex ¶
func (s *Store) DeleteQueryIndex(ref store.QueryIndexRef) error
func (*Store) GetState ¶
func (s *Store) GetState(db, pattern, tmplID string) (store.IndexState, error)
GetState returns the state of an index.
func (*Store) ListBootstrapCatalogs ¶
func (s *Store) ListBootstrapCatalogs() ([]store.BootstrapCatalog, error)
func (*Store) ListDatabases ¶
ListDatabases returns all database names.
func (*Store) ListIndexes ¶
ListIndexes returns metadata for all indexes in a database.
func (*Store) ListQueryIndexes ¶
func (s *Store) ListQueryIndexes() ([]store.QueryIndexRef, error)
func (*Store) LoadProgress ¶
LoadProgress loads the event processing progress.
func (*Store) PublishBootstrapCatalog ¶
func (s *Store) PublishBootstrapCatalog(catalog store.BootstrapCatalog) error
func (*Store) PublishBootstrapCatalogs ¶
func (s *Store) PublishBootstrapCatalogs(catalogs []store.BootstrapCatalog, progress string) error
func (*Store) PublishGeneration ¶
func (s *Store) PublishGeneration(ref store.QueryIndexRef, progress string) error
func (*Store) ReadBootstrapCatalog ¶
func (*Store) ReadGeneration ¶
func (*Store) ReadView ¶
func (s *Store) ReadView(ctx context.Context, ref store.QueryIndexRef, budget store.ReadBudget) (store.ReadView, error)
func (*Store) Search ¶
func (s *Store) Search(db, pattern, tmplID string, opts store.SearchOptions) ([]store.DocRef, error)
Search returns documents within the specified bounds.
func (*Store) SetFailure ¶
func (s *Store) SetFailure(ref store.QueryIndexRef, failure string) error