elasticsearch

package
v0.0.0-...-35a9412 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package elasticsearch is a package of utilities to store a PackageGraph's state in an ElasticSearch index. This allows indexing once and in a distributed fashion, and querying the ElasticSearch separately.

Index

Constants

View Source
const (
	PackageType = "package"
	RefType     = "ref"
	FileType    = "file"
)

Types in the Elastic search index

Variables

This section is empty.

Functions

func FilterF

func FilterF(client Client) func(string, int64) bool

FilterF returns a function suitable for goref.PackageGraph.FilterF that returns false if a package exists in this ElasticSearch index.

func LoadGraphToElastic

func LoadGraphToElastic(pg goref.PackageGraph, client Client) error

LoadGraphToElastic loads all Packages and Refs from a PackageGraph to the provided ES index.

func PackageExists

func PackageExists(loadpath string, version int64, client Client) bool

PackageExists returns whether the provided loadpath + version tuple exists in this index.

Types

type Client

type Client interface {
	// GetPackage retrieves a package by docID.
	GetPackage(ctx context.Context, docID string) (*elastic.GetResult, error)

	// CreatePackage creates a goref.Package entry in the index.
	CreatePackage(ctx context.Context, p *goref.Package) error

	// CreateFile creates a File entry in the index.
	CreateFile(ctx context.Context, f File) (*elastic.IndexResponse, error)

	// CreateRef creates a goref.Ref entry in the index.
	CreateRef(ctx context.Context, r *goref.Ref) (*elastic.IndexResponse, error)
}

Client is an abstraction over the underlying elastic.Client that provides higher-order methods to manipulate data stored in elasticsearch.

func NewClient

func NewClient(client *elastic.Client, index string) Client

NewClient initializes a clientImpl

type File

type File struct {
	Filename string `json:"filename"`
	Package  string `json:"package"`
}

File represents a mapping of a file in a package

Directories

Path Synopsis
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0

Jump to

Keyboard shortcuts

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