index

package
v0.0.0-...-1c4df2c Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByIncreasingAge

type ByIncreasingAge []*kepEntry

func (ByIncreasingAge) Len

func (a ByIncreasingAge) Len() int

func (ByIncreasingAge) Less

func (a ByIncreasingAge) Less(i, j int) bool

func (ByIncreasingAge) Swap

func (a ByIncreasingAge) Swap(i, j int)

type Index

type Index interface {
	ClaimNextShortID() int // implementations of Index MUST tolerate HasShortID being called from within Update() to prevent deadlocks
	HasShortID(int) bool   // implementations of Index MUST tolerate HasShortID being called from within Update() to prevent deadlocks

	Fetch(string) (keps.Instance, error)

	// TODO add Filter(metadata.KEP) metadata.KEP
	// TODO add Remove(keps.Instance)
	Update(keps.Instance) error
	Persist() error
}

func New

func New(contentRoot string) (Index, error)

func Open

func Open(contentRoot string) (Index, error)

Open returns an existing Index persisted at contentRoot. The index will not be rebuilt so callers should not add a *new* KEP to the index. Open will fail if any persisted KEP entry cannot be loaded. Open is intended to be used in the context of operations on a *single* KEP

func Rebuild

func Rebuild(runtime settings.Runtime) (Index, error)

Rebuild

  • walks directories starting at runtime.ContentRoot() looking for KEP metadata.yaml files in the tree. For each metadata.yaml that is found
  • open KEP
  • add global index consistency checks to KEP
  • add KEP to index
  • keeps track of the highest short KEP ID encountered for possible future allocation

Jump to

Keyboard shortcuts

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