persist

package
v0.0.0-...-ad801e6 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Closer

type Closer func() error

Closer is a function that performs cleanup after persistence.

type FieldRetriever

type FieldRetriever interface {
	// RetrieveField retrieves a single field from persistent storage given the
	// field retrieval options. If a field doesn't exist for a given type specified
	// in the options, an error is returned.
	RetrieveField(
		namespace []byte,
		segmentMeta segment.Metadata,
		field RetrieveFieldOptions,
	) (indexfield.DocsField, error)

	// RetrieveFields retrieves a list of fields from persistent storage given the
	// field retrieval options. If a field doesn't exist for a given type specified
	// in the options, an error is returned.
	RetrieveFields(
		namespace []byte,
		segmentMeta segment.Metadata,
		fields []RetrieveFieldOptions,
	) ([]indexfield.DocsField, error)
}

FieldRetriever is responsible for retrieving fields from persistent storage. TODO(xichen): Investigate if it's worth providing an async API.

type Fns

type Fns struct {
	WriteFields func(fields []indexfield.DocsField) error
}

Fns contains a set of function that persists document IDs and different types of document values for a given field.

type Manager

type Manager interface {
	// StartPersist starts persisting data.
	StartPersist() (Persister, error)
}

Manager manages the internals of persisting data onto storage layer.

type Persister

type Persister interface {
	// Prepare prepares for data persistence.
	Prepare(opts PrepareOptions) (PreparedPersister, error)

	// Finish marks the persistence as complete.
	Finish() error

	// Close all resources owned by the persist manager.
	Close() error
}

Persister is responsible for actually persisting data.

type PrepareOptions

type PrepareOptions struct {
	Namespace   []byte
	SegmentMeta segment.Metadata
}

PrepareOptions provide a set of options for data persistence.

type PreparedPersister

type PreparedPersister struct {
	Persist Fns
	Close   Closer
}

PreparedPersister is an object that wraps a persist function and a closer.

type RetrieveFieldOptions

type RetrieveFieldOptions struct {
	FieldPath  []string
	FieldTypes field.ValueTypeSet
}

RetrieveFieldOptions contains the parameters for retrieving a field.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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