Documentation ¶
Index ¶
- Constants
- func DeleteIndex(i *Index) error
- type Batcher
- type DocID
- type DocIDs
- type Document
- type Engine
- type Event
- type EventIndexer
- type HTTPServer
- type Index
- func (i *Index) Close() error
- func (i *Index) Contains(t time.Time) bool
- func (i *Index) Document(id DocID) ([]byte, error)
- func (i *Index) EndTime() time.Time
- func (i *Index) Expired(t time.Time, r time.Duration) bool
- func (i *Index) Index(documents []Document) error
- func (i *Index) Path() string
- func (i *Index) Search(q string) (DocIDs, error)
- func (i *Index) Shard(docId DocID) *Shard
- func (i *Index) StartTime() time.Time
- func (i *Index) Total() (uint64, error)
- type Indexes
- type Searcher
- type Server
- type Shard
Constants ¶
const ( DefaultNumShards = 16 DefaultIndexDuration = 24 * time.Hour DefaultRetentionPeriod = 24 * time.Hour RetentionCheckInterval = time.Hour )
Engine defaults
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Batcher ¶
type Batcher struct {
// contains filtered or unexported fields
}
Batcher accepts "input events", and once it has a certain number, or a certain amount of time has passed, sends those as indexable Events to an Indexer. It also supports a maximum number of unprocessed Events it will keep pending. Once this limit is reached, it will not accept anymore until outstanding Events are processed.
func NewBatcher ¶
NewBatcher returns a Batcher for EventIndexer e, a batching size of sz, a maximum duration of dur, and a maximum outstanding count of max.
type DocID ¶
type DocID string
DocID is a string, with the following configuration. It's 32-characters long, encoding 2 64-bit unsigned integers. When sorting DocIDs, the first 16 characters, reading from the left hand side represent the most significant 64-bit number. And therefore the next 16 characters represent the least-significant 64-bit number.
type Engine ¶
type Engine struct { NumShards int // Number of shards to use when creating an index. IndexDuration time.Duration // Duration of created indexes. RetentionPeriod time.Duration // How long after Index end-time to hang onto data. Logger *log.Logger // contains filtered or unexported fields }
Engine is the component that performs all indexing.
func (*Engine) Index ¶
Index indexes a batch of Events. It blocks until all processing has completed.
type EventIndexer ¶
EventIndexer is the interface a system than can index events must implement.
type HTTPServer ¶ added in v1.1.0
type HTTPServer struct { Searcher Searcher Logger *log.Logger // contains filtered or unexported fields }
HTTPServer serves query client connections.
func NewHTTPServer ¶ added in v1.1.0
func NewHTTPServer(iface string, searcher Searcher) *HTTPServer
NewHTTPServer returns a new Server instance.
func (*HTTPServer) Addr ¶ added in v1.1.0
func (s *HTTPServer) Addr() net.Addr
Addr returns the address to which the Server is bound.
func (*HTTPServer) ServeHTTP ¶ added in v1.1.0
func (s *HTTPServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements a http.Handler, serving the query interface for Ekanite
func (*HTTPServer) Start ¶ added in v1.1.0
func (s *HTTPServer) Start() error
Start instructs the Server to bind to the interface and accept connections.
type Index ¶
type Index struct { Shards []*Shard // Individual bleve indexes Alias bleve.IndexAlias // All bleve indexes as one reference, for search // contains filtered or unexported fields }
Index represents a collection of shards. It contains data for a specific time range.
func NewIndex ¶
NewIndex returns an Index for the given start and end time, with the requested shards. It returns an error if an index already exists at the path.
func (*Index) Contains ¶
Contains returns whether the index's time range includes the given reference time.
func (*Index) Expired ¶
Expired returns whether the index has expired at the given time, if the retention period is r.
func (*Index) Index ¶
Index indexes the slice of documents in the index. It takes care of all shard routing.
func (*Index) Search ¶
Search performs a search of the index using the given query. Returns IDs of documents which satisfy all queries. Returns Doc IDs in sorted order, ascending.
type Indexes ¶
type Indexes []*Index
Indexes is a slice of indexes.
type Server ¶
type Server struct { Searcher Searcher Logger *log.Logger // contains filtered or unexported fields }
Server serves query client connections.
type Shard ¶
type Shard struct {
// contains filtered or unexported fields
}
Shard is a the basic data store for indexed data. Indexing operations are not goroutine safe, and only 1 indexing operation should occur at one time.