index

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultBufferSize is the default buffer size.
	DefaultBufferSize = 1024
)

Variables

This section is empty.

Functions

func Put

func Put(ctx context.Context, putter Putter, s semix.Stream) semix.Stream

Put reads all tokens from a given stream into an index.

Types

type Entry

type Entry struct {
	ConceptURL, Path, RelationURL, Token string
	Begin, End, L                        int
	Ambiguous                            bool
}

Entry denotes a public available index entry

func (Entry) Direct

func (e Entry) Direct() bool

Direct returns true iff the entry represents a direct index entry.

type Interface

type Interface interface {
	Putter
	Get(string, func(Entry) bool) error
	Close() error
}

Interface represents the basic interface to put and get tokens from an index.

func New

func New(dir string, size int) (Interface, error)

New opens a directory index at the given directory path with and the given options.

func NewMemoryMap

func NewMemoryMap() Interface

NewMemoryMap create a new in memory index, that uses a simple map of Entry slices for storage.

type Putter

type Putter interface {
	Put(semix.Token) error
}

Putter represents a simple interface to put tokens into an index.

type Storage

type Storage interface {
	Put(string, []Entry) error
	Get(string, func(Entry) bool) error
	Close() error
}

Storage puts IndexEntries into files.

func OpenDirStorage

func OpenDirStorage(dir string) (Storage, error)

OpenDirStorage opens a new IndexStorage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL