elasticsearchstore

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name is the name set in the store's information.
	Name = "elasticsearch"

	// Description is the description set in the store's information.
	Description = "Indigo's ElasticSearch Store"

	// DefaultURL is the default URL of the database.
	DefaultURL = "http://elasticsearch:9200"
)

Variables

This section is empty.

Functions

func RegisterFlags

func RegisterFlags()

RegisterFlags registers the flags used by InitializeWithFlags.

Types

type Config

type Config struct {
	// A version string that will be set in the store's information.
	Version string

	// A git commit hash that will be set in the store's information.
	Commit string

	// The URL of the ElasticSearch database.
	URL string

	// Use sniffing feature of ElasticSearch.
	Sniffing bool

	// Logrus log level.
	LogLevel string
}

Config contains configuration options for the store.

type ESStore

type ESStore struct {
	// contains filtered or unexported fields
}

ESStore is the type that implements github.com/stratumn/go-indigocore/store.Adapter.

func Initialize

func Initialize(config *Config) *ESStore

Initialize initializes a elasticsearch store adapter.

func InitializeWithFlags

func InitializeWithFlags(version, commit string) *ESStore

InitializeWithFlags should be called after RegisterFlags and flag.Parse to initialize an elasticsearch adapter using flag values.

func New

func New(config *Config) (*ESStore, error)

New creates a new instance of an ElasticSearch store.

func (*ESStore) AddEvidence

func (es *ESStore) AddEvidence(ctx context.Context, linkHash *types.Bytes32, evidence *cs.Evidence) error

AddEvidence implements github.com/stratumn/go-indigocore/store.EvidenceWriter.AddEvidence.

func (*ESStore) AddStoreEventChannel

func (es *ESStore) AddStoreEventChannel(eventChan chan *store.Event)

AddStoreEventChannel implements github.com/stratumn/go-indigocore/store.Adapter.AddStoreEventChannel.

func (es *ESStore) CreateLink(ctx context.Context, link *cs.Link) (*types.Bytes32, error)

CreateLink implements github.com/stratumn/go-indigocore/store.LinkWriter.CreateLink.

func (*ESStore) DeleteValue

func (es *ESStore) DeleteValue(ctx context.Context, key []byte) ([]byte, error)

DeleteValue implements github.com/stratumn/go-indigocore/store.Adapter.DeleteValue.

func (*ESStore) FindSegments

func (es *ESStore) FindSegments(ctx context.Context, filter *store.SegmentFilter) (cs.SegmentSlice, error)

FindSegments implements github.com/stratumn/go-indigocore/store.Adapter.FindSegments.

func (*ESStore) GetEvidences

func (es *ESStore) GetEvidences(ctx context.Context, linkHash *types.Bytes32) (*cs.Evidences, error)

GetEvidences implements github.com/stratumn/go-indigocore/store.EvidenceReader.GetEvidences.

func (*ESStore) GetInfo

func (es *ESStore) GetInfo(ctx context.Context) (interface{}, error)

GetInfo implements github.com/stratumn/go-indigocore/store.Adapter.GetInfo.

func (*ESStore) GetMapIDs

func (es *ESStore) GetMapIDs(ctx context.Context, filter *store.MapFilter) ([]string, error)

GetMapIDs implements github.com/stratumn/go-indigocore/store.Adapter.GetMapIDs.

func (*ESStore) GetSegment

func (es *ESStore) GetSegment(ctx context.Context, linkHash *types.Bytes32) (*cs.Segment, error)

GetSegment implements github.com/stratumn/go-indigocore/store.Adapter.GetSegment.

func (*ESStore) GetValue

func (es *ESStore) GetValue(ctx context.Context, key []byte) ([]byte, error)

GetValue implements github.com/stratumn/go-indigocore/store.Adapter.GetValue.

func (*ESStore) MultiMatchQuery

func (es *ESStore) MultiMatchQuery(query *SearchQuery) (cs.SegmentSlice, error)

MultiMatchQuery searches through the store for segments matching query criteria using ES multi match query

func (*ESStore) NewBatch

func (es *ESStore) NewBatch(ctx context.Context) (store.Batch, error)

NewBatch implements github.com/stratumn/go-indigocore/store.Adapter.NewBatch.

func (*ESStore) SetValue

func (es *ESStore) SetValue(ctx context.Context, key, value []byte) error

SetValue implements github.com/stratumn/go-indigocore/store.KeyValueStore.SetValue.

func (*ESStore) SimpleSearchQuery

func (es *ESStore) SimpleSearchQuery(query *SearchQuery) (cs.SegmentSlice, error)

SimpleSearchQuery searches through the store for segments matching query criteria using ES simple query string feature

type Evidences

type Evidences struct {
	Evidences *cs.Evidences `json:"evidences,omitempty"`
}

Evidences is a wrapper around cs.Evidences for json ElasticSearch serialization compliance. Elastic Search does not allow indexing of arrays directly.

type Info

type Info struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Version     string `json:"version"`
	Commit      string `json:"commit"`
}

Info is the info returned by GetInfo.

type SearchQuery

type SearchQuery struct {
	store.SegmentFilter
	Query string
}

SearchQuery contains pagination and query string information.

type Value

type Value struct {
	Value []byte `json:"value,omitempty"`
}

Value is a wrapper struct for the value of the keyvalue store part. Elastic only accepts json structured objects.

Jump to

Keyboard shortcuts

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