index

package
v0.0.0-...-7eed66f Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ImageMapping *bleve.DocumentMapping

ImageMapping is a document mapping that specifies how to index an image

Functions

func BuildQuery

func BuildQuery(nameTag, advanced string) bleve.Query

BuildQuery returns the query object corresponding to given parameters

func DocumentToImage

func DocumentToImage(h *search.DocumentMatch) *dim.IndexImage

DocumentToImage reads all fields of the given DocumentMatch and returns an image

func Parse

func Parse(name string, img *dim.RegistryImage) *dim.IndexImage

Parse converts a docker image into an indexable image

Types

type Config

type Config struct {
	// Directory where to write index data
	Directory string
	// Hooks to trigger on event
	Hooks []*Hook
	// contains filtered or unexported fields
}

Config holds index configuration

func (*Config) GetHooks

func (c *Config) GetHooks(event dim.ActionType) []*Hook

GetHooks return all hooks for a given ActionType

func (*Config) ParseHooks

func (c *Config) ParseHooks() error

ParseHooks parses Action fields of all hooks and stores the template in their eval fields Functions available in templates should be added before with RegisterFunction

func (*Config) RegisterFunction

func (c *Config) RegisterFunction(name string, function interface{})

RegisterFunction adds a function that can be used in hook Actions

type Hook

type Hook struct {
	Event  dim.ActionType
	Action string
	// contains filtered or unexported fields
}

Hook evals the template string when an event of its type occurs

func (*Hook) Eval

func (h *Hook) Eval(image *dim.IndexImage) error

Eval runs the template with the given image as parameter

type Index

type Index struct {
	// Index is the bleve.Index instance
	bleve.Index
	Config    *Config
	RegClient dim.RegistryClient
	// contains filtered or unexported fields
}

Index manages indexation of docker images

func New

func New(cfg *Config, regClient dim.RegistryClient) (*Index, error)

New create a new instance to manage a index of a given registry into a specific directory

func (*Index) Build

func (idx *Index) Build() <-chan bool

Build creates a full index from the registry. The returned channel is closed once all images are indexed so the caller can block until the index is built if needed

func (*Index) DeleteImage

func (idx *Index) DeleteImage(id string)

DeleteImage removes an image from the index

func (*Index) FindImage

func (idx *Index) FindImage(id string) (*dim.IndexImage, error)

FindImage returns the image from the index with the given id

func (*Index) GetImage

func (idx *Index) GetImage(repository, tag string, dg digest.Digest) (*dim.IndexImage, error)

GetImage returns the docker image ready to be indexed

func (*Index) IndexImage

func (idx *Index) IndexImage(image *dim.IndexImage)

IndexImage adds a given image into the index

func (*Index) SearchImages

func (idx *Index) SearchImages(q, a string, fields []string, offset, maxResults int) (*dim.IndexResults, error)

SearchImages returns the images matching query. If fields is not empty, it fetches all given fields as well

func (*Index) Submit

func (idx *Index) Submit(job *dim.NotificationJob)

Submit pushes a NotificationJob that will be applied to the index

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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