elasticsearchstore

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: Apache-2.0 Imports: 16 Imported by: 4

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 = "Stratumn'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-core/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 chainscript.LinkHash, evidence *chainscript.Evidence) error

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

func (*ESStore) AddStoreEventChannel

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

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

func (es *ESStore) CreateLink(ctx context.Context, link *chainscript.Link) (chainscript.LinkHash, error)

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

func (*ESStore) DeleteValue

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

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

func (*ESStore) FindSegments

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

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

func (*ESStore) GetEvidences

func (es *ESStore) GetEvidences(ctx context.Context, linkHash chainscript.LinkHash) (types.EvidenceSlice, error)

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

func (*ESStore) GetInfo

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

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

func (*ESStore) GetMapIDs

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

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

func (*ESStore) GetSegment

func (es *ESStore) GetSegment(ctx context.Context, linkHash chainscript.LinkHash) (*chainscript.Segment, error)

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

func (*ESStore) GetValue

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

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

func (*ESStore) MultiMatchQuery

func (es *ESStore) MultiMatchQuery(ctx context.Context, query *SearchQuery) (*types.PaginatedSegments, 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-core/store.Adapter.NewBatch.

func (*ESStore) SetValue

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

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

func (*ESStore) SimpleSearchQuery

func (es *ESStore) SimpleSearchQuery(ctx context.Context, query *SearchQuery) (*types.PaginatedSegments, error)

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

type Evidences

type Evidences struct {
	Evidences types.EvidenceSlice `json:"evidences,omitempty"`
}

Evidences is a wrapper around types.EvidenceSlice 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