Documentation ¶
Overview ¶
Copyright 2018-2019 The logrange Authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cursor ¶
type Cursor interface { model.Iterator Id() uint64 // Offset moves the cursor position to backward (negative offset) of forward(positive offset) // from the current cursor position Offset(ctx context.Context, offs int) ApplyState(state State) error State(context.Context) State WaitNewData(ctx context.Context) error }
type ItFactory ¶ added in v0.1.0
type ItFactory interface { // GetJournals returns map of journals by tags:partition.Journal or an error, if any. The returned journals // must be released after usage by Release() function GetJournals(ctx context.Context, tagsCond *lql.Source, maxLimit int) (map[tag.Line]journal.Journal, error) // Iterator constructs new iterator for partition src. If the tmRange is provided the // iterator can utilize time-index for finding records Itearator(j journal.Journal, tmRange *model.TimeRange) journal.Iterator // Release releases the partition. Journal must not be used after the call Release(jn string) }
ItFactory interface is used for creating new cursors.
func NewItFactory ¶ added in v0.1.0
func NewItFactory() ItFactory
NewItFactory provides ItFactory implementation which based on partition.Service
type Provider ¶
type Provider interface { // GetOrCreate creates a new, or returns already exist cursor by its state (which contains cursor Id) GetOrCreate(ctx context.Context, state State, cache bool) (Cursor, error) // Release allows to release a cursor Release(ctx context.Context, curs Cursor) State }
Provider interface provides interface for managing cursors
func NewProvider ¶
func NewProvider() Provider
type State ¶
type State struct { // Id the cursor state Id Id uint64 // The Query contains the initial query for the cursor. Query string // Pos indicates the position of the record which must be read next. If it is not empty, it // will be applied to the Query Pos string }
State describes state of a cursor. This structure is used for creating new ones and for providing current state of a cursor